Fissata posizione selezione piano

This commit is contained in:
2026-06-07 16:30:35 +02:00
parent c1627b1759
commit 2d417cec32
5 changed files with 20 additions and 17 deletions
+4 -4
View File
@@ -23,8 +23,8 @@ Pos=68,96
Size=740,472 Size=740,472
[Window][Set data position] [Window][Set data position]
Pos=0,765 Pos=0,589
Size=856,50 Size=780,30
[Window][Dear ImGui Demo/ResizableChild_478B81A3] [Window][Dear ImGui Demo/ResizableChild_478B81A3]
IsChild=1 IsChild=1
@@ -39,6 +39,6 @@ Pos=60,60
Size=353,1005 Size=353,1005
[Window][Set visualization plane] [Window][Set visualization plane]
Pos=418,11 Pos=380,0
Size=347,56 Size=400,30
Binary file not shown.
+2 -2
View File
@@ -8,9 +8,9 @@
enum class ReferencePlane { enum class ReferencePlane {
XY, XZ,
YZ, YZ,
XZ XZN
}; };
//classi //classi
+12 -9
View File
@@ -43,7 +43,7 @@ struct State
State(unsigned w, unsigned h, std::string title, unsigned int* maj, unsigned int* min, unsigned int* pos) State(unsigned w, unsigned h, std::string title, unsigned int* maj, unsigned int* min, unsigned int* pos)
{ {
window = sf::RenderWindow(sf::VideoMode({w, h}), title); window = sf::RenderWindow(sf::VideoMode({w, h}), title);
ImGui::SFML::Init(window); if (ImGui::SFML::Init(window)); // L'if è solo per togliere il warning, va aggiustato gestendo le eccezioni
clock.restart(); clock.restart();
intervalMajLimit = maj; intervalMajLimit = maj;
intervalMinLimit = min; intervalMinLimit = min;
@@ -63,13 +63,15 @@ struct State
void State::update(){ void State::update(){
if (play){
for(PieceInterface* p : pieces){ for(PieceInterface* p : pieces){
p->update(clock); p->update(clock);
}
} }
for(JointInterface* j : joints){ for(JointInterface* j : joints){
j->movechild(); j->movechild();
} }
} }
/// ///
@@ -242,8 +244,8 @@ void doGUI(State &gs)
//Finestra gestione piano visualizzazione //Finestra gestione piano visualizzazione
ImGui::Begin("Set visualization plane"); ImGui::Begin("Set visualization plane",0,sdp_flags);
const char* MyEnumNames[] = { "Basso", "Medio", "Alto" }; const char* MyEnumNames[] = { "XZ", "YZ", "-XZ" };
int currentPlane = (int)gs.selectedPlane; int currentPlane = (int)gs.selectedPlane;
ImGui::SliderInt("Selected Plane", &currentPlane,0,2,MyEnumNames[currentPlane]); ImGui::SliderInt("Selected Plane", &currentPlane,0,2,MyEnumNames[currentPlane]);
gs.selectedPlane = (ReferencePlane)currentPlane; gs.selectedPlane = (ReferencePlane)currentPlane;
@@ -251,9 +253,10 @@ void doGUI(State &gs)
sf::Vector2u wsize = gs.window.getSize(); sf::Vector2u wsize = gs.window.getSize();
ImGui::SetWindowPos("Set data position",ImVec2(0,wsize.y - 50)); ImGui::SetWindowPos("Set data position",ImVec2(0,wsize.y - 30));
ImGui::SetWindowSize("Set data position",ImVec2(wsize.x,50)); ImGui::SetWindowSize("Set data position",ImVec2(wsize.x,30));
ImGui::SetWindowPos("Set visualization plane",ImVec2(wsize.x-400,0));
ImGui::SetWindowSize("Set visualization plane",ImVec2(400,30));
ImGui::SFML::Render(gs.window); ImGui::SFML::Render(gs.window);
} }
+2 -2
View File
@@ -59,8 +59,8 @@ int main() {
gs.pieces.push_back(new Torso(rb::Vector3{300,400,150},2)); gs.pieces.push_back(new Torso(rb::Vector3{300,400,150},2));
// modifico la rotazione relativa della gamba // modifico la rotazione relativa della gamba
gs.pieces[1]->body.setRot({_Float16 (1.3),_Float16 (1.5),0}); gs.pieces[1]->body.setRot({_Float16 (1.3),_Float16 (1.7),0});
gs.pieces[3]->body.setRot({_Float16 (1.8),_Float16 (1.5),0}); gs.pieces[3]->body.setRot({_Float16 (1.8),_Float16 (1.7),0});