diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-07 00:25:19 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-07 00:25:19 +0100 |
commit | b43ed0554f5d6326f80e8d6bd85d75a422ca8c05 (patch) | |
tree | 596e967d69b073109dad7db437a60093bf499e26 /ui/applicationBase.cpp | |
parent | Replace deprecated GL_QUADS usage in text rendering (diff) | |
parent | Replace deprecated GL_QUADS usage in text rendering (diff) | |
download | ilt-b43ed0554f5d6326f80e8d6bd85d75a422ca8c05.tar.bz2 ilt-b43ed0554f5d6326f80e8d6bd85d75a422ca8c05.tar.xz ilt-b43ed0554f5d6326f80e8d6bd85d75a422ca8c05.zip |
Merge branch 'imgui'
Diffstat (limited to 'ui/applicationBase.cpp')
-rw-r--r-- | ui/applicationBase.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/applicationBase.cpp b/ui/applicationBase.cpp index 7764c58..961007b 100644 --- a/ui/applicationBase.cpp +++ b/ui/applicationBase.cpp @@ -1,9 +1,17 @@ #include "applicationBase.h" +#include "imgui_wrap.h" #include <SDL2/SDL.h> #include <stdexcept> ApplicationBase::ApplicationBase() { + initSDL(); + initImGUI(); +} + +void +ApplicationBase::initSDL() const +{ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) { throw std::runtime_error(SDL_GetError()); } @@ -27,7 +35,22 @@ ApplicationBase::ApplicationBase() setGlAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); } +void +ApplicationBase::initImGUI() const +{ + // Setup Dear ImGui context + IMGUI_CHECKVERSION(); + ImGui::CreateContext(); + ImGuiIO & io = ImGui::GetIO(); + io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls + io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls + io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable docking + io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable viewports + io.IniFilename = nullptr; // Disable saving settings automagically +} + ApplicationBase::~ApplicationBase() { SDL_Quit(); + ImGui::DestroyContext(); } |