cleaned up ImGui a bit

This commit is contained in:
Ben
2021-09-20 16:13:47 +01:00
parent ad0e841e9b
commit 8b74ad752c
4 changed files with 7 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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 );

View File

View File

@@ -1,6 +1,8 @@
#ifndef AEON_RENDERING_IMGUI_H_
#define AEON_RENDERING_IMGUI_H_
#include <type_traits>
#include <SDL.h>
extern "C" {
#include <ThirdParty/glad.h>
@@ -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<SDL_Window*>(window), context );
ImGui_ImplOpenGL3_Init( "#version 450" );
}