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

better organization of imgui windows

parent 83418ac3
......@@ -92,6 +92,7 @@ void App::DoFrame()
wnd.Gfx().SetCamera( cam.GetMatrix() );
light.Bind( wnd.Gfx(),cam.GetMatrix() );
// render geometry
for( auto& d : drawables )
{
d->Update( wnd.kbd.KeyIsPressed( VK_SPACE ) ? 0.0f : dt );
......@@ -99,7 +100,19 @@ void App::DoFrame()
}
light.Draw( wnd.Gfx() );
// imgui window to control simulation speed
// imgui windows
SpawnSimulationWindow();
cam.SpawnControlWindow();
light.SpawnControlWindow();
SpawnBoxWindowManagerWindow();
SpawnBoxWindows();
// present
wnd.Gfx().EndFrame();
}
void App::SpawnSimulationWindow() noexcept
{
if( ImGui::Begin( "Simulation Speed" ) )
{
ImGui::SliderFloat( "Speed Factor",&speed_factor,0.0f,6.0f,"%.4f",3.2f );
......@@ -107,10 +120,10 @@ void App::DoFrame()
ImGui::Text( "Status: %s",wnd.kbd.KeyIsPressed( VK_SPACE ) ? "PAUSED" : "RUNNING (hold spacebar to pause)" );
}
ImGui::End();
// imgui windows to control camera and light
cam.SpawnControlWindow();
light.SpawnControlWindow();
// imgui window to open box windows
}
void App::SpawnBoxWindowManagerWindow() noexcept
{
if( ImGui::Begin( "Boxes" ) )
{
using namespace std::string_literals;
......@@ -138,14 +151,14 @@ void App::DoFrame()
}
}
ImGui::End();
// imgui box attribute control windows
}
void App::SpawnBoxWindows() noexcept
{
for( auto id : boxControlIds )
{
boxes[id]->SpawnControlWindow( id,wnd.Gfx() );
}
// present
wnd.Gfx().EndFrame();
}
App::~App()
......
......@@ -15,6 +15,9 @@ public:
~App();
private:
void DoFrame();
void SpawnSimulationWindow() noexcept;
void SpawnBoxWindowManagerWindow() noexcept;
void SpawnBoxWindows() noexcept;
private:
ImguiManager imgui;
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