Commit dbee5401 authored by chili's avatar chili
Browse files

basic imgui control (imgui capture test)

parent 0c2a85c3
......@@ -79,16 +79,7 @@ App::App()
void App::DoFrame()
{
const auto dt = timer.Mark();
if( wnd.kbd.KeyIsPressed( VK_SPACE ) )
{
wnd.Gfx().DisableImgui();
}
else
{
wnd.Gfx().EnableImgui();
}
const auto dt = timer.Mark() * speed_factor;
wnd.Gfx().BeginFrame( 0.07f,0.0f,0.12f );
for( auto& d : drawables )
......@@ -96,11 +87,17 @@ void App::DoFrame()
d->Update( wnd.kbd.KeyIsPressed( VK_SPACE ) ? 0.0f : dt );
d->Draw( wnd.Gfx() );
}
if( show_demo_window )
static char buffer[1024];
// imgui window to control simulation speed
if( ImGui::Begin( "Simulation Speed" ) )
{
ImGui::ShowDemoWindow( &show_demo_window );
ImGui::SliderFloat( "Speed Factor",&speed_factor,0.0f,4.0f );
ImGui::Text( "Application average %.3f ms/frame (%.1f FPS)",1000.0f / ImGui::GetIO().Framerate,ImGui::GetIO().Framerate );
ImGui::InputText( "Butts",buffer,sizeof( buffer ) );
}
ImGui::End();
// present
wnd.Gfx().EndFrame();
......
......@@ -17,6 +17,6 @@ private:
Window wnd;
ChiliTimer timer;
std::vector<std::unique_ptr<class Drawable>> drawables;
bool show_demo_window = true;
float speed_factor = 1.0f;
static constexpr size_t nDrawables = 180;
};
\ No newline at end of file
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