Graphics Animations & Renaming
This commit is contained in:
parent
1e2ca13a15
commit
41f7d978a9
15 changed files with 718 additions and 318 deletions
57
Graphics/private/bindings/DebugGUI.cpp
Normal file
57
Graphics/private/bindings/DebugGUI.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#include "Window.hpp"
|
||||
|
||||
#include "WindowContext.hpp"
|
||||
|
||||
// -------- Debug UI -------- //
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
namespace tp {
|
||||
class Graphics::GUI::Context {
|
||||
public:
|
||||
ImGuiIO* io{};
|
||||
ImGuiContext* ctx{};
|
||||
};
|
||||
}
|
||||
|
||||
using namespace tp;
|
||||
|
||||
Graphics::GUI::GUI() {
|
||||
mContext = new Context();
|
||||
}
|
||||
|
||||
Graphics::GUI::~GUI() {
|
||||
delete mContext;
|
||||
}
|
||||
|
||||
void Graphics::GUI::init(Window* window) {
|
||||
IMGUI_CHECKVERSION();
|
||||
mContext->ctx = ImGui::CreateContext();
|
||||
mContext->io = &ImGui::GetIO();
|
||||
|
||||
// Initialize ImGui with GLFW and OpenGL
|
||||
ImGui_ImplGlfw_InitForOpenGL(window->getContext()->window, true);
|
||||
ImGui_ImplOpenGL3_Init("#version 330");
|
||||
}
|
||||
|
||||
void Graphics::GUI::deinit() {
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
|
||||
void Graphics::GUI::proc() {
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
// ImGui code goes here
|
||||
ImGui::Begin("Window");
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void Graphics::GUI::draw() {
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue