YoggieEngine/BarinkEngine/graphics/GUI/GUIManager.cpp
nigel 76c051e407 Made multiple managers for individual pieces
Added UIManager that renders the UI inside the window
2022-05-28 18:49:08 +02:00

39 lines
769 B
C++

#include "Graphics/GUI/GUIManager.h"
#include "imgui.h"
#include "backends/imgui_impl_opengl3.h"
#include <backends/imgui_impl_glfw.cpp>
GUIManager::GUIManager(BarinkWindow* window)
: currentwindow(window)
{
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
(void)io;
ImGui::StyleColorsDark();
ImGui_ImplGlfw_InitForOpenGL(currentwindow->windowptr(), true);
ImGui_ImplOpenGL3_Init("#version 440");
ImGui_ImplGlfw_NewFrame();
ImGui_ImplOpenGL3_NewFrame();
}
GUIManager::~GUIManager()
{
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
}
void GUIManager::Render()
{
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}