Made multiple managers for individual pieces
Added UIManager that renders the UI inside the window
This commit is contained in:
		
							
								
								
									
										38
									
								
								BarinkEngine/graphics/GUI/GUIManager.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								BarinkEngine/graphics/GUI/GUIManager.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
#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());
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user