ThreeLab/Editor/editor.cpp

57 lines
1.4 KiB
C++
Raw Normal View History

2025-04-01 01:56:49 +00:00
#include "../Engine/Engine.h"
2025-04-01 16:02:52 +00:00
2025-04-01 01:25:39 +00:00
int main()
{
// Initialize the engine (GLFW window + OpenGL)
2025-04-01 16:02:52 +00:00
if (!Engine::Init())
2025-04-01 01:25:39 +00:00
return 1;
2025-04-01 01:56:49 +00:00
2025-04-01 16:02:52 +00:00
//// Setup Dear ImGui context
2025-04-01 01:25:39 +00:00
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable docking
// Set the style for ImGui
ImGui::StyleColorsDark();
2025-04-01 16:02:52 +00:00
// Specify the GLSL version and initialize backends
const char* glsl_version = "#version 330";
ImGui_ImplGlfw_InitForOpenGL(Engine::GetWindow(), true);
ImGui_ImplOpenGL3_Init(glsl_version);
2025-04-01 01:25:39 +00:00
// Main loop
while (!glfwWindowShouldClose(Engine::GetWindow()))
{
Engine::BeginFrame();
2025-04-01 16:02:52 +00:00
//// Start a new ImGui frame
2025-04-01 01:25:39 +00:00
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// Create a full-viewport docking space
ImGui::DockSpaceOverViewport();
// Create an editor window
ImGui::Begin("Editor Panel");
ImGui::Text("Welcome to the Editor!");
// Additional UI elements can be added here
ImGui::End();
// Render ImGui data
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
Engine::EndFrame();
}
// Cleanup ImGui and terminate GLFW
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
glfwTerminate();
return 0;
}