diff --git a/libs/filagui/src/ImGuiExtensions.cpp b/libs/filagui/src/ImGuiExtensions.cpp
index 89b5944d40e..0c1677c9f78 100644
--- a/libs/filagui/src/ImGuiExtensions.cpp
+++ b/libs/filagui/src/ImGuiExtensions.cpp
@@ -119,7 +119,7 @@ static void PlotEx(ImGuiPlotType plot_type, const char* label, int series_count,
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));
ImGui::ItemSize(total_bb, style.FramePadding.y);
if (!ImGui::ItemAdd(total_bb, 0, &frame_bb)) return;
- const bool hovered = ImGui::ItemHoverable(inner_bb, 0);
+ const bool hovered = ImGui::ItemHoverable(inner_bb, 0, g.LastItemData.InFlags);
// Determine scale from values if not specified
if (scale_min == FLT_MAX || scale_max == FLT_MAX) {
diff --git a/libs/filamentapp/src/FilamentApp.cpp b/libs/filamentapp/src/FilamentApp.cpp
index 7e315b0da47..1015c16c985 100644
--- a/libs/filamentapp/src/FilamentApp.cpp
+++ b/libs/filamentapp/src/FilamentApp.cpp
@@ -196,7 +196,7 @@ void FilamentApp::run(const Config& config, SetupCallback setupCallback,
SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
SDL_GetWindowWMInfo(window->getSDLWindow(), &wmInfo);
- io.ImeWindowHandle = wmInfo.info.win.window;
+ ImGui::GetMainViewport()->PlatformHandleRaw = wmInfo.info.win.window;
#endif
io.KeyMap[ImGuiKey_Tab] = SDL_SCANCODE_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = SDL_SCANCODE_LEFT;
diff --git a/third_party/imgui/.editorconfig b/third_party/imgui/.editorconfig
index 284ba13fe3e..5adfefa20d8 100644
--- a/third_party/imgui/.editorconfig
+++ b/third_party/imgui/.editorconfig
@@ -1,6 +1,12 @@
# 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
+# - In theory automatically supported by VS2017+ and most common IDE or text editors.
+# - In practice VS2019-VS2022 stills don't trim trailing whitespaces correctly :(
+# - Suggest installing this to trim whitespaces:
+# GitHub https://github.com/madskristensen/TrailingWhitespace
+# VS2019 https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TrailingWhitespaceVisualizer
+# VS2022 https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TrailingWhitespace64
+# (in spite of its name doesn't only visualize but also trims)
+# - Alternative for older VS2010 to VS2015: https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig
# top-most EditorConfig file
root = true
diff --git a/third_party/imgui/.github/FUNDING.yml b/third_party/imgui/.github/FUNDING.yml
new file mode 100644
index 00000000000..2aa08b4474c
--- /dev/null
+++ b/third_party/imgui/.github/FUNDING.yml
@@ -0,0 +1 @@
+custom: ['https://github.com/ocornut/imgui/wiki/Sponsors']
diff --git a/third_party/imgui/.github/ISSUE_TEMPLATE/config.yml b/third_party/imgui/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000000..3ba13e0cec6
--- /dev/null
+++ b/third_party/imgui/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1 @@
+blank_issues_enabled: false
diff --git a/third_party/imgui/.github/ISSUE_TEMPLATE/issue_template.yml b/third_party/imgui/.github/ISSUE_TEMPLATE/issue_template.yml
new file mode 100644
index 00000000000..792d8f63ed4
--- /dev/null
+++ b/third_party/imgui/.github/ISSUE_TEMPLATE/issue_template.yml
@@ -0,0 +1,90 @@
+name: "Ask a question, report a bug, request a feature, etc."
+description: "Ask any question, discuss best practices, report a bug, request a feature."
+body:
+ - type: markdown
+ attributes:
+ value: |
+ FOR FIRST-TIME USERS ISSUES COMPILING/LINKING/RUNNING or LOADING FONTS, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions)
+ For anything else: we are happy to use 'GitHub Issues' for many types of open-ended questions. We are encouraging 'Issues' becoming a large, centralized and cross-referenced database of Dear ImGui contents.
+
+ Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
+ - type: markdown
+ attributes:
+ value: |
+ **Prerequisites:**
+ - I have read [Frequently Asked Questions](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md).
+ - I have read [Contributing Guidelines -> General Advices](https://github.com/ocornut/imgui/blob/master/docs/CONTRIBUTING.md#getting-started--general-advice).
+ - I have read [Contributing Guidelines -> How to open an Issue](https://github.com/ocornut/imgui/blob/master/docs/CONTRIBUTING.md#how-to-open-an-issue).
+ - I have searched [Github Issues and PR](https://github.com/ocornut/imgui/issues?q=) for discussion of similar topics.
+
+ ----
+ - type: input
+ id: specs_version
+ attributes:
+ label: "Version/Branch of Dear ImGui:"
+ description: "(please specify if you have made substantial modifications to your copy)"
+ value: "Version 1.XX, Branch: XXX (master/docking/etc.)"
+ placeholder: "Version 1.XX, Branch: XXX (master/docking/etc.)"
+ validations:
+ required: true
+ - type: input
+ id: specs_backend
+ attributes:
+ label: "Back-ends:"
+ description: (or specify when using custom engine/back-ends)
+ value: "imgui_impl_XXX.cpp + imgui_impl_XXX.cpp"
+ placeholder: "imgui_impl_XXX.cpp + imgui_impl_XXX.cpp or n/a"
+ validations:
+ required: true
+ - type: input
+ id: specs_compiler_os
+ attributes:
+ label: "Compiler, OS:"
+ placeholder: "e.g. Windows 11 + MSVC 2022, macOS + Clang 12, Linux + GCC etc."
+ validations:
+ required: true
+ - type: textarea
+ id: specs_full
+ attributes:
+ label: "Full config/build information:"
+ placeholder: |
+ (If you can run, you may go to 'Demo->Tools->About Dear ImGui->Config/Build Info' to obtain detailed information that you can paste here)
+ validations:
+ required: false
+ - type: textarea
+ id: issue_description
+ attributes:
+ label: "Details:"
+ description: "Try to be explicit with your goals, your expectations and what you have tried. Be mindful of [The XY Problem](https://xyproblem.info). What you have in mind or in your code is not obvious to other people. People frequently discuss problems and suggest incorrect solutions without first clarifying their goals. When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.). If you tried something and it failed, show us what you tried. If you are reporting a bug, explain what's the bug, how does it occur, etc. If you are reporting a crash, please include a debugger callstack."
+ value: |
+ **My Issue/Question:**
+
+ XXX _(please provide as much context as possible)_
+ validations:
+ required: true
+ - type: textarea
+ id: screenshots
+ attributes:
+ label: "Screenshots/Video:"
+ description: "Attach screenshots or gif/videos to clarify the context. They often convey useful information that is omitted by the description."
+ placeholder: "(You can drag files here)"
+ validations:
+ required: false
+ - type: textarea
+ id: repro_code
+ attributes:
+ label: "Minimal, Complete and Verifiable Example code:"
+ description: "Provide an [MCVE](https://stackoverflow.com/help/mcve) to demonstrate your problem. An ideal submission includes a small piece of code that anyone can paste into one of the examples applications (examples/*/main.cpp) or the demo (imgui_demo.cpp) to understand and reproduce it. Narrowing your problem to its shortest and purest form is the easiest way to understand it, explain it and fix it. Please test your shortened code to ensure it exhibits the problem. Often while creating the MCVE you will solve the problem! Many questions that are missing a standalone verifiable example are missing the actual cause of their issue in the description, which ends up wasting everyone's time."
+ value: |
+ ```cpp
+ // Here's some code anyone can copy and paste to reproduce your issue
+ ImGui::Begin("Example Bug");
+ MoreCodeToExplainMyIssue();
+ ImGui::End();
+ ```
+ validations:
+ required: false
+ - type: markdown
+ attributes:
+ value: |
+ Thank you for taking the time to read prerequisites, filling this template and double-checking your message and your code!
diff --git a/third_party/imgui/.github/issue_template.md b/third_party/imgui/.github/issue_template.md
deleted file mode 100644
index 3812ad0b015..00000000000
--- a/third_party/imgui/.github/issue_template.md
+++ /dev/null
@@ -1,46 +0,0 @@
-(Click "Preview" above ^ to turn URL into clickable links)
-
-1. PLEASE CAREFULLY READ: [FAQ](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md)
-
-2. PLEASE CAREFULLY READ: [Issue Submitting Guidelines](https://github.com/ocornut/imgui/issues/2261)
-
-3. FOR FIRST-TIME USERS ISSUES COMPILING/LINKING/RUNNING/LOADING FONTS, please use the [Discord server](http://discord.dearimgui.org).
-
-4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the link provided in (1) (2).
-
-5. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
-
-6. Delete points 1-6 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue.
-
-Thank you!
-
-----
-
-_(you may also go to Demo>About Window, and click "Config/Build Information" to obtain a bunch of detailed information that you can paste here)_
-
-**Version/Branch of Dear ImGui:**
-
-Version: XXX
-Branch: XXX _(master/viewport/docking/etc.)_
-
-**Back-end/Renderer/Compiler/OS**
-
-Back-ends: imgui_impl_XXX.cpp + imgui_impl_XXX.cpp _(or specify if using a custom engine/back-end)_
-Compiler: XXX _(if the question is related to building or platform specific features)_
-Operating System: XXX
-
-**My Issue/Question:**
-
-XXX _(please provide as much context as possible)_
-
-**Screenshots/Video**
-
-XXX _(you can drag files here)_
-
-**Standalone, minimal, complete and verifiable example:** _(see https://github.com/ocornut/imgui/issues/2261)_
-```
-// Here's some code anyone can copy and paste to reproduce your issue
-ImGui::Begin("Example Bug");
-MoreCodeToExplainMyIssue();
-ImGui::End();
-```
diff --git a/third_party/imgui/.github/pull_request_template.md b/third_party/imgui/.github/pull_request_template.md
index 533027c9ad6..638545bd6d3 100644
--- a/third_party/imgui/.github/pull_request_template.md
+++ b/third_party/imgui/.github/pull_request_template.md
@@ -1,6 +1,6 @@
(Click "Preview" to turn any http URL into a clickable link)
-PLEASE CAREFULLY READ:
-https://github.com/ocornut/imgui/issues/2261
+1. PLEASE CAREFULLY READ: [Contributing Guidelines](https://github.com/ocornut/imgui/blob/master/docs/CONTRIBUTING.md)
+
+2. Clear this template before submitting your PR.
-(Clear this template before submitting your PR)
diff --git a/third_party/imgui/.github/workflows/build.yml b/third_party/imgui/.github/workflows/build.yml
index 8edef47bf64..d332903ed0d 100644
--- a/third_party/imgui/.github/workflows/build.yml
+++ b/third_party/imgui/.github/workflows/build.yml
@@ -1,10 +1,18 @@
name: build
on:
- push: {}
- pull_request: {}
- schedule:
- - cron: '0 9 * * *'
+ push:
+ pull_request:
+ workflow_run:
+ # Use a workflow as a trigger of scheduled builds. Forked repositories can disable scheduled builds by disabling
+ # "scheduled" workflow, while maintaining ability to perform local CI builds.
+ workflows:
+ - scheduled
+ branches:
+ - master
+ - docking
+ types:
+ - requested
jobs:
Windows:
@@ -12,73 +20,92 @@ jobs:
env:
VS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\
MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
- # Until gh-actions allow us to use env variables inside other env variables (because we need %GITHUB_WORKSPACE%) we have to use relative path to imgui/examples/example_name directory.
- SDL2_DIR: ..\..\SDL2-devel-2.0.10-VC\SDL2-2.0.10\
- VULKAN_SDK: ..\..\vulkan-sdk-1.1.121.2\
steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
+ - uses: actions/checkout@v4
- name: Install Dependencies
shell: powershell
run: |
- Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.0.10-VC.zip" -OutFile "SDL2-devel-2.0.10-VC.zip"
- Expand-Archive -Path SDL2-devel-2.0.10-VC.zip
+ Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.26.3-VC.zip" -OutFile "SDL2-devel-2.26.3-VC.zip"
+ Expand-Archive -Path SDL2-devel-2.26.3-VC.zip
+ echo "SDL2_DIR=$(pwd)\SDL2-devel-2.26.3-VC\SDL2-2.26.3\" >>${env:GITHUB_ENV}
+
Invoke-WebRequest -Uri "https://github.com/ocornut/imgui/files/3789205/vulkan-sdk-1.1.121.2.zip" -OutFile vulkan-sdk-1.1.121.2.zip
Expand-Archive -Path vulkan-sdk-1.1.121.2.zip
+ echo "VULKAN_SDK=$(pwd)\vulkan-sdk-1.1.121.2\" >>${env:GITHUB_ENV}
- name: Fix Projects
shell: powershell
run: |
- # WARNING: This will need updating if toolset/sdk change in project files!
+ # CI workers do not supporter older Visual Studio versions. Fix projects to target newer available version.
gci -recurse -filter "*.vcxproj" | ForEach-Object {
- # Fix SDK and toolset for most samples.
- (Get-Content $_.FullName) -Replace "v110","v142" | Set-Content -Path $_.FullName
- (Get-Content $_.FullName) -Replace "8.1","10.0.18362.0" | Set-Content -Path $_.FullName
- # Fix SDK and toolset for samples that require newer SDK/toolset. At the moment it is only dx12.
- (Get-Content $_.FullName) -Replace "v140","v142" | Set-Content -Path $_.FullName
- (Get-Content $_.FullName) -Replace "10.0.14393.0","10.0.18362.0" | Set-Content -Path $_.FullName
+ (Get-Content $_.FullName) -Replace "v\d{3}","v142" | Set-Content -Path $_.FullName
+ (Get-Content $_.FullName) -Replace "[\d\.]+","10.0.18362.0" | Set-Content -Path $_.FullName
}
# Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long.
- name: Build example_null (extra warnings, mingw 64-bit)
run: mingw32-make -C examples/example_null WITH_EXTRA_WARNINGS=1
+ - name: Build example_null (mingw 64-bit, as DLL)
+ shell: bash
+ run: |
+ echo '#ifdef _EXPORT' > example_single_file.cpp
+ echo '# define IMGUI_API __declspec(dllexport)' >> example_single_file.cpp
+ echo '#else' >> example_single_file.cpp
+ echo '# define IMGUI_API __declspec(dllimport)' >> example_single_file.cpp
+ echo '#endif' >> example_single_file.cpp
+ echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
+ echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
+ g++ -I. -Wall -Wformat -D_EXPORT -shared -o libimgui.dll -Wl,--out-implib,libimgui.a example_single_file.cpp -limm32
+ g++ -I. -Wall -Wformat -o example_null.exe examples/example_null/main.cpp -L. -limgui
+ rm -f example_null.exe libimgui.* example_single_file.*
+
- name: Build example_null (extra warnings, msvc 64-bit)
shell: cmd
run: |
cd examples\example_null
- "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64 && .\build_win32.bat /W4
+ call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
+ .\build_win32.bat /W4
- name: Build example_null (single file build)
shell: bash
run: |
- echo '#define IMGUI_IMPLEMENTATION' > example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32
- name: Build example_null (with IMGUI_DISABLE_WIN32_FUNCTIONS)
shell: bash
run: |
- echo '#define IMGUI_DISABLE_WIN32_FUNCTIONS' > example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_DISABLE_WIN32_FUNCTIONS
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32
- name: Build example_null (as DLL)
shell: cmd
run: |
- "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64
- echo '#ifdef _EXPORT' > example_single_file.cpp
- echo '# define IMGUI_API __declspec(dllexport)' >> example_single_file.cpp
- echo '#else' >> example_single_file.cpp
- echo '# define IMGUI_API __declspec(dllimport)' >> example_single_file.cpp
- echo '#endif' >> example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
+ call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
+
+ echo #ifdef _EXPORT > example_single_file.cpp
+ echo # define IMGUI_API __declspec(dllexport) >> example_single_file.cpp
+ echo #else >> example_single_file.cpp
+ echo # define IMGUI_API __declspec(dllimport) >> example_single_file.cpp
+ echo #endif >> example_single_file.cpp
+ echo #define IMGUI_IMPLEMENTATION >> example_single_file.cpp
+ echo #include "misc/single_file/imgui_single_file.h" >> example_single_file.cpp
+
cl.exe /D_USRDLL /D_WINDLL /D_EXPORT /I. example_single_file.cpp /LD /FeImGui.dll /link
cl.exe /I. ImGui.lib /Feexample_null.exe examples/example_null/main.cpp
@@ -89,31 +116,31 @@ jobs:
- name: Build Win32 example_glfw_opengl3
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- name: Build Win32 example_glfw_vulkan
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- - name: Build Win32 example_sdl_vulkan
+ - name: Build Win32 example_sdl2_vulkan
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
+ if: github.event_name == 'workflow_run'
- - name: Build Win32 example_sdl_opengl2
+ - name: Build Win32 example_sdl2_opengl2
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
+ if: github.event_name == 'workflow_run'
- - name: Build Win32 example_sdl_opengl3
+ - name: Build Win32 example_sdl2_opengl3
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
- - name: Build Win32 example_sdl_directx11
+ - name: Build Win32 example_sdl2_directx11
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
+ if: github.event_name == 'workflow_run'
- name: Build Win32 example_win32_directx9
shell: cmd
@@ -126,12 +153,12 @@ jobs:
- name: Build Win32 example_win32_directx11
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- name: Build x64 example_glfw_opengl2
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- name: Build x64 example_glfw_opengl3
shell: cmd
@@ -141,55 +168,53 @@ jobs:
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
- - name: Build x64 example_sdl_vulkan
+ - name: Build x64 example_sdl2_vulkan
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
+ if: github.event_name == 'workflow_run'
- - name: Build x64 example_sdl_opengl2
+ - name: Build x64 example_sdl2_opengl2
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
+ if: github.event_name == 'workflow_run'
- - name: Build x64 example_sdl_opengl3
+ - name: Build x64 example_sdl2_opengl3
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
+ if: github.event_name == 'workflow_run'
- - name: Build x64 example_sdl_directx11
+ - name: Build x64 example_sdl2_directx11
shell: cmd
- run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
+ run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
- name: Build x64 example_win32_directx9
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- name: Build x64 example_win32_directx10
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- name: Build x64 example_win32_directx11
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- name: Build x64 example_win32_directx12
shell: cmd
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release'
Linux:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-22.04
steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
+ - uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
- sudo apt-get install -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev
+ sudo apt-get install -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev libvulkan-dev
- name: Build example_null (extra warnings, gcc 32-bit)
run: |
@@ -211,6 +236,18 @@ jobs:
make -C examples/example_null clean
CXXFLAGS="$CXXFLAGS -m64 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1
+ - name: Build example_null (extra warnings, empty IM_ASSERT)
+ run: |
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IM_ASSERT(x)
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -Wextra -Werror -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros -Wno-empty-body -o example_single_file example_single_file.cpp
+
- name: Build example_null (freetype)
run: |
make -C examples/example_null clean
@@ -218,146 +255,203 @@ jobs:
- name: Build example_null (single file build)
run: |
- echo '#define IMGUI_IMPLEMENTATION' > example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- name: Build example_null (with ImWchar32)
run: |
- echo '#define IMGUI_USE_WCHAR32' > example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_USE_WCHAR32
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- - name: Build example_null (with large ImDrawIdx)
+ - name: Build example_null (with large ImDrawIdx + pointer ImTextureID)
run: |
- echo '#define ImDrawIdx unsigned int' > example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define ImTextureID void*
+ #define ImDrawIdx unsigned int
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- name: Build example_null (with IMGUI_DISABLE_OBSOLETE_FUNCTIONS)
run: |
- echo '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' > example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
+
+ - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_KEYIO)
+ run: |
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_DISABLE_OBSOLETE_KEYIO
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_METRICS_WINDOW)
+ - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_DEBUG_TOOLS)
run: |
- echo '#define IMGUI_DISABLE_DEMO_WINDOWS' > example_single_file.cpp
- echo '#define IMGUI_DISABLE_METRICS_WINDOW' >> example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_DISABLE_DEMO_WINDOWS
+ #define IMGUI_DISABLE_DEBUG_TOOLS
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- name: Build example_null (with IMGUI_DISABLE_FILE_FUNCTIONS)
run: |
- echo '#define IMGUI_DISABLE_FILE_FUNCTIONS' > example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_DISABLE_FILE_FUNCTIONS
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- name: Build example_null (with IMGUI_USE_BGRA_PACKED_COLOR)
run: |
- echo '#define IMGUI_USE_BGRA_PACKED_COLOR' > example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_USE_BGRA_PACKED_COLOR
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- name: Build example_null (with IM_VEC2_CLASS_EXTRA and IM_VEC4_CLASS_EXTRA)
run: |
- echo 'struct MyVec2 { float x; float y; MyVec2(float x, float y) : x(x), y(y) { } };' > example_single_file.cpp
- echo 'struct MyVec4 { float x; float y; float z; float w;' >> example_single_file.cpp
- echo 'MyVec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) { } };' >> example_single_file.cpp
- echo '#define IM_VEC2_CLASS_EXTRA \' >> example_single_file.cpp
- echo ' ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \' >> example_single_file.cpp
- echo ' operator MyVec2() const { return MyVec2(x, y); }' >> example_single_file.cpp
- echo '#define IM_VEC4_CLASS_EXTRA \' >> example_single_file.cpp
- echo ' ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \' >> example_single_file.cpp
- echo ' operator MyVec4() const { return MyVec4(x, y, z, w); }' >> example_single_file.cpp
- echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ struct MyVec2 { float x; float y; MyVec2(float x, float y) : x(x), y(y) { } };
+ struct MyVec4 { float x; float y; float z; float w;
+ MyVec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) { } };
+ #define IM_VEC2_CLASS_EXTRA \
+ ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
+ operator MyVec2() const { return MyVec2(x, y); }
+ #define IM_VEC4_CLASS_EXTRA \
+ ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
+ operator MyVec4() const { return MyVec4(x, y, z, w); }
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- name: Build example_null (without c++ runtime, Clang)
run: |
- echo '#define IMGUI_IMPLEMENTATION' > example_single_file.cpp
- echo '#define IMGUI_DISABLE_DEMO_WINDOWS' >> example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- clang++ -I. -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_IMPLEMENTATION
+ #define IMGUI_DISABLE_DEMO_WINDOWS
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
- name: Build example_glfw_opengl2
run: make -C examples/example_glfw_opengl2
- name: Build example_glfw_opengl3
run: make -C examples/example_glfw_opengl3
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- - name: Build example_sdl_opengl2
- run: make -C examples/example_sdl_opengl2
- if: github.event_name == 'schedule'
+ - name: Build example_sdl2_opengl2
+ run: make -C examples/example_sdl2_opengl2
+ if: github.event_name == 'workflow_run'
- - name: Build example_sdl_opengl3
- run: make -C examples/example_sdl_opengl3
+ - name: Build example_sdl2_opengl3
+ run: make -C examples/example_sdl2_opengl3
+
+ - name: Build with IMGUI_IMPL_VULKAN_NO_PROTOTYPES
+ run: g++ -c -I. -std=c++11 -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES=1 backends/imgui_impl_vulkan.cpp
MacOS:
- runs-on: macOS-latest
+ runs-on: macos-latest
steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
+ - uses: actions/checkout@v4
- name: Install Dependencies
run: |
- brew install glfw3
- brew install sdl2
+ brew install glfw3 sdl2
- name: Build example_null (extra warnings, clang 64-bit)
run: make -C examples/example_null WITH_EXTRA_WARNINGS=1
- name: Build example_null (single file build)
run: |
- echo '#define IMGUI_IMPLEMENTATION' > example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- clang++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ clang++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp
- name: Build example_null (without c++ runtime)
run: |
- echo '#define IMGUI_IMPLEMENTATION' > example_single_file.cpp
- echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
- echo '#include "examples/example_null/main.cpp"' >> example_single_file.cpp
- clang++ -I. -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
+ cat > example_single_file.cpp <<'EOF'
+
+ #define IMGUI_IMPLEMENTATION
+ #include "misc/single_file/imgui_single_file.h"
+ #include "examples/example_null/main.cpp"
+
+ EOF
+ clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp
- name: Build example_glfw_opengl2
run: make -C examples/example_glfw_opengl2
- name: Build example_glfw_opengl3
run: make -C examples/example_glfw_opengl3
- if: github.event_name == 'schedule'
+ if: github.event_name == 'workflow_run'
- name: Build example_glfw_metal
run: make -C examples/example_glfw_metal
- - name: Build example_sdl_metal
- run: make -C examples/example_sdl_metal
+ - name: Build example_sdl2_metal
+ run: make -C examples/example_sdl2_metal
- - name: Build example_sdl_opengl2
- run: make -C examples/example_sdl_opengl2
- if: github.event_name == 'schedule'
+ - name: Build example_sdl2_opengl2
+ run: make -C examples/example_sdl2_opengl2
+ if: github.event_name == 'workflow_run'
- - name: Build example_sdl_opengl3
- run: make -C examples/example_sdl_opengl3
+ - name: Build example_sdl2_opengl3
+ run: make -C examples/example_sdl2_opengl3
- name: Build example_apple_metal
run: xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos
@@ -366,11 +460,9 @@ jobs:
run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2
iOS:
- runs-on: macOS-latest
+ runs-on: macos-latest
steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
+ - uses: actions/checkout@v4
- name: Build example_apple_metal
run: |
@@ -378,56 +470,38 @@ jobs:
xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_ios CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
Emscripten:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-22.04
steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
+ - uses: actions/checkout@v4
- name: Install Dependencies
run: |
wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
tar -xvf master.tar.gz
emsdk-master/emsdk update
- emsdk-master/emsdk install latest-fastcomp
- emsdk-master/emsdk activate latest-fastcomp
+ emsdk-master/emsdk install latest
+ emsdk-master/emsdk activate latest
+
+ - name: Build example_sdl2_opengl3 with Emscripten
+ run: |
+ pushd emsdk-master
+ source ./emsdk_env.sh
+ popd
+ make -C examples/example_sdl2_opengl3 -f Makefile.emscripten
- - name: Build example_emscripten
+ - name: Build example_emscripten_wgpu
run: |
- source emsdk-master/emsdk_env.sh
- make -C examples/example_emscripten
+ pushd emsdk-master
+ source ./emsdk_env.sh
+ popd
+ make -C examples/example_emscripten_wgpu -f Makefile.emscripten
- Static-Analysis:
- runs-on: ubuntu-18.04
+ Android:
+ runs-on: ubuntu-22.04
steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
+ - uses: actions/checkout@v4
- - name: Install Dependencies
- env:
- PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }}
- run: |
- if [[ "$PVS_STUDIO_LICENSE" != "" ]];
- then
- echo "$PVS_STUDIO_LICENSE" > pvs-studio.lic
- wget -q https://files.viva64.com/etc/pubkey.txt
- sudo apt-key add pubkey.txt
- sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
- sudo apt-get update
- sudo apt-get install -y pvs-studio
- fi
-
- - name: PVS-Studio static analysis
- run: |
- if [[ ! -f pvs-studio.lic ]];
- then
- echo "PVS Studio license is missing. No analysis will be performed."
- echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license."
- echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/"
- exit 0
- fi
- cd examples/example_null
- pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1
- pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log
- plog-converter -a 'GA:1,2;OP:1' -t errorfile -w pvs-studio.log
+ - name: Build example_android_opengl3
+ run: |
+ cd examples/example_android_opengl3/android
+ gradle assembleDebug --stacktrace
diff --git a/third_party/imgui/.github/workflows/scheduled.yml b/third_party/imgui/.github/workflows/scheduled.yml
new file mode 100644
index 00000000000..2a08578fb65
--- /dev/null
+++ b/third_party/imgui/.github/workflows/scheduled.yml
@@ -0,0 +1,15 @@
+#
+# This is a dummy workflow used to trigger scheduled builds. Forked repositories most likely should disable this
+# workflow to avoid daily builds of inactive repositories.
+#
+name: scheduled
+
+on:
+ schedule:
+ - cron: '0 9 * * *'
+
+jobs:
+ scheduled:
+ runs-on: ubuntu-latest
+ steps:
+ - run: exit 0
diff --git a/third_party/imgui/.github/workflows/static-analysis.yml b/third_party/imgui/.github/workflows/static-analysis.yml
new file mode 100644
index 00000000000..69df5cdf803
--- /dev/null
+++ b/third_party/imgui/.github/workflows/static-analysis.yml
@@ -0,0 +1,46 @@
+name: static-analysis
+
+on:
+ workflow_run:
+ # Perform static analysis together with build workflow. Build triggers of "build" workflow do not need to be repeated here.
+ workflows:
+ - build
+ types:
+ - requested
+
+jobs:
+ PVS-Studio:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 1
+
+ - name: Install Dependencies
+ env:
+ # The Secret variable setup in GitHub must be in format: "name_or_email key", on a single line
+ PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }}
+ run: |
+ if [[ "$PVS_STUDIO_LICENSE" != "" ]];
+ then
+ wget -q https://files.viva64.com/etc/pubkey.txt
+ sudo apt-key add pubkey.txt
+ sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
+ sudo apt-get update
+ sudo apt-get install -y pvs-studio
+ pvs-studio-analyzer credentials -o pvs-studio.lic $PVS_STUDIO_LICENSE
+ fi
+
+ - name: PVS-Studio static analysis
+ run: |
+ if [[ ! -f pvs-studio.lic ]];
+ then
+ echo "PVS Studio license is missing. No analysis will be performed."
+ echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license."
+ echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/"
+ exit 0
+ fi
+ cd examples/example_null
+ pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1
+ pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log
+ plog-converter -a 'GA:1,2;OP:1' -d V1071 -t errorfile -w pvs-studio.log
diff --git a/third_party/imgui/.gitignore b/third_party/imgui/.gitignore
index 84014850bb1..211d21dda88 100644
--- a/third_party/imgui/.gitignore
+++ b/third_party/imgui/.gitignore
@@ -8,7 +8,6 @@ imgui.ini
*.o
*.obj
*.exe
-examples/build/*
examples/*/Debug/*
examples/*/Release/*
examples/*/x64/*
@@ -26,6 +25,12 @@ ipch
*.VC.db
*.VC.VC.opendb
+## Getting files created in JSON/Schemas/Catalog/ from a VS2022 update
+JSON/
+
+## Commonly used CMake directories
+build*/
+
## Xcode artifacts
project.xcworkspace
xcuserdata
@@ -34,16 +39,21 @@ xcuserdata
examples/*.o.tmp
examples/*.out.js
examples/*.out.wasm
-examples/example_emscripten/example_emscripten.*
+examples/example_glfw_opengl3/web/*
+examples/example_sdl2_opengl3/web/*
+examples/example_emscripten_wgpu/web/*
## JetBrains IDE artifacts
.idea
cmake-build-*
## Unix executables from our example Makefiles
+examples/example_glfw_metal/example_glfw_metal
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
+examples/example_sdl2_metal/example_sdl2_metal
+examples/example_sdl2_opengl2/example_sdl2_opengl2
+examples/example_sdl2_opengl3/example_sdl2_opengl3
+examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer
diff --git a/third_party/imgui/LICENSE.txt b/third_party/imgui/LICENSE.txt
index 780533dcb26..3282f5b5b10 100644
--- a/third_party/imgui/LICENSE.txt
+++ b/third_party/imgui/LICENSE.txt
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2014-2021 Omar Cornut
+Copyright (c) 2014-2024 Omar Cornut
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/third_party/imgui/backends/imgui_impl_allegro5.cpp b/third_party/imgui/backends/imgui_impl_allegro5.cpp
index 8eb63614a42..ef1f13f38ca 100644
--- a/third_party/imgui/backends/imgui_impl_allegro5.cpp
+++ b/third_party/imgui/backends/imgui_impl_allegro5.cpp
@@ -3,20 +3,31 @@
// Implemented features:
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID!
+// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy ALLEGRO_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
// [X] Platform: Clipboard support (from Allegro 5.1.12)
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
// Issues:
-// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually.
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices manually.
// [ ] Platform: Missing gamepad support.
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
-// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
-// Read online: https://github.com/ocornut/imgui/tree/master/docs
+// Learn about Dear ImGui:
+// - FAQ https://dearimgui.com/faq
+// - Getting Started https://dearimgui.com/getting-started
+// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
+// - Introduction, links and more at the top of imgui.cpp
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
-// 2021-12-08: Renderer: Fixed mishandling of the the ImDrawCmd::IdxOffset field! This is an old bug but it never had an effect until some internal rendering changes in 1.86.
+// 2022-11-30: Renderer: Restoring using al_draw_indexed_prim() when Allegro version is >= 5.2.5.
+// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
+// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
+// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
+// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
+// 2022-01-17: Inputs: always calling io.AddKeyModsEvent() next and before key event (not in NewFrame) to fix input queue with very low framerates.
+// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
+// 2021-12-08: Renderer: Fixed mishandling of the ImDrawCmd::IdxOffset field! This is an old bug but it never had an effect until some internal rendering changes in 1.86.
// 2021-08-17: Calling io.AddFocusEvent() on ALLEGRO_EVENT_DISPLAY_SWITCH_OUT/ALLEGRO_EVENT_DISPLAY_SWITCH_IN events.
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
// 2021-05-19: Renderer: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
@@ -30,6 +41,7 @@
// 2018-11-30: Misc: Setting up io.BackendPlatformName/io.BackendRendererName so they can be displayed in the About Window.
// 2018-06-13: Platform: Added clipboard support (from Allegro 5.1.12).
// 2018-06-13: Renderer: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
+// 2018-06-13: Renderer: Stopped using al_draw_indexed_prim() as it is buggy in Allegro's DX9 backend.
// 2018-06-13: Renderer: Backup/restore transform and clipping rectangle.
// 2018-06-11: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
// 2018-04-18: Misc: Renamed file from imgui_impl_a5.cpp to imgui_impl_allegro5.cpp.
@@ -38,10 +50,11 @@
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
-#include // uint64_t
-#include // memcpy
#include "imgui.h"
+#ifndef IMGUI_DISABLE
#include "imgui_impl_allegro5.h"
+#include // uint64_t
+#include // memcpy
// Allegro
#include
@@ -49,13 +62,27 @@
#ifdef _WIN32
#include
#endif
-#define ALLEGRO_HAS_CLIPBOARD (ALLEGRO_VERSION_INT >= ((5 << 24) | (1 << 16) | (12 << 8))) // Clipboard only supported from Allegro 5.1.12
+#define ALLEGRO_HAS_CLIPBOARD (ALLEGRO_VERSION_INT >= ((5 << 24) | (1 << 16) | (12 << 8))) // Clipboard only supported from Allegro 5.1.12
+#define ALLEGRO_HAS_DRAW_INDEXED_PRIM (ALLEGRO_VERSION_INT >= ((5 << 24) | (2 << 16) | ( 5 << 8))) // DX9 implementation of al_draw_indexed_prim() got fixed in Allegro 5.2.5
// Visual Studio warnings
#ifdef _MSC_VER
#pragma warning (disable: 4127) // condition expression is constant
#endif
+struct ImDrawVertAllegro
+{
+ ImVec2 pos;
+ ImVec2 uv;
+ ALLEGRO_COLOR col;
+};
+
+// FIXME-OPT: Unfortunately Allegro doesn't support 32-bit packed colors so we have to convert them to 4 float as well..
+// FIXME-OPT: Consider inlining al_map_rgba()?
+// see https://github.com/liballeg/allegro5/blob/master/src/pixels.c#L554
+// and https://github.com/liballeg/allegro5/blob/master/include/allegro5/internal/aintern_pixels.h
+#define DRAW_VERT_IMGUI_TO_ALLEGRO(DST, SRC) { (DST)->pos = (SRC)->pos; (DST)->uv = (SRC)->uv; unsigned char* c = (unsigned char*)&(SRC)->col; (DST)->col = al_map_rgba(c[0], c[1], c[2], c[3]); }
+
// Allegro Data
struct ImGui_ImplAllegro5_Data
{
@@ -66,20 +93,16 @@ struct ImGui_ImplAllegro5_Data
ALLEGRO_VERTEX_DECL* VertexDecl;
char* ClipboardTextData;
- ImGui_ImplAllegro5_Data() { memset(this, 0, sizeof(*this)); }
+ ImVector BufVertices;
+ ImVector BufIndices;
+
+ ImGui_ImplAllegro5_Data() { memset((void*)this, 0, sizeof(*this)); }
};
// Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
// FIXME: multi-context support is not well tested and probably dysfunctional in this backend.
-static ImGui_ImplAllegro5_Data* ImGui_ImplAllegro5_GetBackendData() { return ImGui::GetCurrentContext() ? (ImGui_ImplAllegro5_Data*)ImGui::GetIO().BackendPlatformUserData : NULL; }
-
-struct ImDrawVertAllegro
-{
- ImVec2 pos;
- ImVec2 uv;
- ALLEGRO_COLOR col;
-};
+static ImGui_ImplAllegro5_Data* ImGui_ImplAllegro5_GetBackendData() { return ImGui::GetCurrentContext() ? (ImGui_ImplAllegro5_Data*)ImGui::GetIO().BackendPlatformUserData : nullptr; }
static void ImGui_ImplAllegro5_SetupRenderState(ImDrawData* draw_data)
{
@@ -125,35 +148,40 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
{
const ImDrawList* cmd_list = draw_data->CmdLists[n];
- // Allegro's implementation of al_draw_indexed_prim() for DX9 is completely broken. Unindex our buffers ourselves.
- // FIXME-OPT: Unfortunately Allegro doesn't support 32-bit packed colors so we have to convert them to 4 float as well..
- static ImVector vertices;
- vertices.resize(cmd_list->IdxBuffer.Size);
- for (int i = 0; i < cmd_list->IdxBuffer.Size; i++)
+ ImVector& vertices = bd->BufVertices;
+#if ALLEGRO_HAS_DRAW_INDEXED_PRIM
+ vertices.resize(cmd_list->VtxBuffer.Size);
+ for (int i = 0; i < cmd_list->VtxBuffer.Size; i++)
{
- const ImDrawVert* src_v = &cmd_list->VtxBuffer[cmd_list->IdxBuffer[i]];
+ const ImDrawVert* src_v = &cmd_list->VtxBuffer[i];
ImDrawVertAllegro* dst_v = &vertices[i];
- dst_v->pos = src_v->pos;
- dst_v->uv = src_v->uv;
- unsigned char* c = (unsigned char*)&src_v->col;
- dst_v->col = al_map_rgba(c[0], c[1], c[2], c[3]);
+ DRAW_VERT_IMGUI_TO_ALLEGRO(dst_v, src_v);
}
-
- const int* indices = NULL;
+ const int* indices = nullptr;
if (sizeof(ImDrawIdx) == 2)
{
- // FIXME-OPT: Unfortunately Allegro doesn't support 16-bit indices.. You can '#define ImDrawIdx int' in imconfig.h to request Dear ImGui to output 32-bit indices.
+ // FIXME-OPT: Allegro doesn't support 16-bit indices.
+ // You can '#define ImDrawIdx int' in imconfig.h to request Dear ImGui to output 32-bit indices.
// Otherwise, we convert them from 16-bit to 32-bit at runtime here, which works perfectly but is a little wasteful.
- static ImVector indices_converted;
- indices_converted.resize(cmd_list->IdxBuffer.Size);
+ bd->BufIndices.resize(cmd_list->IdxBuffer.Size);
for (int i = 0; i < cmd_list->IdxBuffer.Size; ++i)
- indices_converted[i] = (int)cmd_list->IdxBuffer.Data[i];
- indices = indices_converted.Data;
+ bd->BufIndices[i] = (int)cmd_list->IdxBuffer.Data[i];
+ indices = bd->BufIndices.Data;
}
else if (sizeof(ImDrawIdx) == 4)
{
indices = (const int*)cmd_list->IdxBuffer.Data;
}
+#else
+ // Allegro's implementation of al_draw_indexed_prim() for DX9 was broken until 5.2.5. Unindex buffers ourselves while converting vertex format.
+ vertices.resize(cmd_list->IdxBuffer.Size);
+ for (int i = 0; i < cmd_list->IdxBuffer.Size; i++)
+ {
+ const ImDrawVert* src_v = &cmd_list->VtxBuffer[cmd_list->IdxBuffer[i]];
+ ImDrawVertAllegro* dst_v = &vertices[i];
+ DRAW_VERT_IMGUI_TO_ALLEGRO(dst_v, src_v);
+ }
+#endif
// Render command lists
ImVec2 clip_off = draw_data->DisplayPos;
@@ -180,7 +208,11 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
// Apply scissor/clipping rectangle, Draw
ALLEGRO_BITMAP* texture = (ALLEGRO_BITMAP*)pcmd->GetTexID();
al_set_clipping_rectangle(clip_min.x, clip_min.y, clip_max.x - clip_min.x, clip_max.y - clip_min.y);
+#if ALLEGRO_HAS_DRAW_INDEXED_PRIM
+ al_draw_indexed_prim(&vertices[0], bd->VertexDecl, texture, &indices[pcmd->IdxOffset], pcmd->ElemCount, ALLEGRO_PRIM_TRIANGLE_LIST);
+#else
al_draw_prim(&vertices[0], bd->VertexDecl, texture, pcmd->IdxOffset, pcmd->IdxOffset + pcmd->ElemCount, ALLEGRO_PRIM_TRIANGLE_LIST);
+#endif
}
}
}
@@ -202,6 +234,7 @@ bool ImGui_ImplAllegro5_CreateDeviceObjects()
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
// Create texture
+ // (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
int flags = al_get_new_bitmap_flags();
int fmt = al_get_new_bitmap_format();
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP | ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR);
@@ -228,7 +261,7 @@ bool ImGui_ImplAllegro5_CreateDeviceObjects()
return false;
// Store our identifier
- io.Fonts->SetTexID((void*)cloned_img);
+ io.Fonts->SetTexID((ImTextureID)(intptr_t)cloned_img);
bd->Texture = cloned_img;
// Create an invisible mouse cursor
@@ -246,14 +279,14 @@ void ImGui_ImplAllegro5_InvalidateDeviceObjects()
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
if (bd->Texture)
{
- io.Fonts->SetTexID(NULL);
+ io.Fonts->SetTexID(0);
al_destroy_bitmap(bd->Texture);
- bd->Texture = NULL;
+ bd->Texture = nullptr;
}
if (bd->MouseCursorInvisible)
{
al_destroy_mouse_cursor(bd->MouseCursorInvisible);
- bd->MouseCursorInvisible = NULL;
+ bd->MouseCursorInvisible = nullptr;
}
}
@@ -274,10 +307,123 @@ static void ImGui_ImplAllegro5_SetClipboardText(void*, const char* text)
}
#endif
+static ImGuiKey ImGui_ImplAllegro5_KeyCodeToImGuiKey(int key_code)
+{
+ switch (key_code)
+ {
+ case ALLEGRO_KEY_TAB: return ImGuiKey_Tab;
+ case ALLEGRO_KEY_LEFT: return ImGuiKey_LeftArrow;
+ case ALLEGRO_KEY_RIGHT: return ImGuiKey_RightArrow;
+ case ALLEGRO_KEY_UP: return ImGuiKey_UpArrow;
+ case ALLEGRO_KEY_DOWN: return ImGuiKey_DownArrow;
+ case ALLEGRO_KEY_PGUP: return ImGuiKey_PageUp;
+ case ALLEGRO_KEY_PGDN: return ImGuiKey_PageDown;
+ case ALLEGRO_KEY_HOME: return ImGuiKey_Home;
+ case ALLEGRO_KEY_END: return ImGuiKey_End;
+ case ALLEGRO_KEY_INSERT: return ImGuiKey_Insert;
+ case ALLEGRO_KEY_DELETE: return ImGuiKey_Delete;
+ case ALLEGRO_KEY_BACKSPACE: return ImGuiKey_Backspace;
+ case ALLEGRO_KEY_SPACE: return ImGuiKey_Space;
+ case ALLEGRO_KEY_ENTER: return ImGuiKey_Enter;
+ case ALLEGRO_KEY_ESCAPE: return ImGuiKey_Escape;
+ case ALLEGRO_KEY_QUOTE: return ImGuiKey_Apostrophe;
+ case ALLEGRO_KEY_COMMA: return ImGuiKey_Comma;
+ case ALLEGRO_KEY_MINUS: return ImGuiKey_Minus;
+ case ALLEGRO_KEY_FULLSTOP: return ImGuiKey_Period;
+ case ALLEGRO_KEY_SLASH: return ImGuiKey_Slash;
+ case ALLEGRO_KEY_SEMICOLON: return ImGuiKey_Semicolon;
+ case ALLEGRO_KEY_EQUALS: return ImGuiKey_Equal;
+ case ALLEGRO_KEY_OPENBRACE: return ImGuiKey_LeftBracket;
+ case ALLEGRO_KEY_BACKSLASH: return ImGuiKey_Backslash;
+ case ALLEGRO_KEY_CLOSEBRACE: return ImGuiKey_RightBracket;
+ case ALLEGRO_KEY_TILDE: return ImGuiKey_GraveAccent;
+ case ALLEGRO_KEY_CAPSLOCK: return ImGuiKey_CapsLock;
+ case ALLEGRO_KEY_SCROLLLOCK: return ImGuiKey_ScrollLock;
+ case ALLEGRO_KEY_NUMLOCK: return ImGuiKey_NumLock;
+ case ALLEGRO_KEY_PRINTSCREEN: return ImGuiKey_PrintScreen;
+ case ALLEGRO_KEY_PAUSE: return ImGuiKey_Pause;
+ case ALLEGRO_KEY_PAD_0: return ImGuiKey_Keypad0;
+ case ALLEGRO_KEY_PAD_1: return ImGuiKey_Keypad1;
+ case ALLEGRO_KEY_PAD_2: return ImGuiKey_Keypad2;
+ case ALLEGRO_KEY_PAD_3: return ImGuiKey_Keypad3;
+ case ALLEGRO_KEY_PAD_4: return ImGuiKey_Keypad4;
+ case ALLEGRO_KEY_PAD_5: return ImGuiKey_Keypad5;
+ case ALLEGRO_KEY_PAD_6: return ImGuiKey_Keypad6;
+ case ALLEGRO_KEY_PAD_7: return ImGuiKey_Keypad7;
+ case ALLEGRO_KEY_PAD_8: return ImGuiKey_Keypad8;
+ case ALLEGRO_KEY_PAD_9: return ImGuiKey_Keypad9;
+ case ALLEGRO_KEY_PAD_DELETE: return ImGuiKey_KeypadDecimal;
+ case ALLEGRO_KEY_PAD_SLASH: return ImGuiKey_KeypadDivide;
+ case ALLEGRO_KEY_PAD_ASTERISK: return ImGuiKey_KeypadMultiply;
+ case ALLEGRO_KEY_PAD_MINUS: return ImGuiKey_KeypadSubtract;
+ case ALLEGRO_KEY_PAD_PLUS: return ImGuiKey_KeypadAdd;
+ case ALLEGRO_KEY_PAD_ENTER: return ImGuiKey_KeypadEnter;
+ case ALLEGRO_KEY_PAD_EQUALS: return ImGuiKey_KeypadEqual;
+ case ALLEGRO_KEY_LCTRL: return ImGuiKey_LeftCtrl;
+ case ALLEGRO_KEY_LSHIFT: return ImGuiKey_LeftShift;
+ case ALLEGRO_KEY_ALT: return ImGuiKey_LeftAlt;
+ case ALLEGRO_KEY_LWIN: return ImGuiKey_LeftSuper;
+ case ALLEGRO_KEY_RCTRL: return ImGuiKey_RightCtrl;
+ case ALLEGRO_KEY_RSHIFT: return ImGuiKey_RightShift;
+ case ALLEGRO_KEY_ALTGR: return ImGuiKey_RightAlt;
+ case ALLEGRO_KEY_RWIN: return ImGuiKey_RightSuper;
+ case ALLEGRO_KEY_MENU: return ImGuiKey_Menu;
+ case ALLEGRO_KEY_0: return ImGuiKey_0;
+ case ALLEGRO_KEY_1: return ImGuiKey_1;
+ case ALLEGRO_KEY_2: return ImGuiKey_2;
+ case ALLEGRO_KEY_3: return ImGuiKey_3;
+ case ALLEGRO_KEY_4: return ImGuiKey_4;
+ case ALLEGRO_KEY_5: return ImGuiKey_5;
+ case ALLEGRO_KEY_6: return ImGuiKey_6;
+ case ALLEGRO_KEY_7: return ImGuiKey_7;
+ case ALLEGRO_KEY_8: return ImGuiKey_8;
+ case ALLEGRO_KEY_9: return ImGuiKey_9;
+ case ALLEGRO_KEY_A: return ImGuiKey_A;
+ case ALLEGRO_KEY_B: return ImGuiKey_B;
+ case ALLEGRO_KEY_C: return ImGuiKey_C;
+ case ALLEGRO_KEY_D: return ImGuiKey_D;
+ case ALLEGRO_KEY_E: return ImGuiKey_E;
+ case ALLEGRO_KEY_F: return ImGuiKey_F;
+ case ALLEGRO_KEY_G: return ImGuiKey_G;
+ case ALLEGRO_KEY_H: return ImGuiKey_H;
+ case ALLEGRO_KEY_I: return ImGuiKey_I;
+ case ALLEGRO_KEY_J: return ImGuiKey_J;
+ case ALLEGRO_KEY_K: return ImGuiKey_K;
+ case ALLEGRO_KEY_L: return ImGuiKey_L;
+ case ALLEGRO_KEY_M: return ImGuiKey_M;
+ case ALLEGRO_KEY_N: return ImGuiKey_N;
+ case ALLEGRO_KEY_O: return ImGuiKey_O;
+ case ALLEGRO_KEY_P: return ImGuiKey_P;
+ case ALLEGRO_KEY_Q: return ImGuiKey_Q;
+ case ALLEGRO_KEY_R: return ImGuiKey_R;
+ case ALLEGRO_KEY_S: return ImGuiKey_S;
+ case ALLEGRO_KEY_T: return ImGuiKey_T;
+ case ALLEGRO_KEY_U: return ImGuiKey_U;
+ case ALLEGRO_KEY_V: return ImGuiKey_V;
+ case ALLEGRO_KEY_W: return ImGuiKey_W;
+ case ALLEGRO_KEY_X: return ImGuiKey_X;
+ case ALLEGRO_KEY_Y: return ImGuiKey_Y;
+ case ALLEGRO_KEY_Z: return ImGuiKey_Z;
+ case ALLEGRO_KEY_F1: return ImGuiKey_F1;
+ case ALLEGRO_KEY_F2: return ImGuiKey_F2;
+ case ALLEGRO_KEY_F3: return ImGuiKey_F3;
+ case ALLEGRO_KEY_F4: return ImGuiKey_F4;
+ case ALLEGRO_KEY_F5: return ImGuiKey_F5;
+ case ALLEGRO_KEY_F6: return ImGuiKey_F6;
+ case ALLEGRO_KEY_F7: return ImGuiKey_F7;
+ case ALLEGRO_KEY_F8: return ImGuiKey_F8;
+ case ALLEGRO_KEY_F9: return ImGuiKey_F9;
+ case ALLEGRO_KEY_F10: return ImGuiKey_F10;
+ case ALLEGRO_KEY_F11: return ImGuiKey_F11;
+ case ALLEGRO_KEY_F12: return ImGuiKey_F12;
+ default: return ImGuiKey_None;
+ }
+}
+
bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
{
ImGuiIO& io = ImGui::GetIO();
- IM_ASSERT(io.BackendPlatformUserData == NULL && "Already initialized a platform backend!");
+ IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
// Setup backend capabilities flags
ImGui_ImplAllegro5_Data* bd = IM_NEW(ImGui_ImplAllegro5_Data)();
@@ -292,41 +438,17 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
// We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion.
ALLEGRO_VERTEX_ELEMENT elems[] =
{
- { ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, IM_OFFSETOF(ImDrawVertAllegro, pos) },
- { ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, IM_OFFSETOF(ImDrawVertAllegro, uv) },
- { ALLEGRO_PRIM_COLOR_ATTR, 0, IM_OFFSETOF(ImDrawVertAllegro, col) },
+ { ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, offsetof(ImDrawVertAllegro, pos) },
+ { ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, offsetof(ImDrawVertAllegro, uv) },
+ { ALLEGRO_PRIM_COLOR_ATTR, 0, offsetof(ImDrawVertAllegro, col) },
{ 0, 0, 0 }
};
bd->VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
- io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
- io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
- io.KeyMap[ImGuiKey_UpArrow] = ALLEGRO_KEY_UP;
- io.KeyMap[ImGuiKey_DownArrow] = ALLEGRO_KEY_DOWN;
- io.KeyMap[ImGuiKey_PageUp] = ALLEGRO_KEY_PGUP;
- io.KeyMap[ImGuiKey_PageDown] = ALLEGRO_KEY_PGDN;
- io.KeyMap[ImGuiKey_Home] = ALLEGRO_KEY_HOME;
- io.KeyMap[ImGuiKey_End] = ALLEGRO_KEY_END;
- io.KeyMap[ImGuiKey_Insert] = ALLEGRO_KEY_INSERT;
- io.KeyMap[ImGuiKey_Delete] = ALLEGRO_KEY_DELETE;
- io.KeyMap[ImGuiKey_Backspace] = ALLEGRO_KEY_BACKSPACE;
- io.KeyMap[ImGuiKey_Space] = ALLEGRO_KEY_SPACE;
- io.KeyMap[ImGuiKey_Enter] = ALLEGRO_KEY_ENTER;
- io.KeyMap[ImGuiKey_Escape] = ALLEGRO_KEY_ESCAPE;
- io.KeyMap[ImGuiKey_KeyPadEnter] = ALLEGRO_KEY_PAD_ENTER;
- io.KeyMap[ImGuiKey_A] = ALLEGRO_KEY_A;
- io.KeyMap[ImGuiKey_C] = ALLEGRO_KEY_C;
- io.KeyMap[ImGuiKey_V] = ALLEGRO_KEY_V;
- io.KeyMap[ImGuiKey_X] = ALLEGRO_KEY_X;
- io.KeyMap[ImGuiKey_Y] = ALLEGRO_KEY_Y;
- io.KeyMap[ImGuiKey_Z] = ALLEGRO_KEY_Z;
- io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
-
#if ALLEGRO_HAS_CLIPBOARD
io.SetClipboardTextFn = ImGui_ImplAllegro5_SetClipboardText;
io.GetClipboardTextFn = ImGui_ImplAllegro5_GetClipboardText;
- io.ClipboardUserData = NULL;
+ io.ClipboardUserData = nullptr;
#endif
return true;
@@ -335,7 +457,7 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
void ImGui_ImplAllegro5_Shutdown()
{
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
- IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?");
+ IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
ImGuiIO& io = ImGui::GetIO();
ImGui_ImplAllegro5_InvalidateDeviceObjects();
@@ -344,14 +466,27 @@ void ImGui_ImplAllegro5_Shutdown()
if (bd->ClipboardTextData)
al_free(bd->ClipboardTextData);
- io.BackendPlatformUserData = NULL;
- io.BackendPlatformName = io.BackendRendererName = NULL;
+ io.BackendPlatformName = io.BackendRendererName = nullptr;
+ io.BackendPlatformUserData = nullptr;
+ io.BackendFlags &= ~ImGuiBackendFlags_HasMouseCursors;
IM_DELETE(bd);
}
+// ev->keyboard.modifiers seems always zero so using that...
+static void ImGui_ImplAllegro5_UpdateKeyModifiers()
+{
+ ImGuiIO& io = ImGui::GetIO();
+ ALLEGRO_KEYBOARD_STATE keys;
+ al_get_keyboard_state(&keys);
+ io.AddKeyEvent(ImGuiMod_Ctrl, al_key_down(&keys, ALLEGRO_KEY_LCTRL) || al_key_down(&keys, ALLEGRO_KEY_RCTRL));
+ io.AddKeyEvent(ImGuiMod_Shift, al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT));
+ io.AddKeyEvent(ImGuiMod_Alt, al_key_down(&keys, ALLEGRO_KEY_ALT) || al_key_down(&keys, ALLEGRO_KEY_ALTGR));
+ io.AddKeyEvent(ImGuiMod_Super, al_key_down(&keys, ALLEGRO_KEY_LWIN) || al_key_down(&keys, ALLEGRO_KEY_RWIN));
+}
+
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
-// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
-// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
+// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
+// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* ev)
{
@@ -363,29 +498,28 @@ bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* ev)
case ALLEGRO_EVENT_MOUSE_AXES:
if (ev->mouse.display == bd->Display)
{
- io.MouseWheel += ev->mouse.dz;
- io.MouseWheelH -= ev->mouse.dw;
- io.MousePos = ImVec2(ev->mouse.x, ev->mouse.y);
+ io.AddMousePosEvent(ev->mouse.x, ev->mouse.y);
+ io.AddMouseWheelEvent(-ev->mouse.dw, ev->mouse.dz);
}
return true;
case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN:
case ALLEGRO_EVENT_MOUSE_BUTTON_UP:
- if (ev->mouse.display == bd->Display && ev->mouse.button <= 5)
- io.MouseDown[ev->mouse.button - 1] = (ev->type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN);
+ if (ev->mouse.display == bd->Display && ev->mouse.button > 0 && ev->mouse.button <= 5)
+ io.AddMouseButtonEvent(ev->mouse.button - 1, ev->type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN);
return true;
case ALLEGRO_EVENT_TOUCH_MOVE:
if (ev->touch.display == bd->Display)
- io.MousePos = ImVec2(ev->touch.x, ev->touch.y);
+ io.AddMousePosEvent(ev->touch.x, ev->touch.y);
return true;
case ALLEGRO_EVENT_TOUCH_BEGIN:
case ALLEGRO_EVENT_TOUCH_END:
case ALLEGRO_EVENT_TOUCH_CANCEL:
if (ev->touch.display == bd->Display && ev->touch.primary)
- io.MouseDown[0] = (ev->type == ALLEGRO_EVENT_TOUCH_BEGIN);
+ io.AddMouseButtonEvent(0, ev->type == ALLEGRO_EVENT_TOUCH_BEGIN);
return true;
case ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY:
if (ev->mouse.display == bd->Display)
- io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
+ io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
return true;
case ALLEGRO_EVENT_KEY_CHAR:
if (ev->keyboard.display == bd->Display)
@@ -395,7 +529,12 @@ bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* ev)
case ALLEGRO_EVENT_KEY_DOWN:
case ALLEGRO_EVENT_KEY_UP:
if (ev->keyboard.display == bd->Display)
- io.KeysDown[ev->keyboard.keycode] = (ev->type == ALLEGRO_EVENT_KEY_DOWN);
+ {
+ ImGui_ImplAllegro5_UpdateKeyModifiers();
+ ImGuiKey key = ImGui_ImplAllegro5_KeyCodeToImGuiKey(ev->keyboard.keycode);
+ io.AddKeyEvent(key, (ev->type == ALLEGRO_EVENT_KEY_DOWN));
+ io.SetKeyEventNativeData(key, ev->keyboard.keycode, -1); // To support legacy indexing (<1.87 user code)
+ }
return true;
case ALLEGRO_EVENT_DISPLAY_SWITCH_OUT:
if (ev->display.source == bd->Display)
@@ -447,7 +586,7 @@ static void ImGui_ImplAllegro5_UpdateMouseCursor()
void ImGui_ImplAllegro5_NewFrame()
{
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
- IM_ASSERT(bd != NULL && "Did you call ImGui_ImplAllegro5_Init()?");
+ IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplAllegro5_Init()?");
if (!bd->Texture)
ImGui_ImplAllegro5_CreateDeviceObjects();
@@ -465,13 +604,10 @@ void ImGui_ImplAllegro5_NewFrame()
io.DeltaTime = bd->Time > 0.0 ? (float)(current_time - bd->Time) : (float)(1.0f / 60.0f);
bd->Time = current_time;
- // Setup inputs
- ALLEGRO_KEYBOARD_STATE keys;
- al_get_keyboard_state(&keys);
- io.KeyCtrl = al_key_down(&keys, ALLEGRO_KEY_LCTRL) || al_key_down(&keys, ALLEGRO_KEY_RCTRL);
- io.KeyShift = al_key_down(&keys, ALLEGRO_KEY_LSHIFT) || al_key_down(&keys, ALLEGRO_KEY_RSHIFT);
- io.KeyAlt = al_key_down(&keys, ALLEGRO_KEY_ALT) || al_key_down(&keys, ALLEGRO_KEY_ALTGR);
- io.KeySuper = al_key_down(&keys, ALLEGRO_KEY_LWIN) || al_key_down(&keys, ALLEGRO_KEY_RWIN);
-
+ // Setup mouse cursor shape
ImGui_ImplAllegro5_UpdateMouseCursor();
}
+
+//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE
diff --git a/third_party/imgui/backends/imgui_impl_allegro5.h b/third_party/imgui/backends/imgui_impl_allegro5.h
index 06c7120b287..5b63654ef9c 100644
--- a/third_party/imgui/backends/imgui_impl_allegro5.h
+++ b/third_party/imgui/backends/imgui_impl_allegro5.h
@@ -3,19 +3,24 @@
// Implemented features:
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID!
+// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy ALLEGRO_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
// [X] Platform: Clipboard support (from Allegro 5.1.12)
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
// Issues:
// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually.
// [ ] Platform: Missing gamepad support.
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
-// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
-// Read online: https://github.com/ocornut/imgui/tree/master/docs
+// Learn about Dear ImGui:
+// - FAQ https://dearimgui.com/faq
+// - Getting Started https://dearimgui.com/getting-started
+// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
+// - Introduction, links and more at the top of imgui.cpp
#pragma once
#include "imgui.h" // IMGUI_IMPL_API
+#ifndef IMGUI_DISABLE
struct ALLEGRO_DISPLAY;
union ALLEGRO_EVENT;
@@ -29,3 +34,5 @@ IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event);
// 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();
+
+#endif // #ifndef IMGUI_DISABLE
diff --git a/third_party/imgui/backends/imgui_impl_android.cpp b/third_party/imgui/backends/imgui_impl_android.cpp
index aae8e6b8d73..7dd2afc2efc 100644
--- a/third_party/imgui/backends/imgui_impl_android.cpp
+++ b/third_party/imgui/backends/imgui_impl_android.cpp
@@ -2,29 +2,37 @@
// This needs to be used along with the OpenGL 3 Renderer (imgui_impl_opengl3)
// Implemented features:
-// [X] Platform: Keyboard arrays indexed using AKEYCODE_* codes, e.g. ImGui::IsKeyPressed(AKEYCODE_SPACE).
+// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy AKEYCODE_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
+// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen.
// Missing features:
// [ ] Platform: Clipboard support.
// [ ] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [ ] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: Check if this is even possible with Android.
// Important:
+// - Consider using SDL or GLFW backend on Android, which will be more full-featured than this.
// - FIXME: On-screen keyboard currently needs to be enabled by the application (see examples/ and issue #3446)
// - FIXME: Unicode character inputs needs to be passed by Dear ImGui by the application (see examples/ and issue #3446)
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
-// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
-// Read online: https://github.com/ocornut/imgui/tree/master/docs
+// Learn about Dear ImGui:
+// - FAQ https://dearimgui.com/faq
+// - Getting Started https://dearimgui.com/getting-started
+// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
+// - Introduction, links and more at the top of imgui.cpp
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
+// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
+// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
+// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
// 2021-03-04: Initial version.
#include "imgui.h"
+#ifndef IMGUI_DISABLE
#include "imgui_impl_android.h"
#include
-#include