Skip to content

Commit

Permalink
[UPD] : update ImGui to Docking branch
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Jul 24, 2024
1 parent 2741488 commit d366f03
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/imgui
Submodule imgui updated 70 files
+2 −1 backends/imgui_impl_allegro5.cpp
+2 −1 backends/imgui_impl_allegro5.h
+1 −0 backends/imgui_impl_android.cpp
+1 −0 backends/imgui_impl_android.h
+134 −1 backends/imgui_impl_dx10.cpp
+1 −0 backends/imgui_impl_dx10.h
+135 −1 backends/imgui_impl_dx11.cpp
+1 −0 backends/imgui_impl_dx11.h
+352 −29 backends/imgui_impl_dx12.cpp
+1 −0 backends/imgui_impl_dx12.h
+163 −1 backends/imgui_impl_dx9.cpp
+1 −0 backends/imgui_impl_dx9.h
+542 −33 backends/imgui_impl_glfw.cpp
+4 −0 backends/imgui_impl_glfw.h
+1 −1 backends/imgui_impl_glut.cpp
+1 −1 backends/imgui_impl_glut.h
+1 −0 backends/imgui_impl_metal.h
+161 −1 backends/imgui_impl_metal.mm
+41 −0 backends/imgui_impl_opengl2.cpp
+1 −0 backends/imgui_impl_opengl2.h
+41 −3 backends/imgui_impl_opengl3.cpp
+2 −1 backends/imgui_impl_opengl3.h
+4 −0 backends/imgui_impl_osx.h
+344 −12 backends/imgui_impl_osx.mm
+411 −17 backends/imgui_impl_sdl2.cpp
+5 −1 backends/imgui_impl_sdl2.h
+377 −17 backends/imgui_impl_sdl3.cpp
+5 −0 backends/imgui_impl_sdl3.h
+2 −0 backends/imgui_impl_sdlrenderer2.cpp
+2 −0 backends/imgui_impl_sdlrenderer2.h
+2 −0 backends/imgui_impl_sdlrenderer3.cpp
+2 −0 backends/imgui_impl_sdlrenderer3.h
+348 −11 backends/imgui_impl_vulkan.cpp
+4 −4 backends/imgui_impl_vulkan.h
+2 −0 backends/imgui_impl_wgpu.cpp
+2 −0 backends/imgui_impl_wgpu.h
+457 −12 backends/imgui_impl_win32.cpp
+1 −0 backends/imgui_impl_win32.h
+470 −2 docs/CHANGELOG.txt
+43 −1 docs/TODO.txt
+1 −0 examples/example_allegro5/main.cpp
+19 −6 examples/example_apple_metal/example_apple_metal.xcodeproj/project.pbxproj
+17 −0 examples/example_apple_metal/main.mm
+17 −0 examples/example_apple_opengl2/main.mm
+18 −1 examples/example_glfw_metal/main.mm
+23 −0 examples/example_glfw_opengl2/main.cpp
+23 −0 examples/example_glfw_opengl3/main.cpp
+29 −9 examples/example_glfw_vulkan/main.cpp
+1 −0 examples/example_glfw_wgpu/main.cpp
+1 −1 examples/example_glut_opengl2/main.cpp
+19 −0 examples/example_sdl2_directx11/main.cpp
+17 −0 examples/example_sdl2_metal/main.mm
+25 −0 examples/example_sdl2_opengl2/main.cpp
+25 −0 examples/example_sdl2_opengl3/main.cpp
+1 −0 examples/example_sdl2_sdlrenderer2/main.cpp
+29 −9 examples/example_sdl2_vulkan/main.cpp
+25 −0 examples/example_sdl3_opengl3/main.cpp
+1 −0 examples/example_sdl3_sdlrenderer3/main.cpp
+19 −1 examples/example_win32_directx10/main.cpp
+37 −1 examples/example_win32_directx11/main.cpp
+19 −1 examples/example_win32_directx12/main.cpp
+33 −1 examples/example_win32_directx9/main.cpp
+70 −0 examples/example_win32_opengl3/main.cpp
+6,171 −321 imgui.cpp
+275 −13 imgui.h
+306 −8 imgui_demo.cpp
+26 −0 imgui_draw.cpp
+336 −23 imgui_internal.h
+150 −26 imgui_widgets.cpp
+4 −0 misc/debuggers/imgui.natvis
4 changes: 2 additions & 2 deletions DemoDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ void DemoDialog::init(const float& vFontSize) {
#endif // USE_PLACES_FEATURE
}

void DemoDialog::display(const int32_t& vDisplayWidth, const int32_t& vDisplayHeight) {
void DemoDialog::display(const ImVec4& vDisplayRect) {
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window) ImGui::ShowDemoWindow(&show_demo_window);

Expand Down Expand Up @@ -873,7 +873,7 @@ void DemoDialog::display(const int32_t& vDisplayWidth, const int32_t& vDisplayHe
ImVec2 maxSize = ImVec2(FLT_MAX, FLT_MAX);

if (UseWindowContraints) {
maxSize = ImVec2((float)vDisplayWidth, (float)vDisplayHeight) * 0.7f;
maxSize = ImVec2(vDisplayRect.z, vDisplayRect.w) * 0.7f;
minSize = maxSize * 0.25f;
}

Expand Down
2 changes: 1 addition & 1 deletion DemoDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DemoDialog {

public:
void init(const float& vFontSize);
void display(const int32_t& vDisplayWidth, const int32_t& vDisplayHeight);
void display(const ImVec4& vDisplayRect);
void manageGPU();
void unit();
};
2 changes: 1 addition & 1 deletion ImGuiFileDialog
28 changes: 24 additions & 4 deletions mainWinLinuxMacos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ int main(int, char**) {
(void)io;
// 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
io.FontAllowUserScaling = true; // zoom wiht ctrl + mouse wheel
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
io.ConfigViewportsNoDecoration = false; // no decoration, for avoid a resuize bug
io.FontAllowUserScaling = true; // zoom wiht ctrl + mouse wheel

// Setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true);
Expand All @@ -119,6 +120,8 @@ int main(int, char**) {
DemoDialog demoDialog;
demoDialog.init(15.0f);

ImVec4 viewportRect;

// Main loop
int32_t display_w = 0;
int32_t display_h = 0;
Expand All @@ -137,8 +140,25 @@ int main(int, char**) {
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();

#ifdef IMGUI_HAS_VIEWPORT
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
const auto viewport = ImGui::GetMainViewport();
if (viewport) {
const auto pos = viewport->WorkPos;
const auto size = viewport->WorkSize;
viewportRect.x = pos.x;
viewportRect.y = pos.y;
viewportRect.z = size.x;
viewportRect.w = size.y;
}
} else {
viewportRect.x = 0;
viewportRect.y = 0;
}
#endif

try {
demoDialog.display(display_w, display_h);
demoDialog.display(viewportRect);
} catch (std::exception& ex) {
std::cout << "exception catched with message : " << ex.what() << std::endl;
assert(0);
Expand Down

0 comments on commit d366f03

Please sign in to comment.