Side panel added
This commit is contained in:
parent
dd71eba0ec
commit
a233b6a214
9 changed files with 366 additions and 25 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
// -------- Debug UI -------- //
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
|
|
@ -28,6 +29,9 @@ void Graphics::GUI::init(Window* window) {
|
|||
|
||||
// Initialize ImGui with GLFW and OpenGL
|
||||
ImGui_ImplGlfw_InitForOpenGL(window->getContext()->window, true);
|
||||
|
||||
// ImGui_ImplGlfw_GetBackendData();
|
||||
|
||||
ImGui_ImplOpenGL3_Init("#version 330");
|
||||
}
|
||||
|
||||
|
|
@ -45,10 +49,6 @@ void Graphics::GUI::proc() {
|
|||
ImGui::NewFrame();
|
||||
|
||||
tp::HeapAllocGlobal::stopIgnore();
|
||||
|
||||
// ImGui code goes here
|
||||
ImGui::Begin("Window");
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void Graphics::GUI::draw() {
|
||||
|
|
|
|||
|
|
@ -59,26 +59,26 @@ void Graphics::GL::draw() {
|
|||
|
||||
void Graphics::init(Window* window) {
|
||||
mGl.init();
|
||||
//mGui.init(window);
|
||||
mGui.init(window);
|
||||
mCanvas.init();
|
||||
}
|
||||
|
||||
void Graphics::deinit() {
|
||||
mCanvas.deinit();
|
||||
// mGui.deinit();
|
||||
mGui.deinit();
|
||||
mGl.deinit();
|
||||
}
|
||||
|
||||
void Graphics::proc() {
|
||||
mGl.proc();
|
||||
mCanvas.proc();
|
||||
// mGui.proc();
|
||||
mGui.proc();
|
||||
}
|
||||
|
||||
void Graphics::draw() {
|
||||
mGl.draw();
|
||||
mCanvas.draw();
|
||||
// mGui.draw();
|
||||
mGui.draw();
|
||||
}
|
||||
|
||||
Window::Window(int width, int height, const char* title) {
|
||||
|
|
@ -101,10 +101,9 @@ Window::Window(int width, int height, const char* title) {
|
|||
return;
|
||||
}
|
||||
|
||||
mGraphics.init(this);
|
||||
|
||||
mContext->inputManager.init(mContext->window);
|
||||
glfwSetWindowUserPointer(mContext->window, &mContext->inputManager);
|
||||
|
||||
mGraphics.init(this);
|
||||
|
||||
mEvents.mContext = mContext;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ namespace tp {
|
|||
void init(GLFWwindow* aWindow) {
|
||||
window = aWindow;
|
||||
// Set up key and mouse button callbacks
|
||||
|
||||
glfwSetWindowUserPointer(window, this);
|
||||
glfwSetKeyCallback(window, keyCallback);
|
||||
glfwSetMouseButtonCallback(window, mouseButtonCallback);
|
||||
glfwSetScrollCallback(window, scrollCallback);
|
||||
|
|
@ -86,6 +88,7 @@ namespace tp {
|
|||
void resetScroll() {
|
||||
scrollX = 0.0;
|
||||
scrollY = 0.0;
|
||||
mouseButtonStates[GLFW_MOUSE_BUTTON_LEFT] = GLFW_REPEAT;
|
||||
}
|
||||
|
||||
double scrollX = 0.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue