diff --git a/CHANGELOG.md b/CHANGELOG.md index 81597d0d23..6b1457b9b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - SSAO resolution scale (#1423, **@tomas7770**). +- Enable ImGui docking branch and modify Tesseratos to accommodate it (#839, **@jdbaracho**). ### Changed diff --git a/default.nix b/default.nix index 98515f6102..160d7f51cf 100644 --- a/default.nix +++ b/default.nix @@ -65,7 +65,7 @@ let imgui = fetchFromGitHub { owner = "ocornut"; repo = "imgui"; - rev = "v1.89.9"; + rev = "v1.89.9-docking"; sha256 = "sha256-0k9jKrJUrG9piHNFQaBBY3zgNIKM23ZA879NY+MNYTU="; }; diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 3dae8fe178..a652deff30 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -358,7 +358,7 @@ target_link_libraries(cubos-engine PUBLIC cubos-core) FetchContent_Declare( imgui GIT_REPOSITORY https://github.com/ocornut/imgui.git - GIT_TAG v1.89.9 + GIT_TAG v1.89.9-docking ) FetchContent_Declare( implot diff --git a/tools/tesseratos/src/tesseratos/main.cpp b/tools/tesseratos/src/tesseratos/main.cpp index 2c43462cb2..2d46a31f77 100644 --- a/tools/tesseratos/src/tesseratos/main.cpp +++ b/tools/tesseratos/src/tesseratos/main.cpp @@ -55,8 +55,30 @@ int main(int argc, char** argv) input.bind(*bindings); }); - cubos.startupSystem("set ImGui context").after(imguiInitTag).call([](ImGuiContextHolder& holder) { + cubos.startupSystem("set ImGui context and enable docking").after(imguiInitTag).call([](ImGuiContextHolder& holder) { ImGui::SetCurrentContext(holder.context); + ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable; + }); + + cubos.system("setup ImGui dockspace").tagged(imguiTag).call([]() { + + // make DockSpace fullscreen + const ImGuiViewport* viewport = ImGui::GetMainViewport(); + ImGui::SetNextWindowPos(viewport->WorkPos); + ImGui::SetNextWindowSize(viewport->WorkSize); + ImGui::SetNextWindowViewport(viewport->ID); + + // ImGui window flags, check imgui.h for definition + ImGuiWindowFlags windowFlags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking; + windowFlags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove; + windowFlags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus; + + ImGui::Begin("Tesseratos", nullptr, windowFlags); + + ImGuiID dockspaceId = ImGui::GetID("TesseratosRoot"); + ImGui::DockSpace(dockspaceId, ImVec2(0.0F, 0.0F)); + + ImGui::End(); }); cubos.run();