From 348a1bfb244288b1c78d8ce3c8d8a8cb5c1bdebc Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Tue, 24 Sep 2024 20:00:16 -0500 Subject: Start app rendering. --- src/imgui_context.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/imgui_context.cpp') 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 -- cgit v1.2.3