diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c040d1..43e9ce4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ if(WIN32) FetchContent_Declare( imgui GIT_REPOSITORY https://github.com/ocornut/imgui.git - GIT_TAG v1.91.1 # Latest stable version + GIT_TAG v1.91.2-docking # Latest stable version ) FetchContent_MakeAvailable(imgui) diff --git a/src/main.cpp b/src/main.cpp index 87828b5..1e3cd6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,11 +23,22 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi int main() { // Setup window glfwSetErrorCallback(glfw_error_callback); + if (!glfwInit()) { std::cerr << "Failed to initialize GLFW" << std::endl; return -1; } + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); + glfwWindowHint(GLFW_VISIBLE, GL_TRUE); + glfwWindowHint(GLFW_MAXIMIZED, GL_TRUE); + glfwWindowHint(GLFW_DEPTH_BITS, 0); + glfwWindowHint(GLFW_STENCIL_BITS, 0); + // Create a windowed mode window and its OpenGL context GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui + GLFW + GLAD Example", nullptr, nullptr); if (!window) { @@ -50,6 +61,8 @@ int main() { ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); //(void)io; // io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf", 18); + io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; + // Setup Dear ImGui style ImGui::StyleColorsDark(); @@ -69,6 +82,8 @@ int main() { ImGui_ImplGlfw_NewFrame(); ImGui::NewFrame(); + ImGui::DockSpaceOverViewport(); + // Create a simple ImGui window { ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!"