From 00927105ba6b14f6d05a651b316428a8342fb4d3 Mon Sep 17 00:00:00 2001 From: OmarEmaraDev Date: Mon, 6 Apr 2020 20:23:57 +0200 Subject: [PATCH 01/11] Backends: Include imgui.h in implementation headers. (#3105) Currently, the implementation headers don't include the imgui.h header. Which means that the compilation will fail if the implementation header was included before the imgui.h header in the compilation unit. For instance, a compilation unit with the following will work: #include "imgui.h" #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" But a compilation unit with the following will fail because IMGUI_IMPL_API and possibly other symbols will not be defined: #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" #include "imgui.h" This patch includes imgui.h in the implementation headers to make inclusions order-invariant, which is a recommended practice. --- examples/imgui_impl_allegro5.h | 2 ++ examples/imgui_impl_dx10.h | 2 ++ examples/imgui_impl_dx11.h | 2 ++ examples/imgui_impl_dx12.h | 2 ++ examples/imgui_impl_dx9.h | 2 ++ examples/imgui_impl_glfw.h | 2 ++ examples/imgui_impl_glut.h | 2 ++ examples/imgui_impl_marmalade.h | 2 ++ examples/imgui_impl_metal.h | 2 ++ examples/imgui_impl_opengl2.h | 2 ++ examples/imgui_impl_opengl3.h | 2 ++ examples/imgui_impl_osx.h | 2 ++ examples/imgui_impl_sdl.h | 2 ++ examples/imgui_impl_vulkan.h | 1 + examples/imgui_impl_win32.h | 2 ++ 15 files changed, 29 insertions(+) diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h index 8b9a47d1..c105fea6 100644 --- a/examples/imgui_impl_allegro5.h +++ b/examples/imgui_impl_allegro5.h @@ -15,6 +15,8 @@ #pragma once +#include "imgui.h" + struct ALLEGRO_DISPLAY; union ALLEGRO_EVENT; diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h index 85281d79..341bd7df 100644 --- a/examples/imgui_impl_dx10.h +++ b/examples/imgui_impl_dx10.h @@ -11,6 +11,8 @@ #pragma once +#include "imgui.h" + struct ID3D10Device; IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h index c54d4379..d7351644 100644 --- a/examples/imgui_impl_dx11.h +++ b/examples/imgui_impl_dx11.h @@ -11,6 +11,8 @@ #pragma once +#include "imgui.h" + struct ID3D11Device; struct ID3D11DeviceContext; diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h index 8f307dc5..df95b205 100644 --- a/examples/imgui_impl_dx12.h +++ b/examples/imgui_impl_dx12.h @@ -13,6 +13,8 @@ #pragma once +#include "imgui.h" + enum DXGI_FORMAT; struct ID3D12Device; struct ID3D12DescriptorHeap; diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h index b36e95b2..f630eeaa 100644 --- a/examples/imgui_impl_dx9.h +++ b/examples/imgui_impl_dx9.h @@ -11,6 +11,8 @@ #pragma once +#include "imgui.h" + struct IDirect3DDevice9; IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h index a86790b7..f7f6f8c2 100644 --- a/examples/imgui_impl_glfw.h +++ b/examples/imgui_impl_glfw.h @@ -18,6 +18,8 @@ #pragma once +#include "imgui.h" + struct GLFWwindow; IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); diff --git a/examples/imgui_impl_glut.h b/examples/imgui_impl_glut.h index 0c561207..68326dce 100644 --- a/examples/imgui_impl_glut.h +++ b/examples/imgui_impl_glut.h @@ -17,6 +17,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_ImplGLUT_Init(); IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs(); IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown(); diff --git a/examples/imgui_impl_marmalade.h b/examples/imgui_impl_marmalade.h index 01fbd0d2..6ff1cc23 100644 --- a/examples/imgui_impl_marmalade.h +++ b/examples/imgui_impl_marmalade.h @@ -10,6 +10,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks); IMGUI_IMPL_API void ImGui_Marmalade_Shutdown(); IMGUI_IMPL_API void ImGui_Marmalade_NewFrame(); diff --git a/examples/imgui_impl_metal.h b/examples/imgui_impl_metal.h index f09a115d..bf43ef66 100644 --- a/examples/imgui_impl_metal.h +++ b/examples/imgui_impl_metal.h @@ -9,6 +9,8 @@ // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui +#include "imgui.h" + @class MTLRenderPassDescriptor; @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; diff --git a/examples/imgui_impl_opengl2.h b/examples/imgui_impl_opengl2.h index 009052d7..4e0185fc 100644 --- a/examples/imgui_impl_opengl2.h +++ b/examples/imgui_impl_opengl2.h @@ -18,6 +18,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame(); diff --git a/examples/imgui_impl_opengl3.h b/examples/imgui_impl_opengl3.h index a9a1e199..9a651dc4 100644 --- a/examples/imgui_impl_opengl3.h +++ b/examples/imgui_impl_opengl3.h @@ -23,6 +23,8 @@ #pragma once +#include "imgui.h" + // Backend API IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); diff --git a/examples/imgui_impl_osx.h b/examples/imgui_impl_osx.h index fe066eec..52b44a6d 100644 --- a/examples/imgui_impl_osx.h +++ b/examples/imgui_impl_osx.h @@ -8,6 +8,8 @@ // Issues: // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. +#include "imgui.h" + @class NSEvent; @class NSView; diff --git a/examples/imgui_impl_sdl.h b/examples/imgui_impl_sdl.h index a672ca83..ae2261d5 100644 --- a/examples/imgui_impl_sdl.h +++ b/examples/imgui_impl_sdl.h @@ -16,6 +16,8 @@ #pragma once +#include "imgui.h" + struct SDL_Window; typedef union SDL_Event SDL_Event; diff --git a/examples/imgui_impl_vulkan.h b/examples/imgui_impl_vulkan.h index a74cdb5a..ce02b4c2 100644 --- a/examples/imgui_impl_vulkan.h +++ b/examples/imgui_impl_vulkan.h @@ -22,6 +22,7 @@ #pragma once +#include "imgui.h" #include // Initialization data, for ImGui_ImplVulkan_Init() diff --git a/examples/imgui_impl_win32.h b/examples/imgui_impl_win32.h index 41bae701..328a3724 100644 --- a/examples/imgui_impl_win32.h +++ b/examples/imgui_impl_win32.h @@ -9,6 +9,8 @@ #pragma once +#include "imgui.h" + IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); From cc0e43e6314e977d10d034f030de478194a0dd70 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 7 Apr 2020 11:02:29 +0200 Subject: [PATCH 02/11] Backends: Comments next to include, misc minor comments/tweaks, fix imgui_impl_osx.h using IMGUI_API instead of IMGUI_IMPL_API. (#3105) --- examples/imgui_impl_allegro5.h | 5 ++--- examples/imgui_impl_dx10.h | 5 ++--- examples/imgui_impl_dx11.h | 5 ++--- examples/imgui_impl_dx12.h | 5 ++--- examples/imgui_impl_dx9.h | 5 ++--- examples/imgui_impl_glfw.h | 3 +-- examples/imgui_impl_glut.h | 3 +-- examples/imgui_impl_marmalade.h | 5 ++--- examples/imgui_impl_metal.h | 2 +- examples/imgui_impl_opengl2.h | 3 +-- examples/imgui_impl_opengl3.h | 3 +-- examples/imgui_impl_osx.h | 10 +++++----- examples/imgui_impl_sdl.h | 3 +-- examples/imgui_impl_vulkan.h | 3 +-- examples/imgui_impl_win32.h | 6 +++--- 15 files changed, 27 insertions(+), 39 deletions(-) diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h index c105fea6..f41e4c90 100644 --- a/examples/imgui_impl_allegro5.h +++ b/examples/imgui_impl_allegro5.h @@ -14,8 +14,7 @@ // https://github.com/ocornut/imgui, Original Allegro 5 code by @birthggd #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API struct ALLEGRO_DISPLAY; union ALLEGRO_EVENT; @@ -26,6 +25,6 @@ IMGUI_IMPL_API void ImGui_ImplAllegro5_NewFrame(); IMGUI_IMPL_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data); IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event); -// Use if you want to reset your rendering device without losing ImGui state. +// Use if you want to reset your rendering device without losing Dear ImGui state. IMGUI_IMPL_API bool ImGui_ImplAllegro5_CreateDeviceObjects(); IMGUI_IMPL_API void ImGui_ImplAllegro5_InvalidateDeviceObjects(); diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h index 341bd7df..d974ba8e 100644 --- a/examples/imgui_impl_dx10.h +++ b/examples/imgui_impl_dx10.h @@ -10,8 +10,7 @@ // https://github.com/ocornut/imgui #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API struct ID3D10Device; @@ -20,6 +19,6 @@ IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown(); IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data); -// Use if you want to reset your rendering device without losing ImGui state. +// Use if you want to reset your rendering device without losing Dear ImGui state. IMGUI_IMPL_API void ImGui_ImplDX10_InvalidateDeviceObjects(); IMGUI_IMPL_API bool ImGui_ImplDX10_CreateDeviceObjects(); diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h index d7351644..cccadcd2 100644 --- a/examples/imgui_impl_dx11.h +++ b/examples/imgui_impl_dx11.h @@ -10,8 +10,7 @@ // https://github.com/ocornut/imgui #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API struct ID3D11Device; struct ID3D11DeviceContext; @@ -21,6 +20,6 @@ IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); -// Use if you want to reset your rendering device without losing ImGui state. +// Use if you want to reset your rendering device without losing Dear ImGui state. IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h index df95b205..52dab0ba 100644 --- a/examples/imgui_impl_dx12.h +++ b/examples/imgui_impl_dx12.h @@ -12,8 +12,7 @@ // https://github.com/ocornut/imgui #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API enum DXGI_FORMAT; struct ID3D12Device; @@ -32,6 +31,6 @@ IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown(); IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list); -// Use if you want to reset your rendering device without losing ImGui state. +// Use if you want to reset your rendering device without losing Dear ImGui state. IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects(); IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects(); diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h index f630eeaa..b93c89f7 100644 --- a/examples/imgui_impl_dx9.h +++ b/examples/imgui_impl_dx9.h @@ -10,8 +10,7 @@ // https://github.com/ocornut/imgui #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API struct IDirect3DDevice9; @@ -20,6 +19,6 @@ IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); -// Use if you want to reset your rendering device without losing ImGui state. +// Use if you want to reset your rendering device without losing Dear ImGui state. IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h index f7f6f8c2..f62f44f3 100644 --- a/examples/imgui_impl_glfw.h +++ b/examples/imgui_impl_glfw.h @@ -17,8 +17,7 @@ // Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure! #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API struct GLFWwindow; diff --git a/examples/imgui_impl_glut.h b/examples/imgui_impl_glut.h index 68326dce..9acb77fb 100644 --- a/examples/imgui_impl_glut.h +++ b/examples/imgui_impl_glut.h @@ -16,8 +16,7 @@ // https://github.com/ocornut/imgui #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API IMGUI_IMPL_API bool ImGui_ImplGLUT_Init(); IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs(); diff --git a/examples/imgui_impl_marmalade.h b/examples/imgui_impl_marmalade.h index 6ff1cc23..9e92d899 100644 --- a/examples/imgui_impl_marmalade.h +++ b/examples/imgui_impl_marmalade.h @@ -9,15 +9,14 @@ // https://github.com/ocornut/imgui #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks); IMGUI_IMPL_API void ImGui_Marmalade_Shutdown(); IMGUI_IMPL_API void ImGui_Marmalade_NewFrame(); IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data); -// Use if you want to reset your rendering device without losing ImGui state. +// Use if you want to reset your rendering device without losing Dear ImGui state. IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects(); IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects(); diff --git a/examples/imgui_impl_metal.h b/examples/imgui_impl_metal.h index bf43ef66..f6e8fd2b 100644 --- a/examples/imgui_impl_metal.h +++ b/examples/imgui_impl_metal.h @@ -9,7 +9,7 @@ // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API @class MTLRenderPassDescriptor; @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; diff --git a/examples/imgui_impl_opengl2.h b/examples/imgui_impl_opengl2.h index 4e0185fc..9b72cbba 100644 --- a/examples/imgui_impl_opengl2.h +++ b/examples/imgui_impl_opengl2.h @@ -17,8 +17,7 @@ // The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API. #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); diff --git a/examples/imgui_impl_opengl3.h b/examples/imgui_impl_opengl3.h index 9a651dc4..d55935a1 100644 --- a/examples/imgui_impl_opengl3.h +++ b/examples/imgui_impl_opengl3.h @@ -22,8 +22,7 @@ // Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp. #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API // Backend API IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); diff --git a/examples/imgui_impl_osx.h b/examples/imgui_impl_osx.h index 52b44a6d..dae5c0ce 100644 --- a/examples/imgui_impl_osx.h +++ b/examples/imgui_impl_osx.h @@ -8,12 +8,12 @@ // Issues: // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API @class NSEvent; @class NSView; -IMGUI_API bool ImGui_ImplOSX_Init(); -IMGUI_API void ImGui_ImplOSX_Shutdown(); -IMGUI_API void ImGui_ImplOSX_NewFrame(NSView *_Nullable view); -IMGUI_API bool ImGui_ImplOSX_HandleEvent(NSEvent *_Nonnull event, NSView *_Nullable view); +IMGUI_IMPL_API bool ImGui_ImplOSX_Init(); +IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown(); +IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView *_Nullable view); +IMGUI_IMPL_API bool ImGui_ImplOSX_HandleEvent(NSEvent *_Nonnull event, NSView *_Nullable view); diff --git a/examples/imgui_impl_sdl.h b/examples/imgui_impl_sdl.h index ae2261d5..bf207ba0 100644 --- a/examples/imgui_impl_sdl.h +++ b/examples/imgui_impl_sdl.h @@ -15,8 +15,7 @@ // https://github.com/ocornut/imgui #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API struct SDL_Window; typedef union SDL_Event SDL_Event; diff --git a/examples/imgui_impl_vulkan.h b/examples/imgui_impl_vulkan.h index ce02b4c2..c85b5f28 100644 --- a/examples/imgui_impl_vulkan.h +++ b/examples/imgui_impl_vulkan.h @@ -21,8 +21,7 @@ // Read comments in imgui_impl_vulkan.h. #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API #include // Initialization data, for ImGui_ImplVulkan_Init() diff --git a/examples/imgui_impl_win32.h b/examples/imgui_impl_win32.h index 328a3724..8923bd63 100644 --- a/examples/imgui_impl_win32.h +++ b/examples/imgui_impl_win32.h @@ -8,14 +8,14 @@ // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. #pragma once - -#include "imgui.h" +#include "imgui.h" // IMGUI_IMPL_API IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); -// Configuration: Disable gamepad support or linking with xinput.lib +// Configuration +// - Disable gamepad support or linking with xinput.lib //#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD //#define IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT From e9366b4c7375dd2cd88e2375d50fe218a20c7e87 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 7 Apr 2020 11:40:29 +0200 Subject: [PATCH 03/11] Regretfully moved .gitignore file from examples/ into root directory because OSX keeps pooping its DS_Store/ artifacts everywhere. (#3088) --- .gitignore | 49 +++++++++++++++++++++++++++++++++++++++++++++ examples/.gitignore | 46 ------------------------------------------ 2 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 .gitignore delete mode 100644 examples/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..84014850 --- /dev/null +++ b/.gitignore @@ -0,0 +1,49 @@ +## OSX artifacts +.DS_Store + +## Dear ImGui artifacts +imgui.ini + +## General build artifacts +*.o +*.obj +*.exe +examples/build/* +examples/*/Debug/* +examples/*/Release/* +examples/*/x64/* + +## Visual Studio artifacts +.vs +ipch +*.opensdf +*.log +*.pdb +*.ilk +*.user +*.sdf +*.suo +*.VC.db +*.VC.VC.opendb + +## Xcode artifacts +project.xcworkspace +xcuserdata + +## Emscripten artifacts +examples/*.o.tmp +examples/*.out.js +examples/*.out.wasm +examples/example_emscripten/example_emscripten.* + +## JetBrains IDE artifacts +.idea +cmake-build-* + +## Unix executables from our example Makefiles +examples/example_glfw_opengl2/example_glfw_opengl2 +examples/example_glfw_opengl3/example_glfw_opengl3 +examples/example_glut_opengl2/example_glut_opengl2 +examples/example_null/example_null +examples/example_sdl_opengl2/example_sdl_opengl2 +examples/example_sdl_opengl3/example_sdl_opengl3 diff --git a/examples/.gitignore b/examples/.gitignore deleted file mode 100644 index 2b5671a8..00000000 --- a/examples/.gitignore +++ /dev/null @@ -1,46 +0,0 @@ -build/* -*/Debug/* -*/Release/* -*/x64/* -*.o -*.obj -*.exe - -## Visual Studio cruft -.vs/* -*/ipch/* -*.opensdf -*.log -*.pdb -*.ilk -*.user -*.sdf -*.suo -*.VC.db -*.VC.VC.opendb - -## Xcode cruft -.DS_Store -project.xcworkspace -xcuserdata - -## Emscripten output -*.o.tmp -*.out.js -*.out.wasm -example_emscripten/example_emscripten.* - -## Unix executables -example_glfw_opengl2/example_glfw_opengl2 -example_glfw_opengl3/example_glfw_opengl3 -example_glut_opengl2/example_glut_opengl2 -example_null/example_null -example_sdl_opengl2/example_sdl_opengl2 -example_sdl_opengl3/example_sdl_opengl3 - -## Dear ImGui Ini files -imgui.ini - -## JetBrains IDEs -.idea -cmake-build-* From 4e7ceb5f903cf2de3adac1c10010a82460e193d0 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 7 Apr 2020 12:11:06 +0200 Subject: [PATCH 04/11] Plot: Internals: Added hovered index to PlotEx() function. (#2670) --- imgui_internal.h | 2 +- imgui_widgets.cpp | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index 06832ee7..2172c138 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1887,7 +1887,7 @@ namespace ImGui IMGUI_API void ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags); // Plot - IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size); + IMGUI_API int PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size); // Shade functions (write over already created vertices) IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index a28fbdaa..4487f496 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -5835,13 +5835,13 @@ bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(v // - PlotHistogram() //------------------------------------------------------------------------- -void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size) +int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size) { + ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); if (window->SkipItems) - return; + return -1; - ImGuiContext& g = *GImGui; const ImGuiStyle& style = g.Style; const ImGuiID id = window->GetID(label); @@ -5856,7 +5856,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0)); ItemSize(total_bb, style.FramePadding.y); if (!ItemAdd(total_bb, 0, &frame_bb)) - return; + return -1; const bool hovered = ItemHoverable(frame_bb, id); // Determine scale from values if not specified @@ -5881,13 +5881,13 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); const int values_count_min = (plot_type == ImGuiPlotType_Lines) ? 2 : 1; + int idx_hovered = -1; if (values_count >= values_count_min) { int res_w = ImMin((int)frame_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); // Tooltip on hover - int v_hovered = -1; if (hovered && inner_bb.Contains(g.IO.MousePos)) { const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f); @@ -5900,7 +5900,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1); else if (plot_type == ImGuiPlotType_Histogram) SetTooltip("%d: %8.4g", v_idx, v0); - v_hovered = v_idx; + idx_hovered = v_idx; } const float t_step = 1.0f / (float)res_w; @@ -5927,13 +5927,13 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t)); if (plot_type == ImGuiPlotType_Lines) { - window->DrawList->AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); + window->DrawList->AddLine(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base); } else if (plot_type == ImGuiPlotType_Histogram) { if (pos1.x >= pos0.x + 2.0f) pos1.x -= 1.0f; - window->DrawList->AddRectFilled(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); + window->DrawList->AddRectFilled(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base); } t0 = t1; @@ -5947,6 +5947,10 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); + + // Return hovered index or -1 if none are hovered. + // This is currently not exposed in the public API because we need a larger redesign of the whole thing, but in the short-term we are making it available in PlotEx(). + return idx_hovered; } struct ImGuiPlotArrayGetterData From 832fda848863f24b4bdf2b4323447e996a8c51f1 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 7 Apr 2020 14:46:46 +0200 Subject: [PATCH 05/11] Fixed stray end of line blanks, added comments in .editorconfig, tweaked some headers. --- .editorconfig | 4 +++- imgui.cpp | 2 +- imgui.h | 2 +- imgui_widgets.cpp | 6 +++--- misc/cpp/imgui_stdlib.cpp | 3 +-- misc/cpp/imgui_stdlib.h | 3 +-- misc/freetype/imgui_freetype.cpp | 2 +- misc/freetype/imgui_freetype.h | 2 +- misc/single_file/imgui_single_file.h | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3dd05d3d..284ba13f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,6 @@ -# editorconfig.org +# See http://editorconfig.org to read about the EditorConfig format. +# - Automatically supported by VS2017+ and most common IDE or text editors. +# - For older VS2010 to VS2015, install https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig # top-most EditorConfig file root = true diff --git a/imgui.cpp b/imgui.cpp index 9876cf92..42a7228e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4152,7 +4152,7 @@ void ImGui::EndFrame() { ImGuiContext& g = *GImGui; IM_ASSERT(g.Initialized); - + // Don't process EndFrame() multiple times. if (g.FrameCountEnded == g.FrameCount) return; diff --git a/imgui.h b/imgui.h index 53b2ccab..2d902022 100644 --- a/imgui.h +++ b/imgui.h @@ -1141,7 +1141,7 @@ enum ImGuiCol_ }; // Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure. -// - The enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code. +// - The enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code. // During initialization or between frames, feel free to just poke into ImGuiStyle directly. // - Tip: Use your programming IDE navigation facilities on the names in the _second column_ below to find the actual members and their description. // In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 4487f496..a0bfdd6c 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -5344,8 +5344,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l // - Double-click on label = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1) // - Double-click on arrow = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1 and _OpenOnArrow=0) // This makes _OpenOnArrow have a subtle effect on _OpenOnDoubleClick: arrow click reacts on Down rather than Up. - // It is rather standard that arrow click react on Down rather than Up and we'd be tempted to make it the default - // (by removing the _OpenOnArrow test below), however this would have a perhaps surprising effect on CollapsingHeader()? + // It is rather standard that arrow click react on Down rather than Up and we'd be tempted to make it the default + // (by removing the _OpenOnArrow test below), however this would have a perhaps surprising effect on CollapsingHeader()? // So right now we are making this optional. May evolve later. if (is_mouse_x_over_arrow && (flags & ImGuiTreeNodeFlags_OpenOnArrow)) button_flags |= ImGuiButtonFlags_PressedOnClick; @@ -5948,7 +5948,7 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); - // Return hovered index or -1 if none are hovered. + // Return hovered index or -1 if none are hovered. // This is currently not exposed in the public API because we need a larger redesign of the whole thing, but in the short-term we are making it available in PlotEx(). return idx_hovered; } diff --git a/misc/cpp/imgui_stdlib.cpp b/misc/cpp/imgui_stdlib.cpp index fda60f4d..cb1fe174 100644 --- a/misc/cpp/imgui_stdlib.cpp +++ b/misc/cpp/imgui_stdlib.cpp @@ -1,5 +1,4 @@ -// imgui_stdlib.cpp -// Wrappers for C++ standard library (STL) types (std::string, etc.) +// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) // This is also an example of how you may wrap your own similar types. // Compatibility: diff --git a/misc/cpp/imgui_stdlib.h b/misc/cpp/imgui_stdlib.h index 5bccb032..f860b0c7 100644 --- a/misc/cpp/imgui_stdlib.h +++ b/misc/cpp/imgui_stdlib.h @@ -1,5 +1,4 @@ -// imgui_stdlib.h -// Wrappers for C++ standard library (STL) types (std::string, etc.) +// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) // This is also an example of how you may wrap your own similar types. // Compatibility: diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index b4ef795a..69108e3e 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -1,4 +1,4 @@ -// Wrapper to use FreeType (instead of stb_truetype) for Dear ImGui +// dear imgui: wrapper to use FreeType (instead of stb_truetype) // Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype // Original code by @vuhdo (Aleksei Skriabin). Improvements by @mikesart. Maintained and v0.60+ by @ocornut. diff --git a/misc/freetype/imgui_freetype.h b/misc/freetype/imgui_freetype.h index d65c7724..619735c4 100644 --- a/misc/freetype/imgui_freetype.h +++ b/misc/freetype/imgui_freetype.h @@ -1,4 +1,4 @@ -// Wrapper to use FreeType (instead of stb_truetype) for Dear ImGui +// dear imgui: wrapper to use FreeType (instead of stb_truetype) // Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype // Original code by @Vuhdo (Aleksei Skriabin), maintained by @ocornut diff --git a/misc/single_file/imgui_single_file.h b/misc/single_file/imgui_single_file.h index a556931c..6c849441 100644 --- a/misc/single_file/imgui_single_file.h +++ b/misc/single_file/imgui_single_file.h @@ -1,4 +1,4 @@ -// imgui_single_file.h +// dear imgui: single-file wrapper include // We use this to validate compiling all *.cpp files in a same compilation unit. // Users of that technique (also called "Unity builds") can generally provide this themselves, // so we don't really recommend you use this in your projects. From fb70d90fef176b24075bbaeb406612ab5f39fec6 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 9 Apr 2020 13:34:39 +0200 Subject: [PATCH 06/11] Made default clipboard handlers for Win32 and OSX use a buffer inside the main context instead of a static buffer, so it can be freed properly on Shutdown. (#3110) --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 34 ++++++++++++++++++---------------- imgui_internal.h | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 6bdb7512..f274ba31 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -73,6 +73,8 @@ Other Changes: to a solution rather than encourage people to add braces in the codebase. - Misc: Added additional checks in EndFrame() to verify that io.KeyXXX values have not been tampered with between NewFrame() and EndFrame(). +- Misc: Made default clipboard handlers for Win32 and OSX use a buffer inside the main context + instead of a static buffer, so it can be freed properly on Shutdown. (#3110) - Misc, Freetype: Fixed support for IMGUI_STB_RECT_PACK_FILENAME compile time directive in imgui_freetype.cpp (matching support in the regular code path). (#3062) [@DonKult] - Metrics: Made Tools section more prominent. Showing wire-frame mesh directly hovering the ImDrawCmd diff --git a/imgui.cpp b/imgui.cpp index 42a7228e..2aaddb67 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3985,7 +3985,7 @@ void ImGui::Shutdown(ImGuiContext* context) g.CurrentTabBarStack.clear(); g.ShrinkWidthBuffer.clear(); - g.PrivateClipboard.clear(); + g.ClipboardHandlerData.clear(); g.MenusIdSubmittedThisFrame.clear(); g.InputTextState.ClearFreeMemory(); @@ -9805,10 +9805,11 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl #endif // Win32 clipboard implementation +// We use g.ClipboardHandlerData for temporary storage to ensure it is freed on Shutdown() static const char* GetClipboardTextFn_DefaultImpl(void*) { - static ImVector buf_local; - buf_local.clear(); + ImGuiContext& g = *GImGui; + g.ClipboardHandlerData.clear(); if (!::OpenClipboard(NULL)) return NULL; HANDLE wbuf_handle = ::GetClipboardData(CF_UNICODETEXT); @@ -9820,12 +9821,12 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) if (const WCHAR* wbuf_global = (const WCHAR*)::GlobalLock(wbuf_handle)) { int buf_len = ::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, NULL, 0, NULL, NULL); - buf_local.resize(buf_len); - ::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, buf_local.Data, buf_len, NULL, NULL); + g.ClipboardHandlerData.resize(buf_len); + ::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, g.ClipboardHandlerData.Data, buf_len, NULL, NULL); } ::GlobalUnlock(wbuf_handle); ::CloseClipboard(); - return buf_local.Data; + return g.ClipboardHandlerData.Data; } static void SetClipboardTextFn_DefaultImpl(void*, const char* text) @@ -9887,13 +9888,14 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) CFDataRef cf_data; if (PasteboardCopyItemFlavorData(main_clipboard, item_id, CFSTR("public.utf8-plain-text"), &cf_data) == noErr) { - static ImVector clipboard_text; + ImGuiContext& g = *GImGui; + g.ClipboardHandlerData.clear(); int length = (int)CFDataGetLength(cf_data); - clipboard_text.resize(length + 1); - CFDataGetBytes(cf_data, CFRangeMake(0, length), (UInt8*)clipboard_text.Data); - clipboard_text[length] = 0; + g.ClipboardHandlerData.resize(length + 1); + CFDataGetBytes(cf_data, CFRangeMake(0, length), (UInt8*)g.ClipboardHandlerData.Data); + g.ClipboardHandlerData[length] = 0; CFRelease(cf_data); - return clipboard_text.Data; + return g.ClipboardHandlerData.Data; } } } @@ -9906,17 +9908,17 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) static const char* GetClipboardTextFn_DefaultImpl(void*) { ImGuiContext& g = *GImGui; - return g.PrivateClipboard.empty() ? NULL : g.PrivateClipboard.begin(); + return g.ClipboardHandlerData.empty() ? NULL : g.ClipboardHandlerData.begin(); } static void SetClipboardTextFn_DefaultImpl(void*, const char* text) { ImGuiContext& g = *GImGui; - g.PrivateClipboard.clear(); + g.ClipboardHandlerData.clear(); const char* text_end = text + strlen(text); - g.PrivateClipboard.resize((int)(text_end - text) + 1); - memcpy(&g.PrivateClipboard[0], text, (size_t)(text_end - text)); - g.PrivateClipboard[(int)(text_end - text)] = 0; + g.ClipboardHandlerData.resize((int)(text_end - text) + 1); + memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text)); + g.ClipboardHandlerData[(int)(text_end - text)] = 0; } #endif diff --git a/imgui_internal.h b/imgui_internal.h index 2172c138..7e744b3f 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1189,7 +1189,7 @@ struct ImGuiContext float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage? int TooltipOverrideCount; - ImVector PrivateClipboard; // If no custom clipboard handler is defined + ImVector ClipboardHandlerData; // If no custom clipboard handler is defined ImVector MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once // Platform support From f7852fa8e8175405f66cb4bce0cd0a85e4cebff8 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 10 Apr 2020 11:03:22 +0200 Subject: [PATCH 07/11] Internals: Extracted GetWindowScrollbarRect() out of Scrollbar() and tidying up code to make it more obvious how to draw over scrollbars. (#3114) --- imgui_internal.h | 3 +- imgui_widgets.cpp | 97 +++++++++++++++++++++++++++-------------------- 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index 7e744b3f..61c1e5b7 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1477,7 +1477,7 @@ struct IMGUI_API ImGuiWindow ImVec2 ScrollMax; ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change) ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered - ImVec2 ScrollbarSizes; // Size taken by scrollbars on each axis + ImVec2 ScrollbarSizes; // Size taken by each scrollbars on their smaller axis. Pay attention! ScrollbarSizes.x == width of the vertical scrollbar, ScrollbarSizes.y = height of the horizontal scrollbar. bool ScrollbarX, ScrollbarY; // Are scrollbars visible? bool Active; // Set to true on Begin(), unless Collapsed bool WasActive; @@ -1847,6 +1847,7 @@ namespace ImGui IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0); IMGUI_API void Scrollbar(ImGuiAxis axis); IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float avail_v, float contents_v, ImDrawCornerFlags rounding_corners); + IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis); IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis); IMGUI_API ImGuiID GetWindowResizeID(ImGuiWindow* window, int n); // 0..3: corners, 4..7: borders IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index a0bfdd6c..33a98635 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -391,8 +391,10 @@ void ImGui::BulletTextV(const char* fmt, va_list args) // - ArrowButton() // - CloseButton() [Internal] // - CollapseButton() [Internal] -// - ScrollbarEx() [Internal] +// - GetWindowScrollbarID() [Internal] +// - GetWindowScrollbarRect() [Internal] // - Scrollbar() [Internal] +// - ScrollbarEx() [Internal] // - Image() // - ImageButton() // - Checkbox() @@ -812,6 +814,49 @@ ImGuiID ImGui::GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis) return window->GetIDNoKeepAlive(axis == ImGuiAxis_X ? "#SCROLLX" : "#SCROLLY"); } +// Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set. +ImRect ImGui::GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis) +{ + const ImRect outer_rect = window->Rect(); + const ImRect inner_rect = window->InnerRect; + const float border_size = window->WindowBorderSize; + const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; // (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar) + IM_ASSERT(scrollbar_size > 0.0f); + if (axis == ImGuiAxis_X) + return ImRect(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x, outer_rect.Max.y); + else + return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y, outer_rect.Max.x, inner_rect.Max.y); +} + +void ImGui::Scrollbar(ImGuiAxis axis) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + const ImGuiID id = GetWindowScrollbarID(window, axis); + KeepAliveID(id); + + // Calculate scrollbar bounding box + ImRect bb = GetWindowScrollbarRect(window, axis); + ImDrawCornerFlags rounding_corners = 0; + if (axis == ImGuiAxis_X) + { + rounding_corners |= ImDrawCornerFlags_BotLeft; + if (!window->ScrollbarY) + rounding_corners |= ImDrawCornerFlags_BotRight; + } + else + { + if ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) + rounding_corners |= ImDrawCornerFlags_TopRight; + if (!window->ScrollbarX) + rounding_corners |= ImDrawCornerFlags_BotRight; + } + float size_avail = window->InnerRect.Max[axis] - window->InnerRect.Min[axis]; + float size_contents = window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f; + ScrollbarEx(bb, id, axis, &window->Scroll[axis], size_avail, size_contents, rounding_corners); +} + // Vertical/Horizontal scrollbar // The entire piece of code below is rather confusing because: // - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab) @@ -830,7 +875,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa if (bb_frame_width <= 0.0f || bb_frame_height <= 0.0f) return false; - // When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the resize grab) + // When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the window resize grab) float alpha = 1.0f; if ((axis == ImGuiAxis_Y) && bb_frame_height < g.FontSize + g.Style.FramePadding.y * 2.0f) alpha = ImSaturate((bb_frame_height - g.FontSize) / (g.Style.FramePadding.y * 2.0f)); @@ -839,13 +884,12 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa const ImGuiStyle& style = g.Style; const bool allow_interaction = (alpha >= 1.0f); - const bool horizontal = (axis == ImGuiAxis_X); ImRect bb = bb_frame; bb.Expand(ImVec2(-ImClamp(IM_FLOOR((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_FLOOR((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f))); // V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar) - const float scrollbar_size_v = horizontal ? bb.GetWidth() : bb.GetHeight(); + const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight(); // Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount) // But we maintain a minimum size in pixel to allow for the user to still aim inside. @@ -861,11 +905,11 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa float scroll_max = ImMax(1.0f, size_contents_v - size_avail_v); float scroll_ratio = ImSaturate(*p_scroll_v / scroll_max); - float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; + float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; // Grab position in normalized space if (held && allow_interaction && grab_h_norm < 1.0f) { - float scrollbar_pos_v = horizontal ? bb.Min.x : bb.Min.y; - float mouse_pos_v = horizontal ? g.IO.MousePos.x : g.IO.MousePos.y; + float scrollbar_pos_v = bb.Min[axis]; + float mouse_pos_v = g.IO.MousePos[axis]; // Click position in scrollbar normalized space (0.0f->1.0f) const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v); @@ -882,7 +926,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f; } - // Apply scroll + // Apply scroll (p_scroll_v will generally point on one member of window->Scroll) // It is ok to modify Scroll here because we are being called in Begin() after the calculation of ContentSize and before setting up our starting position const float scroll_v_norm = ImSaturate((clicked_v_norm - g.ScrollbarClickDeltaToGrabCenter - grab_h_norm * 0.5f) / (1.0f - grab_h_norm)); *p_scroll_v = IM_ROUND(scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v)); @@ -897,10 +941,11 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa } // Render - window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, rounding_corners); + const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg); const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha); + window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, rounding_corners); ImRect grab_rect; - if (horizontal) + if (axis == ImGuiAxis_X) grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y); else grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels); @@ -909,38 +954,6 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa return held; } -void ImGui::Scrollbar(ImGuiAxis axis) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - const ImGuiID id = GetWindowScrollbarID(window, axis); - KeepAliveID(id); - - // Calculate scrollbar bounding box - const ImRect outer_rect = window->Rect(); - const ImRect inner_rect = window->InnerRect; - const float border_size = window->WindowBorderSize; - const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; - IM_ASSERT(scrollbar_size > 0.0f); - const float other_scrollbar_size = window->ScrollbarSizes[axis]; - ImDrawCornerFlags rounding_corners = (other_scrollbar_size <= 0.0f) ? ImDrawCornerFlags_BotRight : 0; - ImRect bb; - if (axis == ImGuiAxis_X) - { - bb.Min = ImVec2(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size)); - bb.Max = ImVec2(inner_rect.Max.x, outer_rect.Max.y); - rounding_corners |= ImDrawCornerFlags_BotLeft; - } - else - { - bb.Min = ImVec2(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y); - bb.Max = ImVec2(outer_rect.Max.x, window->InnerRect.Max.y); - rounding_corners |= ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0; - } - ScrollbarEx(bb, id, axis, &window->Scroll[axis], inner_rect.Max[axis] - inner_rect.Min[axis], window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f, rounding_corners); -} - void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col) { ImGuiWindow* window = GetCurrentWindow(); From 977ac53dd809ed41d4a9456d03d7ded0d0ee9bd4 Mon Sep 17 00:00:00 2001 From: SergeyN Date: Mon, 30 Mar 2020 21:43:21 +0200 Subject: [PATCH 08/11] Examples: Win32+DX12: Fixed resizing main window, enabled debug layer. (#3087, #3115) --- docs/CHANGELOG.txt | 1 + examples/example_win32_directx12/main.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f274ba31..43c70d33 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -94,6 +94,7 @@ Other Changes: - Backends: SDL: Added ImGui_ImplSDL2_InitForMetal() for API consistency (even though the function currently does nothing). - Backends: SDL: Fixed mapping for ImGuiKey_KeyPadEnter. (#3031) [@Davido71] +- Examples: Win32+DX12: Fixed resizing main window, enabled debug layer. (#3087, #3115) [@sergeyn] - Examples: SDL+DX11: Fixed resizing main window. (#3057) [@joeslay] - Examples: Added SDL+Metal example application. (#3017) [@coding-jackalope] diff --git a/examples/example_win32_directx12/main.cpp b/examples/example_win32_directx12/main.cpp index 139dea6e..8642ad45 100644 --- a/examples/example_win32_directx12/main.cpp +++ b/examples/example_win32_directx12/main.cpp @@ -9,7 +9,9 @@ #include #include -//#define DX12_ENABLE_DEBUG_LAYER +#ifdef _DEBUG +#define DX12_ENABLE_DEBUG_LAYER +#endif #ifdef DX12_ENABLE_DEBUG_LAYER #include @@ -441,6 +443,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SIZE: if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED) { + WaitForLastSubmittedFrame(); ImGui_ImplDX12_InvalidateDeviceObjects(); CleanupRenderTarget(); ResizeSwapChain(hWnd, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); From ec7294d890d7477047eccfdd5463df6cd72cb6dd Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 12 Apr 2020 18:01:10 +0200 Subject: [PATCH 09/11] Backends: OpenGL3: Fixed version check mistakenly testing for GL 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset, leaving 3.2 contexts without it. (#3119, #2866, #2852) --- docs/CHANGELOG.txt | 2 ++ examples/imgui_impl_opengl3.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 43c70d33..14f5c623 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -84,6 +84,8 @@ Other Changes: - CI: Added more tests on the continuous-integration server: extra warnings for Clang/GCC, building SDL+Metal example, building imgui_freetype.cpp, more compile-time imconfig.h settings: disabling obsolete functions, enabling 32-bit ImDrawIdx, enabling 32-bit ImWchar, disabling demo. [@rokups] +- Backends: OpenGL3: Fixed version check mistakenly testing for GL 4.0+ instead of 3.2+ to enable + ImGuiBackendFlags_RendererHasVtxOffset, leaving 3.2 contexts without it. (#3119, #2866) [@wolfpld] - Backends: OpenGL3: Added include support for older glbinding 2.x loader. (#3061) [@DonKult] - Backends: Win32: Added ImGui_ImplWin32_EnableDpiAwareness(), ImGui_ImplWin32_GetDpiScaleForHwnd(), ImGui_ImplWin32_GetDpiScaleForMonitor() helpers functions (backported from the docking branch). diff --git a/examples/imgui_impl_opengl3.cpp b/examples/imgui_impl_opengl3.cpp index 2f908f46..40e531dd 100644 --- a/examples/imgui_impl_opengl3.cpp +++ b/examples/imgui_impl_opengl3.cpp @@ -13,6 +13,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2020-04-12: OpenGL: Fixed context version check mistakenly testing for 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset. // 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader. // 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader. // 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders. @@ -141,7 +142,7 @@ using namespace gl; #endif // OpenGL Data -static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries. +static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries (e.g. 320 for GL 3.2) static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings. static GLuint g_FontTexture = 0; static GLuint g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0; @@ -152,21 +153,21 @@ static unsigned int g_VboHandle = 0, g_ElementsHandle = 0; // Functions bool ImGui_ImplOpenGL3_Init(const char* glsl_version) { - // Query for GL version + // Query for GL version (e.g. 320 for GL 3.2) #if !defined(IMGUI_IMPL_OPENGL_ES2) GLint major, minor; glGetIntegerv(GL_MAJOR_VERSION, &major); glGetIntegerv(GL_MINOR_VERSION, &minor); - g_GlVersion = major * 1000 + minor; + g_GlVersion = major * 100 + minor * 10; #else - g_GlVersion = 2000; // GLES 2 + g_GlVersion = 200; // GLES 2 #endif // Setup back-end capabilities flags ImGuiIO& io = ImGui::GetIO(); io.BackendRendererName = "imgui_impl_opengl3"; #if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET - if (g_GlVersion >= 3200) + if (g_GlVersion >= 320) io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes. #endif @@ -378,7 +379,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data) // Bind texture, Draw glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId); #if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET - if (g_GlVersion >= 3200) + if (g_GlVersion >= 320) glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset); else #endif From 7ee623d9b1385fffecc989b5a9fb371698bad060 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 12 Apr 2020 18:58:06 +0200 Subject: [PATCH 10/11] Internals: FocusScope not inherited by popups, modals. Amend a5041c88 2ebe08be) --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 2aaddb67..5614f1e7 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5902,7 +5902,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext; window->DC.NavLayerActiveMaskNext = 0x00; - window->DC.NavFocusScopeIdCurrent = parent_window ? parent_window->DC.NavFocusScopeIdCurrent : 0; + window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; window->DC.NavHideHighlightOneFrame = false; window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f); From 5503c0a12e0c929e84b3f61b2cb4bb9177ea3da1 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 12 Apr 2020 19:15:38 +0200 Subject: [PATCH 11/11] Version 1.76 + fixed PVS warning, update demo binaries, update readme image --- docs/CHANGELOG.txt | 11 +++++------ docs/README.md | 8 ++++---- examples/README.txt | 2 +- imgui.cpp | 4 ++-- imgui.h | 6 +++--- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_widgets.cpp | 2 +- 9 files changed, 19 insertions(+), 20 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 14f5c623..c08d198c 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -31,15 +31,13 @@ HOW TO UPDATE? ----------------------------------------------------------------------- - VERSION 1.76 WIP (In Progress) + VERSION 1.76 (Released 2020-04-12) ----------------------------------------------------------------------- Other Changes: - Drag and Drop, Nav: Disabling navigation arrow keys when drag and drop is active. In the docking branch pressing arrow keys while dragging a window from a tab could trigger an assert. (#3025) -- ColorButton: Added ImGuiColorEditFlags_NoBorder flag to remove the border normally enforced - by default for standalone ColorButton. - BeginMenu: Using same ID multiple times appends content to a menu. (#1207) [@rokups] - BeginMenu: Fixed a bug where SetNextWindowXXX data before a BeginMenu() would not be cleared when the menu is not open. (#3030) @@ -49,6 +47,8 @@ Other Changes: - Selectable: Allow using ImGuiSelectableFlags_SpanAllColumns in other columns than first. (#125) - TreeNode: Made clicking on arrow with _OpenOnArrow toggle the open state on the Mouse Down event rather than the Mouse Down+Up sequence (this is rather standard behavior). +- ColorButton: Added ImGuiColorEditFlags_NoBorder flag to remove the border normally enforced + by default for standalone ColorButton. - Nav: Fixed interactions with ImGuiListClipper, so e.g. Home/End result would not clip the landing item on the landing frame. (#787) - Nav: Fixed currently focused item from ever being clipped by ItemAdd(). (#787) @@ -57,8 +57,7 @@ Other Changes: ImGuiListClipper as the first thing after Begin() could largely break size calculations. (#3073) - Added optional support for Unicode plane 1-16 (#2538, #2541, #2815) [@cloudwu, @samhocevar] - Compile-time enable with '#define IMGUI_USE_WCHAR32' in imconfig.h. - - Generally more consistent support for unsupported codepoints (0xFFFD), in particular when - using the default, non-fitting characters will be turned into 0xFFFD instead of being ignored. + - More onsistent handling of unsupported code points (0xFFFD). - Surrogate pairs are supported when submitting UTF-16 data via io.AddInputCharacterUTF16(), allowing for more complete CJK input. - sizeof(ImWchar) goes from 2 to 4. IM_UNICODE_CODEPOINT_MAX goes from 0xFFFF to 0x10FFFF. @@ -68,7 +67,7 @@ Other Changes: to 64 columns with an assert. (#3037, #125) - Window: Fixed a bug with child window inheriting ItemFlags from their parent when the child window also manipulate the ItemFlags stack. (#3024) [@Stanbroek] -- Font: Fixed non-ASCII space occasionally creating unnecessary empty polygons. +- Font: Fixed non-ASCII space occasionally creating unnecessary empty looking polygons. - Misc: Added an explicit compile-time test for non-scoped IM_ASSERT() macros to redirect users to a solution rather than encourage people to add braces in the codebase. - Misc: Added additional checks in EndFrame() to verify that io.KeyXXX values have not been diff --git a/docs/README.md b/docs/README.md index 30c5d1a9..c7982c23 100644 --- a/docs/README.md +++ b/docs/README.md @@ -97,7 +97,7 @@ Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcas ![screenshot demo](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v167/v167-misc.png) You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here: -- [imgui-demo-binaries-20190715.zip](http://www.dearimgui.org/binaries/imgui-demo-binaries-20190715.zip) (Windows binaries, 1.72 WIP, built 2019/07/15, master branch, 5 executables) +- [imgui-demo-binaries-20190715.zip](http://www.dearimgui.org/binaries/imgui-demo-binaries-20200412.zip) (Windows binaries, 1.76 WIP, built 2020/04/12, master branch, 5 executables) or [older demo binaries](http://www.dearimgui.org/binaries). The demo applications are not DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at different scale, and scale your style with `style.ScaleAllSizes()`. @@ -140,7 +140,7 @@ Custom engine [![screenshot tool](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white_preview.jpg)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white.png) [Tracy Profiler](https://bitbucket.org/wolfpld/tracy) -![tracy profiler](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v173/tracy_profiler.jpg) +![tracy profiler](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v176/tracy_profiler.png) ### Support, Frequently Asked Questions (FAQ) @@ -196,7 +196,7 @@ Ongoing Dear ImGui development is financially supported by users and private spo *Double-chocolate and Salty caramel sponsors* - [Activision](https://careers.activision.com/c/programmingsoftware-engineering-jobs), [DotEmu](http://www.dotemu.com), [Framefield](http://framefield.com), [Hexagon](https://hexagonxalt.com/the-technology/xalt-visualization), [Kylotonn](https://www.kylotonn.com), [Media Molecule](http://www.mediamolecule.com), [Mesh Consultants](https://www.meshconsultants.ca), [Mobigame](http://www.mobigame.net), [Nadeo](https://www.nadeo.com), [Supercell](http://www.supercell.com), [Remedy Entertainment](https://www.remedygames.com/), [Unit 2 Games](https://unit2games.com/) -From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors). +From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors). **THANK YOU to all past and present supporters for helping to keep this project alive and thriving!** @@ -208,7 +208,7 @@ Dear ImGui is using software and services provided free of charge for open sourc Credits ------- -Developed by [Omar Cornut](http://www.miracleworld.net) and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com) (Vita). +Developed by [Omar Cornut](http://www.miracleworld.net) and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com) (PS Vita). I first discovered the IMGUI paradigm at [Q-Games](http://www.q-games.com) where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it. diff --git a/examples/README.txt b/examples/README.txt index 355d616c..1408585b 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1,5 +1,5 @@ ----------------------------------------------------------------------- - dear imgui, v1.76 WIP + dear imgui, v1.76 ----------------------------------------------------------------------- examples/README.txt (This is the README file for the examples/ folder. See docs/ for more documentation) diff --git a/imgui.cpp b/imgui.cpp index 5614f1e7..b57bb195 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.76 WIP +// dear imgui, v1.76 // (main code and documentation) // Help: @@ -5902,7 +5902,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext; window->DC.NavLayerActiveMaskNext = 0x00; - window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; + window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; // -V595 window->DC.NavHideHighlightOneFrame = false; window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f); diff --git a/imgui.h b/imgui.h index 2d902022..92c56740 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.76 WIP +// dear imgui, v1.76 // (headers) // Help: @@ -59,8 +59,8 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) -#define IMGUI_VERSION "1.76 WIP" -#define IMGUI_VERSION_NUM 17502 +#define IMGUI_VERSION "1.76" +#define IMGUI_VERSION_NUM 17600 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) // Define attributes of all API symbols declarations (e.g. for DLL under Windows) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 28a5940e..1e110ded 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.76 WIP +// dear imgui, v1.76 // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index f02c7a90..1e08bfd0 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.76 WIP +// dear imgui, v1.76 // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index 61c1e5b7..cef0f9a9 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.76 WIP +// dear imgui, v1.76 // (internal structures/api) // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 33a98635..27d9e455 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.76 WIP +// dear imgui, v1.76 // (widgets code) /*