diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-02 18:20:22 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-02 18:20:22 +0100 |
commit | 9d6d2c0eb21b6295b2668c23f0ef386d5827a83f (patch) | |
tree | ec4bedce6f3a695aa75412f30259e0f791f46f82 /ui/applicationBase.cpp | |
parent | Add an InstanceVertices partition perf test (diff) | |
parent | Build ImGui as a static library (diff) | |
download | ilt-9d6d2c0eb21b6295b2668c23f0ef386d5827a83f.tar.bz2 ilt-9d6d2c0eb21b6295b2668c23f0ef386d5827a83f.tar.xz ilt-9d6d2c0eb21b6295b2668c23f0ef386d5827a83f.zip |
Psycho-rebased branch imgui on top of main
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(); } |