61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
|
#include "Engine.h"
|
||
|
#include "imgui.h"
|
||
|
#include "backends/imgui_impl_glfw.h"
|
||
|
#include "backends/imgui_impl_opengl3.h"
|
||
|
#include <stdio.h>
|
||
|
#include <GLFW/glfw3.h>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
// Initialize the engine (GLFW window + OpenGL)
|
||
|
if (!Engine::Init())
|
||
|
return 1;
|
||
|
|
||
|
// Setup Dear ImGui context
|
||
|
IMGUI_CHECKVERSION();
|
||
|
ImGui::CreateContext();
|
||
|
ImGuiIO& io = ImGui::GetIO();
|
||
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable docking
|
||
|
|
||
|
// Set the style for ImGui
|
||
|
ImGui::StyleColorsDark();
|
||
|
|
||
|
// Specify the GLSL version and initialize backends
|
||
|
const char* glsl_version = "#version 330";
|
||
|
ImGui_ImplGlfw_InitForOpenGL(Engine::GetWindow(), true);
|
||
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
||
|
|
||
|
// Main loop
|
||
|
while (!glfwWindowShouldClose(Engine::GetWindow()))
|
||
|
{
|
||
|
Engine::BeginFrame();
|
||
|
|
||
|
// Start a new ImGui frame
|
||
|
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;
|
||
|
}
|