52 lines
951 B
C++
Executable File
52 lines
951 B
C++
Executable File
#include "gui.hpp"
|
|
|
|
#include "style/style.hpp"
|
|
|
|
namespace VE
|
|
{
|
|
gui::gui(std::unique_ptr<glfw>& g) : m_glfw { g }
|
|
{
|
|
ImGui::CreateContext();
|
|
ImGui::StyleColorsDark();
|
|
|
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
|
io.IniFilename = nullptr;
|
|
|
|
ImGuiStyle& style = ImGui::GetStyle();
|
|
if (io.ConfigFlags)
|
|
{
|
|
style.WindowRounding = 0.0f;
|
|
style.Colors[ImGuiCol_WindowBg].w = 1.0f;
|
|
}
|
|
|
|
GLFWwindow* window = m_glfw->get_win();
|
|
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
|
ImGui_ImplOpenGL3_Init("#version 410");
|
|
|
|
style::init();
|
|
}
|
|
|
|
gui::~gui()
|
|
{
|
|
ImGui_ImplOpenGL3_Shutdown();
|
|
ImGui_ImplGlfw_Shutdown();
|
|
ImGui::DestroyContext();
|
|
}
|
|
|
|
void gui::begin_frame()
|
|
{
|
|
ImGui_ImplOpenGL3_NewFrame();
|
|
ImGui_ImplGlfw_NewFrame();
|
|
ImGui::NewFrame();
|
|
}
|
|
|
|
void gui::end_frame()
|
|
{
|
|
ImGui::Render();
|
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
|
}
|
|
}
|
|
|
|
|