From 8b74ad752cbd27c2e5470b856fe3032736dae198 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 20 Sep 2021 16:13:47 +0100 Subject: [PATCH] cleaned up ImGui a bit --- Aeon/Core/Display.cpp | 3 ++- Aeon/Core/Display.hpp | 2 +- Aeon/Rendering/Device/OpenGL/Shader.hpp | 0 Aeon/Rendering/ImGui.hpp | 6 ++++-- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 Aeon/Rendering/Device/OpenGL/Shader.hpp diff --git a/Aeon/Core/Display.cpp b/Aeon/Core/Display.cpp index bd2efa6..98de203 100644 --- a/Aeon/Core/Display.cpp +++ b/Aeon/Core/Display.cpp @@ -60,6 +60,7 @@ bool Display::Create( const DisplayProperties& properties ) Aeon::Rendering::SetupImGui( mWindow, mContext ); + // Make sure ImGUI is ready to be used on the first frame ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplSDL2_NewFrame(); ImGui::NewFrame(); @@ -77,7 +78,7 @@ const unsigned int Display::GetHeight() return mHeight; } -SDL_Window* Display::GetWindow() +const SDL_Window* Display::GetWindow() { return mWindow; } diff --git a/Aeon/Core/Display.hpp b/Aeon/Core/Display.hpp index 06b6032..f455a2a 100644 --- a/Aeon/Core/Display.hpp +++ b/Aeon/Core/Display.hpp @@ -24,7 +24,7 @@ public: const unsigned int GetWidth(); const unsigned int GetHeight(); - SDL_Window* GetWindow(); + const SDL_Window* GetWindow(); const SDL_GLContext& GetContext(); void SetClearColour( float r, float g, float b, float a = 1.0f ); diff --git a/Aeon/Rendering/Device/OpenGL/Shader.hpp b/Aeon/Rendering/Device/OpenGL/Shader.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Aeon/Rendering/ImGui.hpp b/Aeon/Rendering/ImGui.hpp index b870312..949f114 100644 --- a/Aeon/Rendering/ImGui.hpp +++ b/Aeon/Rendering/ImGui.hpp @@ -1,6 +1,8 @@ #ifndef AEON_RENDERING_IMGUI_H_ #define AEON_RENDERING_IMGUI_H_ +#include + #include extern "C" { #include @@ -13,14 +15,14 @@ extern "C" { namespace Aeon::Rendering { -inline void SetupImGui( SDL_Window* window, const SDL_GLContext& context ) +inline void SetupImGui( const SDL_Window* window, const SDL_GLContext& context ) { IMGUI_CHECKVERSION(); ImGui::CreateContext(); static ImGuiIO& io = ImGui::GetIO(); ImGui::StyleColorsDark(); - ImGui_ImplSDL2_InitForOpenGL( window, context ); + ImGui_ImplSDL2_InitForOpenGL( const_cast(window), context ); ImGui_ImplOpenGL3_Init( "#version 450" ); }