Skip to content

Commit

Permalink
Supressed the catch of ESC for debug mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
anirul committed Feb 14, 2024
1 parent 0df4ef5 commit b774e1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
5 changes: 0 additions & 5 deletions examples/02-scene_simple/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <windows.h>
#endif

#include <imgui.h>

#include "frame/common/application.h"
#include "frame/file/file_system.h"
#include "frame/file/image_stb.h"
Expand Down Expand Up @@ -51,9 +49,6 @@ try
gui_window->AddWindow(std::make_unique<frame::gui::WindowLogger>("Logger"));
// Set the main window in full.
// gui_window->SetVisible(false);
ImGuiStyle& style = ImGui::GetStyle();
style.Colors[ImGuiCol_PopupBg] = ImVec4(
0.1f, 0.5f, 0.1f, 0.9f); // Dark background with some transparency
gui_window->AddModalWindow(
std::make_unique<ModalInfo>("Info", "This is a test modal window."));
win->GetDevice().AddPlugin(std::move(gui_window));
Expand Down
24 changes: 6 additions & 18 deletions src/frame/opengl/sdl_opengl_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,18 @@ void SDLOpenGLWindow::Run(std::function<void()> lambda)
}
}
if (skip)
{
continue;
}
if (!RunEvent(event, dt))
{
loop = false;
}
}
if (input_interface_)
{
input_interface_->NextFrame();

}
device_->Display(time.count());

// Draw the Scene not used?
Expand All @@ -122,7 +125,9 @@ void SDLOpenGLWindow::Run(std::function<void()> lambda)

// TODO(anirul): Fix me to check which device this is.
if (device_)
{
SDL_GL_SwapWindow(sdl_window_);
}
} while (loop);
}

Expand All @@ -140,23 +145,6 @@ bool SDLOpenGLWindow::RunEvent(const SDL_Event& event, const double dt)
{
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE: {
if (has_window_plugin)
{
for (PluginInterface* plugin : device_->GetPluginPtrs())
{
auto* window_plugin =
dynamic_cast<frame::gui::DrawGuiInterface*>(plugin);
if (window_plugin)
{
auto is_visible = window_plugin->IsVisible();
window_plugin->SetVisible(!is_visible);
}
}
return true;
}
return false;
}
case SDLK_PRINTSCREEN:
device_->ScreenShot("ScreenShot.png");
return true;
Expand Down

0 comments on commit b774e1d

Please sign in to comment.