summaryrefslogtreecommitdiff
path: root/ui/applicationBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui/applicationBase.cpp')
-rw-r--r--ui/applicationBase.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/applicationBase.cpp b/ui/applicationBase.cpp
index 2be1f6c..3fa6e2b 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());
}
@@ -24,7 +32,21 @@ 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
+}
+
ApplicationBase::~ApplicationBase()
{
SDL_Quit();
+ ImGui::DestroyContext();
}