diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-09-24 20:00:16 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-09-24 20:00:16 -0500 |
commit | 348a1bfb244288b1c78d8ce3c8d8a8cb5c1bdebc (patch) | |
tree | 2f174aab662d753f2a9994fe6d0b7a1a06723156 /src/imgui_context.cpp | |
parent | 88864f8e3a4d87566d157ac176da3cb56257ca6d (diff) |
Start app rendering.
Diffstat (limited to 'src/imgui_context.cpp')
-rw-r--r-- | src/imgui_context.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/imgui_context.cpp b/src/imgui_context.cpp index 49b74ca..d0f9206 100644 --- a/src/imgui_context.cpp +++ b/src/imgui_context.cpp @@ -5,7 +5,8 @@ namespace bookmouse { -ImguiContext::ImguiContext(GlContext& glContext, SdlContext& sdlContext, SdlMainWindow& mainWindow) +ImguiContext::ImguiContext(GlContext& glContext, SdlContext& sdlContext, SdlMainWindow& mainWindow) : + m_mainWindow(mainWindow) { IMGUI_CHECKVERSION(); ImGui::CreateContext(); @@ -27,14 +28,33 @@ ImguiContext::~ImguiContext() ImGui::DestroyContext(); } -void ImguiContext::setIOFlag(ImGuiConfigFlags_ flag) +void ImguiContext::setIOFlag(ImGuiConfigFlags_ flag) const { ImGui::GetIO().ConfigFlags |= flag; } -const ImGuiIO& ImguiContext::getIO() +const ImGuiIO& ImguiContext::getIO() const { return ImGui::GetIO(); } +bool ImguiContext::processEvent(SDL_Event& event) const +{ + return ImGui_ImplSDL2_ProcessEvent(&event); +} + +void ImguiContext::startFrame() const +{ + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplSDL2_NewFrame(); + ImGui::NewFrame(); +} + +void ImguiContext::render() const +{ + ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); + SDL_GL_SwapWindow(m_mainWindow.window()); +} + } // namespace bookmouse |