-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGUIManager.cpp
More file actions
46 lines (38 loc) · 824 Bytes
/
GUIManager.cpp
File metadata and controls
46 lines (38 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "GUIManager.h"
#include "imgui/imgui_impl_glfw_gl3.h"
#include <iostream>
GUIManager::GUIManager()
{
}
GUIManager::~GUIManager()
{
}
void GUIManager::Initialize(GLFWwindow * window)
{
if (window == nullptr)
{
std::cout << "No window detected" << std::endl;
return;
}
//Set up imgui binding
ImGui::CreateContext();
ImGuiIO &io = ImGui::GetIO(); (void)io;
ImGui_ImplGlfwGL3_Init(window, false);
ImGui::StyleColorsDark();
}
void GUIManager::Update()
{
for (auto it = m_gui_functions.begin(); it != m_gui_functions.end(); ++it)
{
(*it).func();
}
}
void GUIManager::Render()
{
ImGui::Render();
ImGui_ImplGlfwGL3_RenderDrawData(ImGui::GetDrawData());
}
void GUIManager::AddGUIFunction(std::function<void()> func, bool visiblility)
{
m_gui_functions.push_back(GUIFunction(func,visiblility));
}