diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-09-24 16:03:47 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-09-24 16:03:47 -0500 |
commit | 88864f8e3a4d87566d157ac176da3cb56257ca6d (patch) | |
tree | 10e37ca120877020aff3255a8fbd145da003a49d /src/imgui_context.cpp | |
parent | b4a17e3a28f31217c79faa160f5e6abd720da054 (diff) |
More work on standup.
Diffstat (limited to 'src/imgui_context.cpp')
-rw-r--r-- | src/imgui_context.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
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 <imgui/imgui_impl_opengl3.h> +#include <imgui/imgui_impl_sdl2.h> + 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 |