light/Engine/src/Platform/GraphicsAPI/OpenGL/glUserInterface.cpp
2021-05-27 12:51:39 +04:30

48 lines
No EOL
927 B
C++

#include "ltpch.h"
#include "glUserInterface.h"
#include "Events/KeyboardEvents.h"
#include "Events/MouseEvents.h"
#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
namespace Light {
glUserInterface::glUserInterface(GLFWwindow* windowHandle)
{
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
ImGui::StyleColorsDark();
ImGui_ImplGlfw_InitForOpenGL(windowHandle, false);
ImGui_ImplOpenGL3_Init();
}
glUserInterface::~glUserInterface()
{
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
}
void glUserInterface::Begin()
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGui::ShowDemoWindow();
}
void glUserInterface::End()
{
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
}