Commit 6df339c9 authored by chili's avatar chili
Browse files

better organization of imgui windows

parent 83418ac3
...@@ -92,14 +92,27 @@ void App::DoFrame() ...@@ -92,14 +92,27 @@ void App::DoFrame()
wnd.Gfx().SetCamera( cam.GetMatrix() ); wnd.Gfx().SetCamera( cam.GetMatrix() );
light.Bind( wnd.Gfx(),cam.GetMatrix() ); light.Bind( wnd.Gfx(),cam.GetMatrix() );
// render geometry
for( auto& d : drawables ) for( auto& d : drawables )
{ {
d->Update( wnd.kbd.KeyIsPressed( VK_SPACE ) ? 0.0f : dt ); d->Update( wnd.kbd.KeyIsPressed( VK_SPACE ) ? 0.0f : dt );
d->Draw( wnd.Gfx() ); d->Draw( wnd.Gfx() );
} }
light.Draw( wnd.Gfx() ); light.Draw( wnd.Gfx() );
// imgui windows
SpawnSimulationWindow();
cam.SpawnControlWindow();
light.SpawnControlWindow();
SpawnBoxWindowManagerWindow();
SpawnBoxWindows();
// imgui window to control simulation speed // present
wnd.Gfx().EndFrame();
}
void App::SpawnSimulationWindow() noexcept
{
if( ImGui::Begin( "Simulation Speed" ) ) if( ImGui::Begin( "Simulation Speed" ) )
{ {
ImGui::SliderFloat( "Speed Factor",&speed_factor,0.0f,6.0f,"%.4f",3.2f ); ImGui::SliderFloat( "Speed Factor",&speed_factor,0.0f,6.0f,"%.4f",3.2f );
...@@ -107,10 +120,10 @@ void App::DoFrame() ...@@ -107,10 +120,10 @@ void App::DoFrame()
ImGui::Text( "Status: %s",wnd.kbd.KeyIsPressed( VK_SPACE ) ? "PAUSED" : "RUNNING (hold spacebar to pause)" ); ImGui::Text( "Status: %s",wnd.kbd.KeyIsPressed( VK_SPACE ) ? "PAUSED" : "RUNNING (hold spacebar to pause)" );
} }
ImGui::End(); ImGui::End();
// imgui windows to control camera and light }
cam.SpawnControlWindow();
light.SpawnControlWindow(); void App::SpawnBoxWindowManagerWindow() noexcept
// imgui window to open box windows {
if( ImGui::Begin( "Boxes" ) ) if( ImGui::Begin( "Boxes" ) )
{ {
using namespace std::string_literals; using namespace std::string_literals;
...@@ -138,14 +151,14 @@ void App::DoFrame() ...@@ -138,14 +151,14 @@ void App::DoFrame()
} }
} }
ImGui::End(); ImGui::End();
// imgui box attribute control windows }
void App::SpawnBoxWindows() noexcept
{
for( auto id : boxControlIds ) for( auto id : boxControlIds )
{ {
boxes[id]->SpawnControlWindow( id,wnd.Gfx() ); boxes[id]->SpawnControlWindow( id,wnd.Gfx() );
} }
// present
wnd.Gfx().EndFrame();
} }
App::~App() App::~App()
......
...@@ -15,6 +15,9 @@ public: ...@@ -15,6 +15,9 @@ public:
~App(); ~App();
private: private:
void DoFrame(); void DoFrame();
void SpawnSimulationWindow() noexcept;
void SpawnBoxWindowManagerWindow() noexcept;
void SpawnBoxWindows() noexcept;
private: private:
ImguiManager imgui; ImguiManager imgui;
Window wnd; Window wnd;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment