diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0dcab4688..5717f5262 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -77,7 +77,7 @@ jobs:
run: |
cd examples\example_null
call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
- .\build_win32.bat /W4
+ .\build_win.bat /W4
- name: Build example_null (single file build)
shell: bash
@@ -268,6 +268,39 @@ jobs:
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release'
+ Build-Windows-ARM64:
+ runs-on: windows-11-arm
+ name: Build - Windows ARM64
+
+ defaults:
+ run:
+ working-directory: ${{ github.workspace }}/imgui
+
+ env:
+ VS_PATH: C:\Program Files\Microsoft Visual Studio\18\Enterprise
+ steps:
+ - uses: actions/checkout@v6
+ with:
+ path: ${{ github.workspace }}/imgui
+
+ - name: Build example_null (extra warnings, msvc arm64)
+ shell: cmd
+ run: |
+ cd examples\example_null
+ call "%VS_PATH%\VC\Auxiliary\Build\vcvarsarm64.bat"
+ .\build_win.bat /W4
+
+ - name: Run example_null (msvc arm64)
+ shell: cmd
+ run: examples\example_null\Debug\example_null.exe
+
+ - name: Build example_win32_directx11 (msvc arm64)
+ shell: cmd
+ run: |
+ cd examples\example_win32_directx11
+ call "%VS_PATH%\VC\Auxiliary\Build\vcvarsarm64.bat"
+ .\build_win.bat
+
Build-Linux:
runs-on: ubuntu-latest
name: Build - Linux
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index f108c88a4..0ad364a40 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -66,9 +66,22 @@ Autumn cleanup of stuff marked obsolete more than two years ago:
Other Changes:
+- Style: `StyleColorsDark()`: tweaked WindowBg to be darker than in 1.93.0.
+- Style: added `style.SymbolArrowSizeFactor`, `style.SymbolArrowThicknessFactor` to tweak
+ the shape and look of arrows. Made default arrow stroked. (#5233, #2431, #2235, #6730, #8243)
+ Legacy arrow: size: (0.60f,0.70f), thickness: 0.0f
+ New arrow: size: (0.72f,0.40f), thickness: 0.30f
+- TreeNode:
+ - TreeNodeGetOpen(): added flags parameter to allow passing `ImGuiTreeNodeFlags_DefaultOpen`
+ or `ImGuiTreeNodeFlags_Leaf`. (#9569, #9592, #3823, #9251) [@adalisk-emikhaylov, @Yaki-Blake]
- ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro
adds an extra `operator=` to ImVec2. This isn't supported but should not
be needed as you should have a constructor to convert from your type to ImVec2.
+- CI: added some ARM64 builds. (#9593) [@Harishmcw]
+- Examples: renamed various helper batch files from build_win32.bat to build_win.bat
+ to reflect that they can also build X64 or ARM64, given the right environment.
+ Made the script detect the environment when needed (e.g. to specify library path).
+- Examples: added support for ARM64 in selected build_win.bat helpers. (#9593) [@Harishmcw]
-----------------------------------------------------------------------
@@ -205,6 +218,7 @@ Breaking Changes:
- `ImDrawFlags_RoundCornersBottom` -> `ImDrawFlags_RoundBottom`
- `ImDrawFlags_RoundCornersLeft` -> `ImDrawFlags_RoundLeft`
- `ImDrawFlags_RoundCornersRight` -> `ImDrawFlags_RoundRight`
+ - `ImDrawFlags_RoundCornersMask_` -> `ImDrawFlags_RoundMask_`
Kept redirection enums (will obsolete).
- Marked `ImDrawListFlags_AntiAliasedLinesUseTex` and `style.AntiAliasedLinesUseTex` as
obsolete, as the new line rendering code always uses textures.
diff --git a/examples/example_glfw_opengl2/build_win.bat b/examples/example_glfw_opengl2/build_win.bat
new file mode 100644
index 000000000..cca29d76f
--- /dev/null
+++ b/examples/example_glfw_opengl2/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_glfw_opengl2
+@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp
+@set LIBS=glfw3.lib opengl32.lib gdi32.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-32
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_glfw_opengl2/build_win32.bat b/examples/example_glfw_opengl2/build_win32.bat
deleted file mode 100644
index 24c0e08fd..000000000
--- a/examples/example_glfw_opengl2/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_glfw_opengl2
-@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_glfw_opengl3/build_win.bat b/examples/example_glfw_opengl3/build_win.bat
new file mode 100644
index 000000000..a39236cdd
--- /dev/null
+++ b/examples/example_glfw_opengl3/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_glfw_opengl3
+@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
+@set LIBS=glfw3.lib opengl32.lib gdi32.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-32
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_glfw_opengl3/build_win32.bat b/examples/example_glfw_opengl3/build_win32.bat
deleted file mode 100644
index b5979ad49..000000000
--- a/examples/example_glfw_opengl3/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_glfw_opengl3
-@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_glfw_vulkan/build_win.bat b/examples/example_glfw_vulkan/build_win.bat
new file mode 100644
index 000000000..0366b1b5d
--- /dev/null
+++ b/examples/example_glfw_vulkan/build_win.bat
@@ -0,0 +1,25 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_glfw_vulkan
+@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp
+@set LIBS=glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
+
+@set OUT_DIR=Release
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_glfw_vulkan/build_win32.bat b/examples/example_glfw_vulkan/build_win32.bat
deleted file mode 100644
index bb54a4210..000000000
--- a/examples/example_glfw_vulkan/build_win32.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_glfw_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
-
-@set OUT_DIR=Release
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_glfw_vulkan/build_win64.bat b/examples/example_glfw_vulkan/build_win64.bat
deleted file mode 100644
index ca9b788d8..000000000
--- a/examples/example_glfw_vulkan/build_win64.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup 64-bit command-line compiler.
-
-@set OUT_EXE=example_glfw_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
-
-@set OUT_DIR=Release
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_null/build_win32.bat b/examples/example_null/build_win.bat
similarity index 74%
rename from examples/example_null/build_win32.bat
rename to examples/example_null/build_win.bat
index be81d8093..6c4d4e036 100644
--- a/examples/example_null/build_win32.bat
+++ b/examples/example_null/build_win.bat
@@ -1,3 +1,3 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
+@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat, or vcvarsall.bat to setup command-line compiler.
mkdir Debug
cl /nologo /Zi /MD /utf-8 /I ..\.. %* *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib imm32.lib
diff --git a/examples/example_null/example_null.vcxproj b/examples/example_null/example_null.vcxproj
index 61e388f96..1353fc0b3 100644
--- a/examples/example_null/example_null.vcxproj
+++ b/examples/example_null/example_null.vcxproj
@@ -92,8 +92,9 @@
true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+
+
+ %(AdditionalLibraryDirectories)
Console
@@ -107,8 +108,9 @@
true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+
+
+ %(AdditionalLibraryDirectories)
Console
@@ -126,8 +128,9 @@
true
true
true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+
+
+ %(AdditionalLibraryDirectories)
Console
@@ -145,8 +148,9 @@
true
true
true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+
+
+ %(AdditionalLibraryDirectories)
Console
diff --git a/examples/example_sdl2_directx11/build_win.bat b/examples/example_sdl2_directx11/build_win.bat
new file mode 100644
index 000000000..6b279b937
--- /dev/null
+++ b/examples/example_sdl2_directx11/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl2_directx11
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared"
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp
+@set LIBS=SDL2.lib SDL2main.lib d3d11.lib d3dcompiler.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_directx11/build_win32.bat b/examples/example_sdl2_directx11/build_win32.bat
deleted file mode 100644
index f0b485ca6..000000000
--- a/examples/example_sdl2_directx11/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_sdl2_directx11
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include"
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib shell32.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj
index afa9d5de4..4ba9ac321 100644
--- a/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj
+++ b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj
@@ -97,7 +97,7 @@
true
- %SDL2_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)
SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
msvcrt.lib
@@ -113,7 +113,7 @@
true
- %SDL2_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)
SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
msvcrt.lib
@@ -133,7 +133,7 @@
true
true
true
- %SDL2_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)
SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
@@ -154,7 +154,7 @@
true
true
true
- %SDL2_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)
SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
@@ -186,4 +186,4 @@
-
\ No newline at end of file
+
diff --git a/examples/example_sdl2_opengl2/build_win.bat b/examples/example_sdl2_opengl2/build_win.bat
new file mode 100644
index 000000000..945464c00
--- /dev/null
+++ b/examples/example_sdl2_opengl2/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl2_opengl2
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp
+@set LIBS=SDL2.lib SDL2main.lib opengl32.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_opengl2/build_win32.bat b/examples/example_sdl2_opengl2/build_win32.bat
deleted file mode 100644
index 7543edafc..000000000
--- a/examples/example_sdl2_opengl2/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_sdl2_opengl2
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_opengl3/README.md b/examples/example_sdl2_opengl3/README.md
index 81fd9fe7b..e62dec255 100644
--- a/examples/example_sdl2_opengl3/README.md
+++ b/examples/example_sdl2_opengl3/README.md
@@ -7,7 +7,7 @@ Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) i
## Windows with Visual Studio's CLI
-Use build_win32.bat or directly:
+Use build_win.bat or directly:
```
set SDL2_DIR=path_to_your_sdl2_folder
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
diff --git a/examples/example_sdl2_opengl3/build_win.bat b/examples/example_sdl2_opengl3/build_win.bat
new file mode 100644
index 000000000..7d8dd115c
--- /dev/null
+++ b/examples/example_sdl2_opengl3/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl2_opengl3
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
+@set LIBS=SDL2.lib SDL2main.lib opengl32.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_opengl3/build_win32.bat b/examples/example_sdl2_opengl3/build_win32.bat
deleted file mode 100644
index 7b2fac922..000000000
--- a/examples/example_sdl2_opengl3/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_sdl2_opengl3
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_sdlrenderer2/build_win.bat b/examples/example_sdl2_sdlrenderer2/build_win.bat
new file mode 100644
index 000000000..82bc8613b
--- /dev/null
+++ b/examples/example_sdl2_sdlrenderer2/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl2_sdlrenderer_
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer2.cpp ..\..\imgui*.cpp
+@set LIBS=SDL2.lib SDL2main.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_sdlrenderer2/build_win32.bat b/examples/example_sdl2_sdlrenderer2/build_win32.bat
deleted file mode 100644
index e311bfcd0..000000000
--- a/examples/example_sdl2_sdlrenderer2/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_sdl2_sdlrenderer_
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer2.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_vulkan/build_win.bat b/examples/example_sdl2_vulkan/build_win.bat
new file mode 100644
index 000000000..2b2fedcaa
--- /dev/null
+++ b/examples/example_sdl2_vulkan/build_win.bat
@@ -0,0 +1,25 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl2_vulkan
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
+@set LIBS=SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
+
+@set OUT_DIR=Release
+@REM mkdir %OUT_DIR%
+@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_vulkan/build_win32.bat b/examples/example_sdl2_vulkan/build_win32.bat
deleted file mode 100644
index f634aba00..000000000
--- a/examples/example_sdl2_vulkan/build_win32.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_sdl2_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
-
-@set OUT_DIR=Release
-@REM mkdir %OUT_DIR%
-@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl2_vulkan/build_win64.bat b/examples/example_sdl2_vulkan/build_win64.bat
deleted file mode 100644
index 5d315cca2..000000000
--- a/examples/example_sdl2_vulkan/build_win64.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_sdl2_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
-
-@set OUT_DIR=Release
-@REM mkdir %OUT_DIR%
-@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_directx11/build_win.bat b/examples/example_sdl3_directx11/build_win.bat
new file mode 100644
index 000000000..3eccbb2ed
--- /dev/null
+++ b/examples/example_sdl3_directx11/build_win.bat
@@ -0,0 +1,23 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl3_directx11
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared"
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp
+@set LIBS=SDL3.lib d3d11.lib d3dcompiler.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64
+@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_directx11/build_win32.bat b/examples/example_sdl3_directx11/build_win32.bat
deleted file mode 100644
index b84b01f1a..000000000
--- a/examples/example_sdl3_directx11/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_sdl3_directx11
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include"
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib shell32.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj b/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj
index 057874196..8729480a5 100644
--- a/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj
+++ b/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj
@@ -97,7 +97,7 @@
true
- %SDL3_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %SDL3_DIR%\lib\x86;%(AdditionalLibraryDirectories)
SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
msvcrt.lib
@@ -113,7 +113,7 @@
true
- %SDL3_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %SDL3_DIR%\lib\x64;%(AdditionalLibraryDirectories)
SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
msvcrt.lib
@@ -133,7 +133,7 @@
true
true
true
- %SDL3_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %SDL3_DIR%\lib\x86;%(AdditionalLibraryDirectories)
SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
@@ -154,7 +154,7 @@
true
true
true
- %SDL3_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %SDL3_DIR%\lib\x64;%(AdditionalLibraryDirectories)
SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
Console
@@ -186,4 +186,4 @@
-
\ No newline at end of file
+
diff --git a/examples/example_sdl3_opengl3/README.md b/examples/example_sdl3_opengl3/README.md
index a032f8752..bc748afac 100644
--- a/examples/example_sdl3_opengl3/README.md
+++ b/examples/example_sdl3_opengl3/README.md
@@ -7,7 +7,7 @@ Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) i
## Windows with Visual Studio's CLI
-Use build_win32.bat or directly:
+Use build_win.bat or directly:
```
set SDL3_DIR=path_to_your_sdl3_folder
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL3_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl3_opengl3.exe /FoDebug/ /link /libpath:%SDL3_DIR%\lib\x86 SDL3.lib opengl32.lib /subsystem:console
diff --git a/examples/example_sdl3_opengl3/build_win.bat b/examples/example_sdl3_opengl3/build_win.bat
new file mode 100644
index 000000000..6ea3e3941
--- /dev/null
+++ b/examples/example_sdl3_opengl3/build_win.bat
@@ -0,0 +1,27 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl3_opengl3
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
+@set LIBS=SDL3.lib opengl32.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64
+@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
+
+@set OUT_DIR=Release
+@REM mkdir %OUT_DIR%
+@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_opengl3/build_win32.bat b/examples/example_sdl3_opengl3/build_win32.bat
deleted file mode 100644
index 5bed40ac1..000000000
--- a/examples/example_sdl3_opengl3/build_win32.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_sdl3_opengl3
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib opengl32.lib shell32.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
-
-@set OUT_DIR=Release
-@REM mkdir %OUT_DIR%
-@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_opengl3/build_win64.bat b/examples/example_sdl3_opengl3/build_win64.bat
deleted file mode 100644
index 87c6bb8b5..000000000
--- a/examples/example_sdl3_opengl3/build_win64.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_sdl3_opengl3
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 SDL3.lib opengl32.lib shell32.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
-
-@set OUT_DIR=Release
-@REM mkdir %OUT_DIR%
-@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_sdlgpu3/build_win.bat b/examples/example_sdl3_sdlgpu3/build_win.bat
new file mode 100644
index 000000000..c71478b57
--- /dev/null
+++ b/examples/example_sdl3_sdlgpu3/build_win.bat
@@ -0,0 +1,27 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl3_sdlgpu3
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlgpu3.cpp ..\..\imgui*.cpp
+@set LIBS=SDL3.lib shell32.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64
+@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
+
+@set OUT_DIR=Release
+@REM mkdir %OUT_DIR%
+@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_sdlgpu3/build_win64.bat b/examples/example_sdl3_sdlgpu3/build_win64.bat
deleted file mode 100644
index ad7a2d603..000000000
--- a/examples/example_sdl3_sdlgpu3/build_win64.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_sdl3_sdlgpu3
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlgpu3.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 SDL3.lib shell32.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
-
-@set OUT_DIR=Release
-@REM mkdir %OUT_DIR%
-@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_sdlrenderer3/build_win.bat b/examples/example_sdl3_sdlrenderer3/build_win.bat
new file mode 100644
index 000000000..9014d76c2
--- /dev/null
+++ b/examples/example_sdl3_sdlrenderer3/build_win.bat
@@ -0,0 +1,23 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl3_sdlrenderer3
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlrenderer3.cpp ..\..\imgui*.cpp
+@set LIBS=SDL3.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64
+@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_sdlrenderer3/build_win32.bat b/examples/example_sdl3_sdlrenderer3/build_win32.bat
deleted file mode 100644
index 7bc131a6a..000000000
--- a/examples/example_sdl3_sdlrenderer3/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_sdl3_sdlrenderer3
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlrenderer3.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_vulkan/build_win.bat b/examples/example_sdl3_vulkan/build_win.bat
new file mode 100644
index 000000000..e1ad37988
--- /dev/null
+++ b/examples/example_sdl3_vulkan/build_win.bat
@@ -0,0 +1,25 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_sdl3_vulkan
+@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
+@set LIBS=SDL3.lib shell32.lib vulkan-1.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
+
+@set OUT_DIR=Release
+@REM mkdir %OUT_DIR%
+@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_vulkan/build_win32.bat b/examples/example_sdl3_vulkan/build_win32.bat
deleted file mode 100644
index 3e26d3088..000000000
--- a/examples/example_sdl3_vulkan/build_win32.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_sdl3_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 SDL3.lib shell32.lib vulkan-1.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
-
-@set OUT_DIR=Release
-@REM mkdir %OUT_DIR%
-@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl3_vulkan/build_win64.bat b/examples/example_sdl3_vulkan/build_win64.bat
deleted file mode 100644
index 5d038d1ee..000000000
--- a/examples/example_sdl3_vulkan/build_win64.bat
+++ /dev/null
@@ -1,14 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler.
-
-@set OUT_EXE=example_sdl3_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib SDL3.lib shell32.lib vulkan-1.lib
-
-@set OUT_DIR=Debug
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
-
-@set OUT_DIR=Release
-@REM mkdir %OUT_DIR%
-@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_win32_directx10/build_win32.bat b/examples/example_win32_directx10/build_win.bat
similarity index 70%
rename from examples/example_win32_directx10/build_win32.bat
rename to examples/example_win32_directx10/build_win.bat
index 78a6e374d..d7d2f5a6a 100644
--- a/examples/example_win32_directx10/build_win32.bat
+++ b/examples/example_win32_directx10/build_win.bat
@@ -1,8 +1,8 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
+@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat or vcvarsall.bat to setup command-line compiler.
@set OUT_DIR=Debug
@set OUT_EXE=example_win32_directx10
-@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include"
+@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared"
@set SOURCES=main.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\backends\imgui_impl_dx10.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib
+@set LIBS=d3d10.lib d3dcompiler.lib
mkdir %OUT_DIR%
cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index add37ed97..89e9393ab 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -93,7 +93,7 @@
true
d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -108,7 +108,7 @@
true
d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -127,7 +127,7 @@
true
true
d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -146,7 +146,7 @@
true
true
d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -175,4 +175,4 @@
-
\ No newline at end of file
+
diff --git a/examples/example_win32_directx11/build_win32.bat b/examples/example_win32_directx11/build_win.bat
similarity index 70%
rename from examples/example_win32_directx11/build_win32.bat
rename to examples/example_win32_directx11/build_win.bat
index c9a717c60..78758193d 100644
--- a/examples/example_win32_directx11/build_win32.bat
+++ b/examples/example_win32_directx11/build_win.bat
@@ -1,9 +1,9 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
+@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat, or vcvarsall.bat to setup command-line compiler.
@set OUT_DIR=Debug
@set OUT_EXE=example_win32_directx11
-@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include"
+@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared"
@set SOURCES=main.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib
+@set LIBS=d3d11.lib d3dcompiler.lib
mkdir %OUT_DIR%
cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_win32_directx11/example_win32_directx11.vcxproj b/examples/example_win32_directx11/example_win32_directx11.vcxproj
index ed0b509a8..ace899cb5 100644
--- a/examples/example_win32_directx11/example_win32_directx11.vcxproj
+++ b/examples/example_win32_directx11/example_win32_directx11.vcxproj
@@ -93,7 +93,7 @@
true
d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -108,7 +108,7 @@
true
d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -127,7 +127,7 @@
true
true
d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -146,7 +146,7 @@
true
true
d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
+ %(AdditionalLibraryDirectories)
Console
@@ -175,4 +175,4 @@
-
\ No newline at end of file
+
diff --git a/examples/example_win32_directx12/build_win32.bat b/examples/example_win32_directx12/build_win.bat
similarity index 88%
rename from examples/example_win32_directx12/build_win32.bat
rename to examples/example_win32_directx12/build_win.bat
index cb5e8e273..d609c7203 100644
--- a/examples/example_win32_directx12/build_win32.bat
+++ b/examples/example_win32_directx12/build_win.bat
@@ -1,4 +1,4 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
+@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat, or vcvarsall.bat to setup command-line compiler.
@set OUT_DIR=Debug
@set OUT_EXE=example_win32_directx12
@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared"
diff --git a/examples/example_win32_directx9/build_win.bat b/examples/example_win32_directx9/build_win.bat
new file mode 100644
index 000000000..4523769df
--- /dev/null
+++ b/examples/example_win32_directx9/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_win32_directx9
+@set INCLUDES=/I..\.. /I..\..\backends /I "%DXSDK_DIR%/Include"
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_dx9.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp
+@set LIBS=d3d9.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:"%DXSDK_DIR%/Lib/x86"
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:"%DXSDK_DIR%/Lib/x64"
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_win32_directx9/build_win32.bat b/examples/example_win32_directx9/build_win32.bat
deleted file mode 100644
index ece5ea1ba..000000000
--- a/examples/example_win32_directx9/build_win32.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_win32_directx9
-@set INCLUDES=/I..\.. /I..\..\backends /I "%DXSDK_DIR%/Include"
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_dx9.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp
-@set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_win32_opengl3/build_win32.bat b/examples/example_win32_opengl3/build_win.bat
similarity index 86%
rename from examples/example_win32_opengl3/build_win32.bat
rename to examples/example_win32_opengl3/build_win.bat
index 48df08087..0bedfc19f 100644
--- a/examples/example_win32_opengl3/build_win32.bat
+++ b/examples/example_win32_opengl3/build_win.bat
@@ -1,4 +1,4 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
+@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat or vcvarsall.bat to setup command-line compiler.
@set OUT_DIR=Debug
@set OUT_EXE=example_win32_opengl3
@set INCLUDES=/I..\.. /I..\..\backends
diff --git a/examples/example_win32_vulkan/build_win.bat b/examples/example_win32_vulkan/build_win.bat
new file mode 100644
index 000000000..7e71881b3
--- /dev/null
+++ b/examples/example_win32_vulkan/build_win.bat
@@ -0,0 +1,21 @@
+@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+
+@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH).
+@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH%
+@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%)
+@if /I "%TARGET_ARCH%"=="x86" goto arch_ok
+@if /I "%TARGET_ARCH%"=="x64" goto arch_ok
+@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64).
+@exit /b 1
+
+:arch_ok
+@set OUT_EXE=example_win32_vulkan
+@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I %VULKAN_SDK%\include
+@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp
+@set LIBS=vulkan-1.lib
+@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /libpath:%VULKAN_SDK%\lib32
+@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /libpath:%VULKAN_SDK%\lib
+
+@set OUT_DIR=Debug
+mkdir %OUT_DIR%
+cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_win32_vulkan/build_win32.bat b/examples/example_win32_vulkan/build_win32.bat
deleted file mode 100644
index 4bfb7cafc..000000000
--- a/examples/example_win32_vulkan/build_win32.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_win32_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp
-@set LIBS=/libpath:%VULKAN_SDK%\lib32 vulkan-1.lib
-
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/examples/example_win32_vulkan/build_win64.bat b/examples/example_win32_vulkan/build_win64.bat
deleted file mode 100644
index f8c66f799..000000000
--- a/examples/example_win32_vulkan/build_win64.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-@set OUT_DIR=Debug
-@set OUT_EXE=example_win32_vulkan
-@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I %VULKAN_SDK%\include
-@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp
-@set LIBS=/libpath:%VULKAN_SDK%\lib vulkan-1.lib
-
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS%
diff --git a/imgui.cpp b/imgui.cpp
index 8a72f2397..4645a1ba5 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -1659,6 +1659,10 @@ ImGuiStyle::ImGuiStyle()
DockingSeparatorSize = 2.0f; // Thickness of resizing border between docked windows
MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.
+ // Symbols
+ SymbolArrowSizeFactor = ImVec2(0.72f,0.40f); // Width/height factor of arrows (0.0f..1.0f). Legacy arrows use (0.60f,0.70f)
+ SymbolArrowThicknessFactor = 0.30f; // Thickness factor of arrows (0.0f..0.5f). 0.0f=Fill. >0.0f=Stroke. Legacy arrows use 0.0f.
+
// Rendering & Tessellation
AntiAliasedLines = true; // Enable anti-aliased lines/borders. Used at the beginning of the frame to set ImDrawFlags_AALines in all draw-lists.
AntiAliasedLineEnds = false; // Enable anti-aliased lines/borders ends. Nicer for thick lines but more expensive. Used at the beginning of the frame to set ImDrawFlags_AALineEnds in all draw-lists.
@@ -2331,14 +2335,14 @@ ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c,
int ImStricmp(const char* str1, const char* str2)
{
int d;
- while ((d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; }
+ while ((d = ImToUpper(*str1) - ImToUpper(*str2)) == 0 && *str1) { str1++; str2++; }
return d;
}
int ImStrnicmp(const char* str1, const char* str2, size_t count)
{
int d = 0;
- while (count > 0 && (d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; count--; }
+ while (count > 0 && (d = ImToUpper(*str1) - ImToUpper(*str2)) == 0 && *str1) { str1++; str2++; count--; }
return d;
}
@@ -4843,12 +4847,13 @@ void ImGui::RemoveContextHook(ImGuiContext* ctx, ImGuiID hook_id)
// Call context hooks (used by e.g. test engine)
// We assume a small number of hooks so all stored in same array
+// Iterate by index: a callback may add a hook, which reallocates the array. Hooks added here are called from the next call.
void ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type)
{
ImGuiContext& g = *ctx;
- for (ImGuiContextHook& hook : g.Hooks)
- if (hook.Type == hook_type)
- hook.Callback(&g, &hook);
+ for (int n = 0, hooks_count = g.Hooks.Size; n < hooks_count; n++)
+ if (g.Hooks[n].Type == hook_type)
+ g.Hooks[n].Callback(&g, &g.Hooks[n]);
}
//-----------------------------------------------------------------------------
@@ -19865,7 +19870,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
if (is_focused || root_node->VisibleWindow == NULL)
root_node->VisibleWindow = node->VisibleWindow;
if (node->TabBar)
- node->TabBar->VisibleTabId = node->VisibleWindow->TabId;
+ node->TabBar->VisibleTabContentsId = node->VisibleWindow->TabId;
}
return;
}
@@ -20014,7 +20019,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
TabItemEx(tab_bar, window->Name, window->HasCloseButton ? &tab_open : NULL, tab_item_flags, window);
if (!tab_open)
node->WantCloseTabId = window->TabId;
- if (tab_bar->VisibleTabId == window->TabId)
+ if (tab_bar->VisibleTabContentsId == window->TabId)
node->VisibleWindow = window;
// Store last item data so it can be queried with IsItemXXX functions after the user Begin() call
diff --git a/imgui.h b/imgui.h
index 7f3a1c132..964e41502 100644
--- a/imgui.h
+++ b/imgui.h
@@ -777,7 +777,7 @@ namespace ImGui
IMGUI_API bool CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFlags flags = 0); // when 'p_visible != NULL': if '*p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if '*p_visible==false' don't display the header.
IMGUI_API void SetNextItemOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state.
IMGUI_API void SetNextItemStorageID(ImGuiID storage_id); // set id to use for open/close storage (default to same as item id).
- IMGUI_API bool TreeNodeGetOpen(ImGuiID storage_id); // retrieve tree node open/close state.
+ IMGUI_API bool TreeNodeGetOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags = 0); // retrieve tree node open/close state.
// Widgets: Selectables
// - A selectable highlights when hovered, and can display another color when selected.
@@ -2484,6 +2484,10 @@ struct ImGuiStyle
float DockingSeparatorSize; // Thickness of resizing border between docked windows
float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later.
+ // Symbols
+ ImVec2 SymbolArrowSizeFactor; // Width/height factor of arrows (0.0f..1.0f).
+ float SymbolArrowThicknessFactor; // Thickness factor of arrows (0.0f..0.5f). 0.0f=Fill. >0.0f=Stroke.
+
// Rendering & Tessellation
bool AntiAliasedLines; // Enable anti-aliased lines/borders. Used at the beginning of the frame to set ImDrawFlags_AALines in all draw-lists.
bool AntiAliasedLineEnds; // Enable anti-aliased lines/borders ends. Nicer for thick lines but more expensive. Used at the beginning of the frame to set ImDrawFlags_AALineEnds in all draw-lists.
@@ -3525,7 +3529,8 @@ enum ImDrawFlags_
ImDrawFlags_RoundCornersTop = ImDrawFlags_RoundTop,
ImDrawFlags_RoundCornersBottom = ImDrawFlags_RoundBottom,
ImDrawFlags_RoundCornersLeft = ImDrawFlags_RoundLeft,
- ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundRight,
+ ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundRight,
+ ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundMask_,
#endif
};
diff --git a/imgui_demo.cpp b/imgui_demo.cpp
index a45a091dd..d6cc255af 100644
--- a/imgui_demo.cpp
+++ b/imgui_demo.cpp
@@ -4516,6 +4516,7 @@ static void DemoWindowWidgetsTreeNodes()
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Framed", &base_flags, ImGuiTreeNodeFlags_Framed); ImGui::SameLine(); HelpMarker("Draw frame with background (e.g. for CollapsingHeader)");
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_FramePadding", &base_flags, ImGuiTreeNodeFlags_FramePadding);
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NavLeftJumpsToParent", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsToParent);
+ ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Bullet", &base_flags, ImGuiTreeNodeFlags_Bullet);
HelpMarker("Default option for DrawLinesXXX is stored in style.TreeLinesFlags");
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_DrawLinesNone", &base_flags, ImGuiTreeNodeFlags_DrawLinesNone);
@@ -8916,6 +8917,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
SliderFloat("ImageRounding", &style.ImageRounding, 0.0f, 12.0f, "%.0f");
SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, max_border_size, "%.0f");
+ SeparatorText("Symbols");
+ DragFloat2("SymbolArrowSizeFactor", &style.SymbolArrowSizeFactor.x, 0.01f, 0.0f, 1.0f);
+ DragFloat("SymbolArrowThicknessFactor", &style.SymbolArrowThicknessFactor, 0.01f, 0.0f, 0.5f);
+
SeparatorText("Docking");
//SetCursorPosX(GetCursorPosX() + CalcItemWidth() - GetFrameHeight());
Checkbox("DockingNodeHasCloseButton", &style.DockingNodeHasCloseButton);
@@ -9325,8 +9330,8 @@ struct ExampleAppConsole
}
// Portable helpers
- static int Stricmp(const char* s1, const char* s2) { int d; while ((d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; } return d; }
- static int Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; n--; } return d; }
+ static int Stricmp(const char* s1, const char* s2) { int d; while ((d = toupper(*s1) - toupper(*s2)) == 0 && *s1) { s1++; s2++; } return d; }
+ static int Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s1) - toupper(*s2)) == 0 && *s1) { s1++; s2++; n--; } return d; }
static char* Strdup(const char* s) { IM_ASSERT(s); size_t len = strlen(s) + 1; void* buf = ImGui::MemAlloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)s, len); }
static void Strtrimblanks(char* s) { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; }
diff --git a/imgui_draw.cpp b/imgui_draw.cpp
index 6103b353f..aa4bc4966 100644
--- a/imgui_draw.cpp
+++ b/imgui_draw.cpp
@@ -191,7 +191,7 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst)
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_TextDisabled] = ImVec4(0.58f, 0.58f, 0.58f, 1.00f);
- colors[ImGuiCol_WindowBg] = ImVec4(0.18f, 0.18f, 0.18f, 1.00f);
+ colors[ImGuiCol_WindowBg] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f);
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
@@ -6162,7 +6162,7 @@ static ImFontGlyph* ImFontBaked_BuildLoadGlyph(ImFontBaked* baked, ImWchar codep
return NULL;
}
-static float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint)
+float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint)
{
if (baked->Size >= IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE || baked->LoadNoRenderOnLayout)
{
@@ -7558,7 +7558,6 @@ begin:
// - RenderBullet()
// - RenderCheckMark()
// - RenderArrowDockMenu()
-// - RenderArrowPointingAt()
// - RenderRectFilledInRangeH()
// - RenderRectFilledWithHole()
//-----------------------------------------------------------------------------
@@ -7566,36 +7565,47 @@ begin:
// - RenderColorRectWithAlphaCheckerboard()
//-----------------------------------------------------------------------------
-// Render an arrow aimed to be aligned with text (p_min is a position in the same space text would be positioned). To e.g. denote expanded/collapsed state
+static const ImVec2 g_ImGuiDirCosSin[4] = { { -1.0f, 0.0f }, { +1.0f, 0.0f }, { 0.0f, -1.0f }, { 0.0f, +1.0f } };
+
+// arrow_h, arrow_w, arrow_th are normalized: 0.0f..1.0f
+// arrow_th: 0.0f == fill, >0.0f == stroke weight.
+void ImGui::RenderArrowEx(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float cos_a, float sin_a, float scale, ImVec2 arrow_sizes, float arrow_th)
+{
+ const bool is_fill = (arrow_th <= 0.0f);
+ const float r = draw_list->_Data->FontSize * 0.50f * scale;
+ const float thickness = is_fill ? 0.0f : IM_ROUND(ImClamp(r * arrow_th, 1.0f, r * 0.5f));
+
+ // Bias for shape to feel more centered
+ const float bias = is_fill ? (r * 0.05f) : (thickness * 0.8f * 0.7071f);
+ const ImVec2 center = ImVec2(pos.x + r + bias * cos_a, pos.y + r + bias * sin_a);
+
+ const float arrow_h = arrow_sizes.y * r;
+ const float arrow_w = arrow_sizes.x * r;
+ ImVec2 p[3];
+ p[0] = ImVec2(center.x - arrow_h * cos_a - arrow_w * -sin_a, center.y - arrow_h * sin_a - arrow_w * cos_a);
+ p[1] = ImVec2(center.x + arrow_h * cos_a, center.y + arrow_h * sin_a);
+ p[2] = ImVec2(center.x - arrow_h * cos_a + arrow_w * -sin_a, center.y - arrow_h * sin_a + arrow_w * cos_a);
+
+ // Pixel align when at a right angle
+ if (is_fill && (cos_a * sin_a >= -FLT_EPSILON) && (cos_a * sin_a <= FLT_EPSILON))
+ {
+ p[0] = ImRoundSigned64(p[0]);
+ p[1] = ImRoundSigned64(p[1]);
+ p[2] = ImRoundSigned64(p[2]);
+ }
+
+ if (is_fill)
+ draw_list->AddConvexPolyFilled(p, 3, col);
+ else
+ draw_list->_AddPolyline(p, 3, col, thickness, ImDrawFlags_StrokeInside | ImDrawFlags_AALineEnds, FLT_MAX); // FIXME-OPT: baked filled shape?
+}
+
+// Render an arrow aimed to be aligned with text.
void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale)
{
- const float h = draw_list->_Data->FontSize * 1.00f;
- float r = h * 0.40f * scale;
- ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale);
-
- ImVec2 a, b, c;
- switch (dir)
- {
- case ImGuiDir_Up:
- case ImGuiDir_Down:
- if (dir == ImGuiDir_Up) r = -r;
- a = ImVec2(+0.000f, +0.750f) * r;
- b = ImVec2(-0.866f, -0.750f) * r;
- c = ImVec2(+0.866f, -0.750f) * r;
- break;
- case ImGuiDir_Left:
- case ImGuiDir_Right:
- if (dir == ImGuiDir_Left) r = -r;
- a = ImVec2(+0.750f, +0.000f) * r;
- b = ImVec2(-0.750f, +0.866f) * r;
- c = ImVec2(-0.750f, -0.866f) * r;
- break;
- case ImGuiDir_None:
- case ImGuiDir_COUNT:
- IM_ASSERT(0);
- break;
- }
- draw_list->AddTriangleFilled(center + a, center + b, center + c, col);
+ ImGuiContext& g = *GImGui;
+ ImVec2 cos_sin = g_ImGuiDirCosSin[dir];
+ RenderArrowEx(draw_list, pos, col, cos_sin.x, cos_sin.y, scale, g.Style.SymbolArrowSizeFactor, g.Style.SymbolArrowThicknessFactor);
}
void ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col)
@@ -7620,19 +7630,6 @@ void ImGui::RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float
draw_list->PathStroke(col, thickness, ImDrawFlags_AALineEnds);
}
-// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
-void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)
-{
- switch (direction)
- {
- case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return;
- case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;
- case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return;
- case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;
- case ImGuiDir_None: case ImGuiDir_COUNT: break; // Fix warnings
- }
-}
-
// This is less wide than RenderArrow() and we use in dock nodes instead of the regular RenderArrow() to denote a change of functionality,
// and because the saved space means that the left-most tab label can stay at exactly the same position as the label of a loose window.
void ImGui::RenderArrowDockMenu(ImDrawList* draw_list, ImVec2 p_min, float sz, ImU32 col)
diff --git a/imgui_internal.h b/imgui_internal.h
index a58fed8a1..5014eb6c8 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -560,6 +560,7 @@ inline ImVec2 ImFloor(const ImVec2& v) { return
inline float ImTrunc64(float f) { return (float)(ImS64)(f); }
inline float ImRoundPositive64(float f) { return (float)(ImS64)(f + 0.5f); } // Positive values only.
inline float ImRoundSigned64(float f) { return (float)(ImS64)(f >= 0.0f ? f + 0.5f : f - 0.5f); }
+inline ImVec2 ImRoundSigned64(const ImVec2& v) { return ImVec2((float)(ImS64)(v.x >= 0.0f ? v.x + 0.5f : v.x - 0.5f), (float)(ImS64)(v.y >= 0.0f ? v.y + 0.5f : v.y - 0.5f)); }
inline float ImCeilFast(float f) { int i = (int)f; return (float)(i + (f > (float)i)); } // Consider using the bit-hack version (search for "0x1p120f").
inline int ImModPositive(int a, int b) { return (a + b) % b; }
inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
@@ -3169,7 +3170,7 @@ struct ImGuiTabItem
ImGuiID ID;
ImGuiTabItemFlags Flags;
ImGuiWindow* Window; // When TabItem is part of a DockNode's TabBar, we hold on to a window.
- int LastFrameVisible;
+ int LastFrameVisible; // TabItem visibility (not contents visibility)
int LastFrameSelected; // This allows us to infer an ordered list of the last activated tabs with little maintenance
float Offset; // Position relative to beginning of tab bar
float Width; // Width currently displayed
@@ -3179,6 +3180,7 @@ struct ImGuiTabItem
ImS16 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable
ImS16 IndexDuringLayout; // Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions.
bool WantClose; // Marked as closed by SetTabItemClosed()
+ bool ContentsIsVisible;
ImGuiTabItem() { memset((void*)this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; }
};
@@ -3193,7 +3195,7 @@ struct IMGUI_API ImGuiTabBar
ImGuiID SelectedTabId; // Selected tab/window
ImGuiID NextSelectedTabId; // Next selected tab/window. Will also trigger a scrolling animation
ImGuiID NextScrollToTabId;
- ImGuiID VisibleTabId; // Can occasionally be != SelectedTabId (e.g. when previewing contents for Ctrl+Tab preview)
+ ImGuiID VisibleTabContentsId; // Can occasionally be != SelectedTabId (e.g. when previewing contents for Ctrl+Tab preview)
int CurrFrameVisible;
int PrevFrameVisible;
ImRect BarRect;
@@ -3215,6 +3217,7 @@ struct IMGUI_API ImGuiTabBar
ImS8 BeginCount;
bool WantLayout;
bool VisibleTabWasSubmitted;
+ bool LastTabItemContentsAppearing;
bool TabsAddedNew; // Set to true when a new tab item or button has been added to the tab bar during last frame
bool ScrollButtonEnabled;
ImS16 TabsActiveCount; // Number of tabs submitted this frame.
@@ -4069,6 +4072,7 @@ namespace ImGui
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, ImVec2 mouse_pos);
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);
IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window);
+ IMGUI_API bool TabItemIsContentsAppearing();
IMGUI_API void TabItemSpacing(const char* str_id, ImGuiTabItemFlags flags, float width);
IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker);
IMGUI_API ImVec2 TabItemCalcSize(ImGuiWindow* window);
@@ -4096,9 +4100,9 @@ namespace ImGui
// Render helpers (those functions don't access any ImGui state!)
IMGUI_API void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale = 1.0f);
+ IMGUI_API void RenderArrowEx(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float cos_a, float sin_a, float scale, ImVec2 arrow_sizes, float arrow_th);
IMGUI_API void RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col);
IMGUI_API void RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz);
- IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col);
IMGUI_API void RenderArrowDockMenu(ImDrawList* draw_list, ImVec2 p_min, float sz, ImU32 col);
IMGUI_API void RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float fill_x0, float fill_x1, float rounding);
IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding);
@@ -4429,6 +4433,8 @@ IMGUI_API void ImFontAtlasBakedAddFontGlyphAdvancedX(ImFontAtlas* a
IMGUI_API void ImFontAtlasBakedDiscardFontGlyph(ImFontAtlas* atlas, ImFont* font, ImFontBaked* baked, ImFontGlyph* glyph);
IMGUI_API void ImFontAtlasBakedSetFontGlyphBitmap(ImFontAtlas* atlas, ImFontBaked* baked, ImFontConfig* src, ImFontGlyph* glyph, ImTextureRect* r, const unsigned char* src_pixels, ImTextureFormat src_fmt, int src_pitch);
+IMGUI_API float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint);
+
IMGUI_API void ImFontAtlasPackInit(ImFontAtlas* atlas);
IMGUI_API ImFontAtlasRectId ImFontAtlasPackAddRect(ImFontAtlas* atlas, int w, int h, ImFontAtlasRectEntry* overwrite_entry = NULL);
IMGUI_API ImTextureRect* ImFontAtlasPackGetRect(ImFontAtlas* atlas, ImFontAtlasRectId id);
diff --git a/imgui_tables.cpp b/imgui_tables.cpp
index ee208d160..e82c71dfb 100644
--- a/imgui_tables.cpp
+++ b/imgui_tables.cpp
@@ -3435,7 +3435,7 @@ void ImGui::TableHeader(const char* label)
PopStyleColor();
x += w_sort_text;
}
- RenderArrow(window->DrawList, ImVec2(x, y), GetColorU32(ImGuiCol_Text), column->SortDirection == ImGuiSortDirection_Ascending ? ImGuiDir_Up : ImGuiDir_Down, ARROW_SCALE);
+ RenderArrow(window->DrawList, ImVec2(x + (g.FontSize * (1.0f - ARROW_SCALE) * 0.5f) , y), GetColorU32(ImGuiCol_Text), column->SortDirection == ImGuiSortDirection_Ascending ? ImGuiDir_Up : ImGuiDir_Down, ARROW_SCALE);
}
// Handle clicking on column header to adjust Sort Order
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index 494c3f64d..6e3e494a9 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -6183,14 +6183,23 @@ bool ImGui::ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags fl
return true;
}
+// Helper for RenderArrowsForVerticalBar(). 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
+static void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 p, ImVec2 half_sz, ImGuiDir direction, ImU32 col)
+{
+ if (direction == ImGuiDir_Left) { draw_list->AddTriangleFilled(ImVec2(p.x + half_sz.x, p.y - half_sz.y), ImVec2(p.x + half_sz.x, p.y + half_sz.y), p, col); }
+ if (direction == ImGuiDir_Right) { draw_list->AddTriangleFilled(ImVec2(p.x - half_sz.x, p.y + half_sz.y), ImVec2(p.x - half_sz.x, p.y - half_sz.y), p, col); }
+ //if (direction == ImGuiDir_Up) { draw_list->AddTriangleFilled(ImVec2(p.x + half_sz.x, p.y + half_sz.y), ImVec2(p.x - half_sz.x, p.y + half_sz.y), p, col); }
+ //if (direction == ImGuiDir_Down){ draw_list->AddTriangleFilled(ImVec2(p.x - half_sz.x, p.y - half_sz.y), ImVec2(p.x + half_sz.x, p.y - half_sz.y), p, col); }
+}
+
// Helper for ColorPicker4()
-static void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w, float alpha)
+static void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 p, ImVec2 half_sz, float bar_w, float alpha)
{
ImU32 alpha8 = IM_F32_TO_INT8_SAT(alpha);
- ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32(0,0,0,alpha8));
- ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, ImGuiDir_Right, IM_COL32(255,255,255,alpha8));
- ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left, IM_COL32(0,0,0,alpha8));
- ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, ImGuiDir_Left, IM_COL32(255,255,255,alpha8));
+ RenderArrowPointingAt(draw_list, ImVec2(p.x + half_sz.x + 1, p.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32(0,0,0,alpha8));
+ RenderArrowPointingAt(draw_list, ImVec2(p.x + half_sz.x, p.y), half_sz, ImGuiDir_Right, IM_COL32(255,255,255,alpha8));
+ RenderArrowPointingAt(draw_list, ImVec2(p.x + bar_w - half_sz.x - 1, p.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left, IM_COL32(0,0,0,alpha8));
+ RenderArrowPointingAt(draw_list, ImVec2(p.x + bar_w - half_sz.x, p.y), half_sz, ImGuiDir_Left, IM_COL32(255,255,255,alpha8));
}
// Note: ColorPicker4() only accesses 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
@@ -6929,13 +6938,15 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char
return TreeNodeBehavior(id, flags, label, label_end);
}
-// The reason those two functions are not yet in public API is because I would like to design a more feature-full and generic API for this.
-// They are otherwise function (cc: #3823, #9251, #7553, #6754, #5423, #2958, #2079, #1947, #1131, #722)
-bool ImGui::TreeNodeGetOpen(ImGuiID storage_id)
+// I would like to design a more feature-full and generic API for this.
+// (cc: #3823, #9251, #7553, #6754, #5423, #2958, #2079, #1947, #1131, #722, #9569)
+bool ImGui::TreeNodeGetOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags)
{
+ if (flags & ImGuiTreeNodeFlags_Leaf)
+ return true;
ImGuiContext& g = *GImGui;
ImGuiStorage* storage = g.CurrentWindow->DC.StateStorage;
- return storage->GetInt(storage_id, 0) != 0;
+ return storage->GetInt(storage_id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0;
}
void ImGui::TreeNodeSetOpen(ImGuiID storage_id, bool is_open)
@@ -7037,9 +7048,10 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
label_end = FindRenderedTextEnd(label);
const ImVec2 label_size = CalcTextSize(label, label_end, false);
- const float text_offset_x = g.FontSize + (display_frame ? padding.x * 3 : padding.x * 2); // Collapsing arrow width + Spacing
+ const float icon_width = g.FontSize + padding.x * 2;
+ const float text_offset_x = display_frame ? icon_width + padding.x : icon_width; // Collapsing arrow width + Spacing
const float text_offset_y = use_frame_padding ? ImMax(style.FramePadding.y, window->DC.CurrLineTextBaseOffset) : window->DC.CurrLineTextBaseOffset; // Latch before ItemSize changes it
- const float text_width = g.FontSize + label_size.x + padding.x * 2; // Include collapsing arrow
+ const float text_width = icon_width + label_size.x; // Include collapsing arrow
const float frame_height = label_size.y + padding.y * 2;
const bool span_all_columns = (flags & ImGuiTreeNodeFlags_SpanAllColumns) != 0 && (g.CurrentTable != NULL);
@@ -7072,6 +7084,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
if (span_all_columns || span_all_columns_label)
{
// Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable..
+ // FIXME: Investigate moving this to an item flag, along duplicate code in Selectable(). How to do optimally?
const float backup_clip_rect_min_x = window->ClipRect.Min.x;
const float backup_clip_rect_max_x = window->ClipRect.Max.x;
window->ClipRect.Min.x = window->ParentWorkRect.Min.x;
@@ -7279,7 +7292,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
if (flags & ImGuiTreeNodeFlags_Bullet)
RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.5f, text_pos.y + g.FontSize * 0.5f), text_col);
else if (!is_leaf)
- RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ((flags & ImGuiTreeNodeFlags_UpsideDownArrow) ? ImGuiDir_Up : ImGuiDir_Down) : ImGuiDir_Right, 0.70f);
+ RenderArrow(window->DrawList, ImVec2(text_pos.x + g.FontSize * 0.15f - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ((flags & ImGuiTreeNodeFlags_UpsideDownArrow) ? ImGuiDir_Up : ImGuiDir_Down) : ImGuiDir_Right, 0.70f);
if (g.LogEnabled)
LogSetNextTextDecoration(">", NULL);
}
@@ -10073,7 +10086,7 @@ void ImGui::EndTabBar()
// Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed().
const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
- if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabId == 0 || tab_bar_appearing)
+ if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabContentsId == 0 || tab_bar_appearing)
{
tab_bar->CurrTabsContentsHeight = ImMax(window->DC.CursorPos.y - tab_bar->BarRect.Max.y, tab_bar->CurrTabsContentsHeight);
window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->CurrTabsContentsHeight;
@@ -10121,7 +10134,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
if (tab->LastFrameVisible < tab_bar->PrevFrameVisible || tab->WantClose)
{
// Remove tab
- if (tab_bar->VisibleTabId == tab->ID) { tab_bar->VisibleTabId = 0; }
+ if (tab_bar->VisibleTabContentsId == tab->ID) { tab_bar->VisibleTabContentsId = 0; }
if (tab_bar->SelectedTabId == tab->ID) { tab_bar->SelectedTabId = 0; }
if (tab_bar->NextSelectedTabId == tab->ID) { tab_bar->NextSelectedTabId = 0; }
continue;
@@ -10326,12 +10339,12 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
scroll_to_tab_id = tab_bar->SelectedTabId = most_recently_selected_tab->ID;
// Lock in visible tab
- tab_bar->VisibleTabId = tab_bar->SelectedTabId;
- tab_bar->VisibleTabWasSubmitted = false;
+ tab_bar->VisibleTabContentsId = tab_bar->SelectedTabId;
+ tab_bar->VisibleTabWasSubmitted = tab_bar->LastTabItemContentsAppearing = false;
// CTRL+TAB can override visible tab temporarily
if (g.NavWindowingTarget != NULL && g.NavWindowingTarget->DockNode && g.NavWindowingTarget->DockNode->TabBar == tab_bar)
- tab_bar->VisibleTabId = scroll_to_tab_id = g.NavWindowingTarget->TabId;
+ tab_bar->VisibleTabContentsId = scroll_to_tab_id = g.NavWindowingTarget->TabId;
// Apply request requests
if (scroll_to_tab_id != 0)
@@ -10481,9 +10494,9 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
{
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
tab_bar->Tabs.erase(tab);
- if (tab_bar->VisibleTabId == tab_id) { tab_bar->VisibleTabId = 0; }
- if (tab_bar->SelectedTabId == tab_id) { tab_bar->SelectedTabId = 0; }
- if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; }
+ if (tab_bar->VisibleTabContentsId == tab_id){ tab_bar->VisibleTabContentsId = 0; }
+ if (tab_bar->SelectedTabId == tab_id) { tab_bar->SelectedTabId = 0; }
+ if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; }
}
// Called on manual closure attempt
@@ -10497,7 +10510,7 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
// This will remove a frame of lag for selecting another tab on closure.
// However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure
tab->WantClose = true;
- if (tab_bar->VisibleTabId == tab->ID)
+ if (tab_bar->VisibleTabContentsId == tab->ID)
{
tab->LastFrameVisible = -1;
tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;
@@ -10506,7 +10519,7 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
else
{
// Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup)
- if (tab_bar->VisibleTabId != tab->ID)
+ if (tab_bar->VisibleTabContentsId != tab->ID)
TabBarQueueFocus(tab_bar, tab);
}
}
@@ -10797,6 +10810,12 @@ void ImGui::EndTabItem()
PopID();
}
+bool ImGui::TabItemIsContentsAppearing()
+{
+ ImGuiContext& g = *GImGui;
+ return g.CurrentTabBar->LastTabItemContentsAppearing;
+}
+
bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags)
{
ImGuiContext& g = *GImGui;
@@ -10911,21 +10930,24 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
TabBarQueueFocus(tab_bar, tab);
}
+ // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches
+ if (tab_bar->VisibleTabContentsId == 0 && tab_bar->SelectedTabId == 0 && tab_bar_appearing && docked_window == NULL)
+ if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs))
+ tab_bar->VisibleTabContentsId = id;
+
// Lock visibility
// (Note: tab_contents_visible != tab_selected... because Ctrl+Tab operations may preview some tabs without selecting them!)
- bool tab_contents_visible = (tab_bar->VisibleTabId == id);
+ const bool tab_contents_visible = (tab_bar->VisibleTabContentsId == id);
if (tab_contents_visible)
tab_bar->VisibleTabWasSubmitted = true;
-
- // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches
- if (!tab_contents_visible && tab_bar->SelectedTabId == 0 && tab_bar_appearing && docked_window == NULL)
- if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs))
- tab_contents_visible = true;
+ tab_bar->LastTabItemContentsAppearing = tab_contents_visible && !tab->ContentsIsVisible;
+ tab->ContentsIsVisible = tab_contents_visible;
// Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted
// and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'.
if (tab_appearing && (!tab_bar_appearing || tab_is_new))
{
+ // This path doesn't render the tab.
ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav);
if (is_tab_button)
return false;