启用docking

This commit is contained in:
Nanako 2024-02-19 01:42:13 +08:00
parent 87ad4d5eb9
commit fa2a33881a
3 changed files with 16 additions and 1 deletions

View File

@ -117,6 +117,8 @@ void application::init_imgui() {
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
ImGui::StyleColorsDark();
//ImGui::StyleColorsLight();
}

View File

@ -88,6 +88,8 @@ void renderer_opengl::new_frame(GLFWwindow* window_handle) {
}
void renderer_opengl::end_frame(GLFWwindow* window_handle) {
const ImGuiIO& io = ImGui::GetIO();
// Rendering
ImGui::Render();
int display_w, display_h;
@ -98,6 +100,17 @@ void renderer_opengl::end_frame(GLFWwindow* window_handle) {
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere.
// For this specific demo app we could also call glfwMakeContextCurrent(window) directly)
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
GLFWwindow* backup_current_context = glfwGetCurrentContext();
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
glfwMakeContextCurrent(backup_current_context);
}
glfwSwapBuffers(window_handle);
}

@ -1 +1 @@
Subproject commit 96839b445e32e46d87a44fd43a9cdd60c806f7e1
Subproject commit 8048b52498a9bf2a9f87b080d43b0bfd7a5d51d8