summaryrefslogtreecommitdiff
path: root/src/imgui_context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imgui_context.cpp')
-rw-r--r--src/imgui_context.cpp26
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