From 88864f8e3a4d87566d157ac176da3cb56257ca6d Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Tue, 24 Sep 2024 16:03:47 -0500 Subject: More work on standup. --- src/imgui_context.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/imgui_context.cpp') diff --git a/src/imgui_context.cpp b/src/imgui_context.cpp index 7d972fd..49b74ca 100644 --- a/src/imgui_context.cpp +++ b/src/imgui_context.cpp @@ -1,14 +1,40 @@ #include "imgui_context.hpp" +#include +#include + namespace bookmouse { -ImguiContext::ImguiContext() +ImguiContext::ImguiContext(GlContext& glContext, SdlContext& sdlContext, SdlMainWindow& mainWindow) { + IMGUI_CHECKVERSION(); + ImGui::CreateContext(); + + setIOFlag(ImGuiConfigFlags_NavEnableKeyboard); + setIOFlag(ImGuiConfigFlags_NavEnableGamepad); + + ImGui::StyleColorsDark(); + // ImGui::StyleColorsLight(); + + ImGui_ImplSDL2_InitForOpenGL(mainWindow.window(), glContext.context()); + ImGui_ImplOpenGL3_Init(sdlContext.glslVersion()); } ImguiContext::~ImguiContext() { + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplSDL2_Shutdown(); + ImGui::DestroyContext(); } +void ImguiContext::setIOFlag(ImGuiConfigFlags_ flag) +{ + ImGui::GetIO().ConfigFlags |= flag; +} + +const ImGuiIO& ImguiContext::getIO() +{ + return ImGui::GetIO(); +} } // namespace bookmouse -- cgit v1.2.3