From 277a93ba81feb2bdc14f7192bf5586a4836abc94 Mon Sep 17 00:00:00 2001
From: Vertexi <778950965@qq.com>
Date: Sun, 5 May 2024 23:46:50 +0800
Subject: [PATCH] remove unuse file
---
examples/example_allegro5/README.md | 35 -
.../example_allegro5/example_allegro5.vcxproj | 179 -
.../example_allegro5.vcxproj.filters | 55 -
examples/example_allegro5/imconfig_allegro5.h | 11 -
examples/example_allegro5/main.cpp | 135 -
examples/example_apple_metal/README.md | 8 -
.../example_apple_metal/Shared/AppDelegate.h | 18 -
.../example_apple_metal/Shared/AppDelegate.m | 11 -
.../example_apple_metal/Shared/Renderer.h | 8 -
.../example_apple_metal/Shared/Renderer.mm | 129 -
.../Shared/ViewController.h | 19 -
.../Shared/ViewController.mm | 153 -
examples/example_apple_metal/Shared/main.m | 22 -
.../project.pbxproj | 539 --
.../iOS/Base.lproj/Main.storyboard | 28 -
.../iOS/Default-568h@2x.png | Bin 1673 -> 0 bytes
.../example_apple_metal/iOS/Info-iOS.plist | 51 -
.../iOS/Launch Screen.storyboard | 29 -
.../macOS/Base.lproj/Main.storyboard | 130 -
.../macOS/Info-macOS.plist | 32 -
.../project.pbxproj | 326 --
examples/example_apple_opengl2/main.mm | 287 --
examples/example_emscripten/Makefile | 84 -
examples/example_emscripten/README.md | 12 -
examples/example_emscripten/main.cpp | 173 -
.../example_emscripten/shell_minimal.html | 64 -
examples/example_glfw_metal/Makefile | 44 -
examples/example_glfw_metal/main.mm | 170 -
examples/example_glfw_opengl2/Makefile | 80 -
examples/example_glfw_opengl2/build_win32.bat | 3 -
.../example_glfw_opengl2.vcxproj | 180 -
.../example_glfw_opengl2.vcxproj.filters | 58 -
examples/example_glfw_opengl2/main.cpp | 158 -
examples/example_glfw_opengl3/Makefile | 111 -
examples/example_glfw_opengl3/build_win32.bat | 3 -
.../example_glfw_opengl3.vcxproj | 183 -
.../example_glfw_opengl3.vcxproj.filters | 70 -
examples/example_glfw_opengl3/main.cpp | 210 -
examples/example_glfw_vulkan/CMakeLists.txt | 41 -
examples/example_glfw_vulkan/build_win32.bat | 7 -
examples/example_glfw_vulkan/build_win64.bat | 7 -
.../example_glfw_vulkan.vcxproj | 180 -
.../example_glfw_vulkan.vcxproj.filters | 58 -
examples/example_glfw_vulkan/gen_spv.sh | 3 -
examples/example_glfw_vulkan/glsl_shader.frag | 14 -
examples/example_glfw_vulkan/glsl_shader.vert | 25 -
examples/example_glfw_vulkan/main.cpp | 535 --
examples/example_glut_opengl2/Makefile | 74 -
.../example_glut_opengl2.vcxproj | 180 -
.../example_glut_opengl2.vcxproj.filters | 58 -
examples/example_glut_opengl2/main.cpp | 146 -
examples/example_marmalade/data/app.icf | 32 -
examples/example_marmalade/main.cpp | 123 -
.../example_marmalade/marmalade_example.mkb | 46 -
examples/example_null/Makefile | 90 -
examples/example_null/build_win32.bat | 3 -
examples/example_null/main.cpp | 37 -
.../example_sdl_directx11/build_win32.bat | 8 -
.../example_sdl_directx11.vcxproj | 181 -
.../example_sdl_directx11.vcxproj.filters | 57 -
examples/example_sdl_directx11/main.cpp | 228 -
examples/example_sdl_metal/Makefile | 46 -
examples/example_sdl_metal/main.mm | 179 -
examples/example_sdl_opengl3/Makefile | 110 -
examples/example_sdl_opengl3/README.md | 25 -
examples/example_sdl_opengl3/build_win32.bat | 8 -
.../example_sdl_opengl3.vcxproj | 183 -
.../example_sdl_opengl3.vcxproj.filters | 70 -
examples/example_sdl_opengl3/main.cpp | 212 -
.../example_sdl_vulkan.vcxproj | 180 -
.../example_sdl_vulkan.vcxproj.filters | 58 -
examples/example_sdl_vulkan/main.cpp | 535 --
.../example_win32_directx10/build_win32.bat | 4 -
.../example_win32_directx10.vcxproj | 170 -
.../example_win32_directx10.vcxproj.filters | 57 -
examples/example_win32_directx10/main.cpp | 238 -
.../example_win32_directx11/build_win32.bat | 4 -
.../example_win32_directx11.vcxproj | 170 -
.../example_win32_directx11.vcxproj.filters | 57 -
examples/example_win32_directx11/main.cpp | 242 -
.../example_win32_directx12/build_win32.bat | 4 -
.../example_win32_directx12.vcxproj | 167 -
.../example_win32_directx12.vcxproj.filters | 54 -
examples/example_win32_directx12/main.cpp | 463 --
.../example_win32_directx9/build_win32.bat | 3 -
.../example_win32_directx9.vcxproj | 170 -
.../example_win32_directx9.vcxproj.filters | 58 -
examples/example_win32_directx9/main.cpp | 233 -
examples/imgui_examples.sln | 81 -
examples/imgui_impl_allegro5.cpp | 428 --
examples/imgui_impl_allegro5.h | 30 -
examples/imgui_impl_dx10.cpp | 536 --
examples/imgui_impl_dx10.h | 24 -
examples/imgui_impl_dx11.cpp | 551 --
examples/imgui_impl_dx11.h | 25 -
examples/imgui_impl_dx12.cpp | 665 ---
examples/imgui_impl_dx12.h | 36 -
examples/imgui_impl_dx9.cpp | 284 --
examples/imgui_impl_dx9.h | 24 -
examples/imgui_impl_glfw.cpp | 369 --
examples/imgui_impl_glfw.h | 35 -
examples/imgui_impl_glut.cpp | 216 -
examples/imgui_impl_glut.h | 36 -
examples/imgui_impl_marmalade.cpp | 316 --
examples/imgui_impl_marmalade.h | 27 -
examples/imgui_impl_metal.h | 28 -
examples/imgui_impl_metal.mm | 550 --
examples/imgui_impl_opengl2.cpp | 248 -
examples/imgui_impl_opengl2.h | 31 -
examples/imgui_impl_opengl3.cpp | 677 ---
examples/imgui_impl_opengl3.h | 84 -
examples/imgui_impl_osx.h | 19 -
examples/imgui_impl_osx.mm | 318 --
examples/imgui_impl_vulkan.cpp | 1226 -----
examples/imgui_impl_vulkan.h | 126 -
examples/imgui_impl_win32.cpp | 446 --
examples/imgui_impl_win32.h | 37 -
examples/libs/gl3w/GL/gl3w.c | 1344 -----
examples/libs/gl3w/GL/gl3w.h | 1234 -----
examples/libs/gl3w/GL/glcorearb.h | 4533 -----------------
examples/libs/glfw/COPYING.txt | 22 -
examples/libs/glfw/include/GLFW/glfw3.h | 4227 ---------------
examples/libs/glfw/include/GLFW/glfw3native.h | 456 --
examples/libs/glfw/lib-vc2010-32/glfw3.lib | Bin 187376 -> 0 bytes
examples/libs/glfw/lib-vc2010-64/glfw3.lib | Bin 291120 -> 0 bytes
examples/libs/usynergy/README.txt | 8 -
examples/libs/usynergy/uSynergy.c | 636 ---
examples/libs/usynergy/uSynergy.h | 420 --
128 files changed, 29994 deletions(-)
delete mode 100644 examples/example_allegro5/README.md
delete mode 100644 examples/example_allegro5/example_allegro5.vcxproj
delete mode 100644 examples/example_allegro5/example_allegro5.vcxproj.filters
delete mode 100644 examples/example_allegro5/imconfig_allegro5.h
delete mode 100644 examples/example_allegro5/main.cpp
delete mode 100644 examples/example_apple_metal/README.md
delete mode 100644 examples/example_apple_metal/Shared/AppDelegate.h
delete mode 100644 examples/example_apple_metal/Shared/AppDelegate.m
delete mode 100644 examples/example_apple_metal/Shared/Renderer.h
delete mode 100644 examples/example_apple_metal/Shared/Renderer.mm
delete mode 100644 examples/example_apple_metal/Shared/ViewController.h
delete mode 100644 examples/example_apple_metal/Shared/ViewController.mm
delete mode 100644 examples/example_apple_metal/Shared/main.m
delete mode 100644 examples/example_apple_metal/example_apple_metal.xcodeproj/project.pbxproj
delete mode 100644 examples/example_apple_metal/iOS/Base.lproj/Main.storyboard
delete mode 100644 examples/example_apple_metal/iOS/Default-568h@2x.png
delete mode 100644 examples/example_apple_metal/iOS/Info-iOS.plist
delete mode 100644 examples/example_apple_metal/iOS/Launch Screen.storyboard
delete mode 100644 examples/example_apple_metal/macOS/Base.lproj/Main.storyboard
delete mode 100644 examples/example_apple_metal/macOS/Info-macOS.plist
delete mode 100644 examples/example_apple_opengl2/example_apple_opengl2.xcodeproj/project.pbxproj
delete mode 100644 examples/example_apple_opengl2/main.mm
delete mode 100644 examples/example_emscripten/Makefile
delete mode 100644 examples/example_emscripten/README.md
delete mode 100644 examples/example_emscripten/main.cpp
delete mode 100644 examples/example_emscripten/shell_minimal.html
delete mode 100644 examples/example_glfw_metal/Makefile
delete mode 100644 examples/example_glfw_metal/main.mm
delete mode 100644 examples/example_glfw_opengl2/Makefile
delete mode 100644 examples/example_glfw_opengl2/build_win32.bat
delete mode 100644 examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj
delete mode 100644 examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters
delete mode 100644 examples/example_glfw_opengl2/main.cpp
delete mode 100644 examples/example_glfw_opengl3/Makefile
delete mode 100644 examples/example_glfw_opengl3/build_win32.bat
delete mode 100644 examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj
delete mode 100644 examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters
delete mode 100644 examples/example_glfw_opengl3/main.cpp
delete mode 100644 examples/example_glfw_vulkan/CMakeLists.txt
delete mode 100644 examples/example_glfw_vulkan/build_win32.bat
delete mode 100644 examples/example_glfw_vulkan/build_win64.bat
delete mode 100644 examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj
delete mode 100644 examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters
delete mode 100755 examples/example_glfw_vulkan/gen_spv.sh
delete mode 100644 examples/example_glfw_vulkan/glsl_shader.frag
delete mode 100644 examples/example_glfw_vulkan/glsl_shader.vert
delete mode 100644 examples/example_glfw_vulkan/main.cpp
delete mode 100644 examples/example_glut_opengl2/Makefile
delete mode 100644 examples/example_glut_opengl2/example_glut_opengl2.vcxproj
delete mode 100644 examples/example_glut_opengl2/example_glut_opengl2.vcxproj.filters
delete mode 100644 examples/example_glut_opengl2/main.cpp
delete mode 100644 examples/example_marmalade/data/app.icf
delete mode 100644 examples/example_marmalade/main.cpp
delete mode 100644 examples/example_marmalade/marmalade_example.mkb
delete mode 100644 examples/example_null/Makefile
delete mode 100644 examples/example_null/build_win32.bat
delete mode 100644 examples/example_null/main.cpp
delete mode 100644 examples/example_sdl_directx11/build_win32.bat
delete mode 100644 examples/example_sdl_directx11/example_sdl_directx11.vcxproj
delete mode 100644 examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters
delete mode 100644 examples/example_sdl_directx11/main.cpp
delete mode 100644 examples/example_sdl_metal/Makefile
delete mode 100644 examples/example_sdl_metal/main.mm
delete mode 100644 examples/example_sdl_opengl3/Makefile
delete mode 100644 examples/example_sdl_opengl3/README.md
delete mode 100644 examples/example_sdl_opengl3/build_win32.bat
delete mode 100644 examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj
delete mode 100644 examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters
delete mode 100644 examples/example_sdl_opengl3/main.cpp
delete mode 100644 examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj
delete mode 100644 examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters
delete mode 100644 examples/example_sdl_vulkan/main.cpp
delete mode 100644 examples/example_win32_directx10/build_win32.bat
delete mode 100644 examples/example_win32_directx10/example_win32_directx10.vcxproj
delete mode 100644 examples/example_win32_directx10/example_win32_directx10.vcxproj.filters
delete mode 100644 examples/example_win32_directx10/main.cpp
delete mode 100644 examples/example_win32_directx11/build_win32.bat
delete mode 100644 examples/example_win32_directx11/example_win32_directx11.vcxproj
delete mode 100644 examples/example_win32_directx11/example_win32_directx11.vcxproj.filters
delete mode 100644 examples/example_win32_directx11/main.cpp
delete mode 100644 examples/example_win32_directx12/build_win32.bat
delete mode 100644 examples/example_win32_directx12/example_win32_directx12.vcxproj
delete mode 100644 examples/example_win32_directx12/example_win32_directx12.vcxproj.filters
delete mode 100644 examples/example_win32_directx12/main.cpp
delete mode 100644 examples/example_win32_directx9/build_win32.bat
delete mode 100644 examples/example_win32_directx9/example_win32_directx9.vcxproj
delete mode 100644 examples/example_win32_directx9/example_win32_directx9.vcxproj.filters
delete mode 100644 examples/example_win32_directx9/main.cpp
delete mode 100644 examples/imgui_examples.sln
delete mode 100644 examples/imgui_impl_allegro5.cpp
delete mode 100644 examples/imgui_impl_allegro5.h
delete mode 100644 examples/imgui_impl_dx10.cpp
delete mode 100644 examples/imgui_impl_dx10.h
delete mode 100644 examples/imgui_impl_dx11.cpp
delete mode 100644 examples/imgui_impl_dx11.h
delete mode 100644 examples/imgui_impl_dx12.cpp
delete mode 100644 examples/imgui_impl_dx12.h
delete mode 100644 examples/imgui_impl_dx9.cpp
delete mode 100644 examples/imgui_impl_dx9.h
delete mode 100644 examples/imgui_impl_glfw.cpp
delete mode 100644 examples/imgui_impl_glfw.h
delete mode 100644 examples/imgui_impl_glut.cpp
delete mode 100644 examples/imgui_impl_glut.h
delete mode 100644 examples/imgui_impl_marmalade.cpp
delete mode 100644 examples/imgui_impl_marmalade.h
delete mode 100644 examples/imgui_impl_metal.h
delete mode 100644 examples/imgui_impl_metal.mm
delete mode 100644 examples/imgui_impl_opengl2.cpp
delete mode 100644 examples/imgui_impl_opengl2.h
delete mode 100644 examples/imgui_impl_opengl3.cpp
delete mode 100644 examples/imgui_impl_opengl3.h
delete mode 100644 examples/imgui_impl_osx.h
delete mode 100644 examples/imgui_impl_osx.mm
delete mode 100644 examples/imgui_impl_vulkan.cpp
delete mode 100644 examples/imgui_impl_vulkan.h
delete mode 100644 examples/imgui_impl_win32.cpp
delete mode 100644 examples/imgui_impl_win32.h
delete mode 100644 examples/libs/gl3w/GL/gl3w.c
delete mode 100644 examples/libs/gl3w/GL/gl3w.h
delete mode 100644 examples/libs/gl3w/GL/glcorearb.h
delete mode 100644 examples/libs/glfw/COPYING.txt
delete mode 100644 examples/libs/glfw/include/GLFW/glfw3.h
delete mode 100644 examples/libs/glfw/include/GLFW/glfw3native.h
delete mode 100644 examples/libs/glfw/lib-vc2010-32/glfw3.lib
delete mode 100644 examples/libs/glfw/lib-vc2010-64/glfw3.lib
delete mode 100644 examples/libs/usynergy/README.txt
delete mode 100644 examples/libs/usynergy/uSynergy.c
delete mode 100644 examples/libs/usynergy/uSynergy.h
diff --git a/examples/example_allegro5/README.md b/examples/example_allegro5/README.md
deleted file mode 100644
index 10d9d6e94e6f..000000000000
--- a/examples/example_allegro5/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-
-# Configuration
-
-Dear ImGui outputs 16-bit vertex indices by default.
-Allegro doesn't support them natively, so we have two solutions: convert the indices manually in imgui_impl_allegro5.cpp, or compile dear imgui with 32-bit indices.
-You can either modify imconfig.h that comes with Dear ImGui (easier), or set a C++ preprocessor option IMGUI_USER_CONFIG to find to a filename.
-We are providing `imconfig_allegro5.h` that enables 32-bit indices.
-Note that the back-end supports _BOTH_ 16-bit and 32-bit indices, but 32-bit indices will be slightly faster as they won't require a manual conversion.
-
-# How to Build
-
-### On Ubuntu 14.04+ and macOS
-
-```bash
-g++ -DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" -I .. -I ../.. main.cpp ../imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_main -lallegro_primitives -o allegro5_example
-```
-
-On macOS, install Allegro with homebrew: `brew install allegro`.
-
-### On Windows with Visual Studio's CLI
-
-You may install Allegro using vcpkg:
-```
-git clone https://github.com/Microsoft/vcpkg
-cd vcpkg
-.\bootstrap-vcpkg.bat
-.\vcpkg install allegro5
-.\vcpkg integrate install ; optional, automatically register include/libs in Visual Studio
-```
-
-Build:
-```
-set ALLEGRODIR=path_to_your_allegro5_folder
-cl /Zi /MD /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" /I .. /I ..\.. main.cpp ..\imgui_impl_allegro5.cpp ..\..\imgui*.cpp /link /LIBPATH:%ALLEGRODIR%\lib allegro-5.0.10-monolith-md.lib user32.lib
-```
diff --git a/examples/example_allegro5/example_allegro5.vcxproj b/examples/example_allegro5/example_allegro5.vcxproj
deleted file mode 100644
index c86dcb2bc78f..000000000000
--- a/examples/example_allegro5/example_allegro5.vcxproj
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741}
- example_allegro5
- 8.1
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories)
-
-
- true
- %(AdditionalLibraryDirectories)
- opengl32.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories)
-
-
- true
- %(AdditionalLibraryDirectories)
- opengl32.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;$(SolutionDir)\libs\gl3w;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %(AdditionalLibraryDirectories)
- opengl32.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;$(SolutionDir)\libs\gl3w;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %(AdditionalLibraryDirectories)
- opengl32.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_allegro5/example_allegro5.vcxproj.filters b/examples/example_allegro5/example_allegro5.vcxproj.filters
deleted file mode 100644
index 8019ebfdc30d..000000000000
--- a/examples/example_allegro5/example_allegro5.vcxproj.filters
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- {20b90ce4-7fcb-4731-b9a0-075f875de82d}
-
-
- {f18ab499-84e1-499f-8eff-9754361e0e52}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_allegro5/imconfig_allegro5.h b/examples/example_allegro5/imconfig_allegro5.h
deleted file mode 100644
index 35afa67fd7d5..000000000000
--- a/examples/example_allegro5/imconfig_allegro5.h
+++ /dev/null
@@ -1,11 +0,0 @@
-//-----------------------------------------------------------------------------
-// COMPILE-TIME OPTIONS FOR DEAR IMGUI ALLEGRO 5 EXAMPLE
-// See imconfig.h for the full template
-// Because Allegro doesn't support 16-bit vertex indices, we enable the compile-time option of imgui to use 32-bit indices
-//-----------------------------------------------------------------------------
-
-#pragma once
-
-// Use 32-bit vertex indices because Allegro doesn't support 16-bit ones
-// This allows us to avoid converting vertices format at runtime
-#define ImDrawIdx int
diff --git a/examples/example_allegro5/main.cpp b/examples/example_allegro5/main.cpp
deleted file mode 100644
index c32125b68188..000000000000
--- a/examples/example_allegro5/main.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// dear imgui: standalone example application for Allegro 5
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-#include
-#include
-#include
-#include "imgui.h"
-#include "imgui_impl_allegro5.h"
-
-int main(int, char**)
-{
- // Setup Allegro
- al_init();
- al_install_keyboard();
- al_install_mouse();
- al_init_primitives_addon();
- al_set_new_display_flags(ALLEGRO_RESIZABLE);
- ALLEGRO_DISPLAY* display = al_create_display(1280, 720);
- al_set_window_title(display, "Dear ImGui Allegro 5 example");
- ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue();
- al_register_event_source(queue, al_get_display_event_source(display));
- al_register_event_source(queue, al_get_keyboard_event_source());
- al_register_event_source(queue, al_get_mouse_event_source());
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplAllegro5_Init(display);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- bool running = true;
- while (running)
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- ALLEGRO_EVENT ev;
- while (al_get_next_event(queue, &ev))
- {
- ImGui_ImplAllegro5_ProcessEvent(&ev);
- if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
- running = false;
- if (ev.type == ALLEGRO_EVENT_DISPLAY_RESIZE)
- {
- ImGui_ImplAllegro5_InvalidateDeviceObjects();
- al_acknowledge_resize(display);
- ImGui_ImplAllegro5_CreateDeviceObjects();
- }
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplAllegro5_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- al_clear_to_color(al_map_rgba_f(clear_color.x, clear_color.y, clear_color.z, clear_color.w));
- ImGui_ImplAllegro5_RenderDrawData(ImGui::GetDrawData());
- al_flip_display();
- }
-
- // Cleanup
- ImGui_ImplAllegro5_Shutdown();
- ImGui::DestroyContext();
- al_destroy_event_queue(queue);
- al_destroy_display(display);
-
- return 0;
-}
diff --git a/examples/example_apple_metal/README.md b/examples/example_apple_metal/README.md
deleted file mode 100644
index 4f620327f702..000000000000
--- a/examples/example_apple_metal/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# iOS / OSX Metal example
-
-## Introduction
-
-This example shows how to integrate Dear ImGui with Metal. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9.
-
-(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
-
diff --git a/examples/example_apple_metal/Shared/AppDelegate.h b/examples/example_apple_metal/Shared/AppDelegate.h
deleted file mode 100644
index 94878d948e51..000000000000
--- a/examples/example_apple_metal/Shared/AppDelegate.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#import
-
-#if TARGET_OS_IPHONE
-
-#import
-
-@interface AppDelegate : UIResponder
-@property (strong, nonatomic) UIWindow *window;
-@end
-
-#else
-
-#import
-
-@interface AppDelegate : NSObject
-@end
-
-#endif
diff --git a/examples/example_apple_metal/Shared/AppDelegate.m b/examples/example_apple_metal/Shared/AppDelegate.m
deleted file mode 100644
index 6947eb23b484..000000000000
--- a/examples/example_apple_metal/Shared/AppDelegate.m
+++ /dev/null
@@ -1,11 +0,0 @@
-#import "AppDelegate.h"
-
-@implementation AppDelegate
-
-#if TARGET_OS_OSX
-- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
- return YES;
-}
-#endif
-
-@end
diff --git a/examples/example_apple_metal/Shared/Renderer.h b/examples/example_apple_metal/Shared/Renderer.h
deleted file mode 100644
index 81fc6f547eb0..000000000000
--- a/examples/example_apple_metal/Shared/Renderer.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#import
-
-@interface Renderer : NSObject
-
--(nonnull instancetype)initWithView:(nonnull MTKView *)view;
-
-@end
-
diff --git a/examples/example_apple_metal/Shared/Renderer.mm b/examples/example_apple_metal/Shared/Renderer.mm
deleted file mode 100644
index efc3332bf90a..000000000000
--- a/examples/example_apple_metal/Shared/Renderer.mm
+++ /dev/null
@@ -1,129 +0,0 @@
-#import "Renderer.h"
-#import
-
-#include "imgui.h"
-#include "imgui_impl_metal.h"
-
-#if TARGET_OS_OSX
-#include "imgui_impl_osx.h"
-#endif
-
-@interface Renderer ()
-@property (nonatomic, strong) id device;
-@property (nonatomic, strong) id commandQueue;
-@end
-
-@implementation Renderer
-
--(nonnull instancetype)initWithView:(nonnull MTKView *)view;
-{
- self = [super init];
- if(self)
- {
- _device = view.device;
- _commandQueue = [_device newCommandQueue];
-
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGui::StyleColorsDark();
-
- ImGui_ImplMetal_Init(_device);
- }
-
- return self;
-}
-
-- (void)drawInMTKView:(MTKView *)view
-{
- ImGuiIO &io = ImGui::GetIO();
- io.DisplaySize.x = view.bounds.size.width;
- io.DisplaySize.y = view.bounds.size.height;
-
-#if TARGET_OS_OSX
- CGFloat framebufferScale = view.window.screen.backingScaleFactor ?: NSScreen.mainScreen.backingScaleFactor;
-#else
- CGFloat framebufferScale = view.window.screen.scale ?: UIScreen.mainScreen.scale;
-#endif
- io.DisplayFramebufferScale = ImVec2(framebufferScale, framebufferScale);
-
- io.DeltaTime = 1 / float(view.preferredFramesPerSecond ?: 60);
-
- id commandBuffer = [self.commandQueue commandBuffer];
-
- static bool show_demo_window = true;
- static bool show_another_window = false;
- static float clear_color[4] = { 0.28f, 0.36f, 0.5f, 1.0f };
-
- MTLRenderPassDescriptor *renderPassDescriptor = view.currentRenderPassDescriptor;
- if (renderPassDescriptor != nil)
- {
- renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clear_color[0], clear_color[1], clear_color[2], clear_color[3]);
-
- // Here, you could do additional rendering work, including other passes as necessary.
-
- id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
- [renderEncoder pushDebugGroup:@"ImGui demo"];
-
- // Start the Dear ImGui frame
- ImGui_ImplMetal_NewFrame(renderPassDescriptor);
-#if TARGET_OS_OSX
- ImGui_ImplOSX_NewFrame(view);
-#endif
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- ImDrawData *drawData = ImGui::GetDrawData();
- ImGui_ImplMetal_RenderDrawData(drawData, commandBuffer, renderEncoder);
-
- [renderEncoder popDebugGroup];
- [renderEncoder endEncoding];
-
- [commandBuffer presentDrawable:view.currentDrawable];
- }
-
- [commandBuffer commit];
-}
-
-- (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size
-{
-}
-
-@end
diff --git a/examples/example_apple_metal/Shared/ViewController.h b/examples/example_apple_metal/Shared/ViewController.h
deleted file mode 100644
index 137f93e1304f..000000000000
--- a/examples/example_apple_metal/Shared/ViewController.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#import
-#import
-#import "Renderer.h"
-
-#if TARGET_OS_IPHONE
-
-#import
-
-@interface ViewController : UIViewController
-@end
-
-#else
-
-#import
-
-@interface ViewController : NSViewController
-@end
-
-#endif
diff --git a/examples/example_apple_metal/Shared/ViewController.mm b/examples/example_apple_metal/Shared/ViewController.mm
deleted file mode 100644
index 3c79cc1c4beb..000000000000
--- a/examples/example_apple_metal/Shared/ViewController.mm
+++ /dev/null
@@ -1,153 +0,0 @@
-#import "ViewController.h"
-#import "Renderer.h"
-#include "imgui.h"
-
-#if TARGET_OS_OSX
-#include "imgui_impl_osx.h"
-#endif
-
-@interface ViewController ()
-@property (nonatomic, readonly) MTKView *mtkView;
-@property (nonatomic, strong) Renderer *renderer;
-@end
-
-@implementation ViewController
-
-- (MTKView *)mtkView {
- return (MTKView *)self.view;
-}
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- self.mtkView.device = MTLCreateSystemDefaultDevice();
-
- if (!self.mtkView.device) {
- NSLog(@"Metal is not supported");
- abort();
- }
-
- self.renderer = [[Renderer alloc] initWithView:self.mtkView];
-
- [self.renderer mtkView:self.mtkView drawableSizeWillChange:self.mtkView.bounds.size];
-
- self.mtkView.delegate = self.renderer;
-
-#if TARGET_OS_OSX
- // Add a tracking area in order to receive mouse events whenever the mouse is within the bounds of our view
- NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect
- options:NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingActiveAlways
- owner:self
- userInfo:nil];
- [self.view addTrackingArea:trackingArea];
-
- // If we want to receive key events, we either need to be in the responder chain of the key view,
- // or else we can install a local monitor. The consequence of this heavy-handed approach is that
- // we receive events for all controls, not just Dear ImGui widgets. If we had native controls in our
- // window, we'd want to be much more careful than just ingesting the complete event stream, though we
- // do make an effort to be good citizens by passing along events when Dear ImGui doesn't want to capture.
- NSEventMask eventMask = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventTypeScrollWheel;
- [NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event) {
- BOOL wantsCapture = ImGui_ImplOSX_HandleEvent(event, self.view);
- if (event.type == NSEventTypeKeyDown && wantsCapture) {
- return nil;
- } else {
- return event;
- }
-
- }];
-
- ImGui_ImplOSX_Init();
-#endif
-}
-
-#if TARGET_OS_OSX
-
-- (void)mouseMoved:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)mouseDown:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)rightMouseDown:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)otherMouseDown:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)mouseUp:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)rightMouseUp:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)otherMouseUp:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)mouseDragged:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)rightMouseDragged:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)otherMouseDragged:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-- (void)scrollWheel:(NSEvent *)event {
- ImGui_ImplOSX_HandleEvent(event, self.view);
-}
-
-#elif TARGET_OS_IOS
-
-// This touch mapping is super cheesy/hacky. We treat any touch on the screen
-// as if it were a depressed left mouse button, and we don't bother handling
-// multitouch correctly at all. This causes the "cursor" to behave very erratically
-// when there are multiple active touches. But for demo purposes, single-touch
-// interaction actually works surprisingly well.
-- (void)updateIOWithTouchEvent:(UIEvent *)event {
- UITouch *anyTouch = event.allTouches.anyObject;
- CGPoint touchLocation = [anyTouch locationInView:self.view];
- ImGuiIO &io = ImGui::GetIO();
- io.MousePos = ImVec2(touchLocation.x, touchLocation.y);
-
- BOOL hasActiveTouch = NO;
- for (UITouch *touch in event.allTouches) {
- if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) {
- hasActiveTouch = YES;
- break;
- }
- }
- io.MouseDown[0] = hasActiveTouch;
-}
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- [self updateIOWithTouchEvent:event];
-}
-
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- [self updateIOWithTouchEvent:event];
-}
-
-- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
- [self updateIOWithTouchEvent:event];
-}
-
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
- [self updateIOWithTouchEvent:event];
-}
-
-#endif
-
-@end
-
diff --git a/examples/example_apple_metal/Shared/main.m b/examples/example_apple_metal/Shared/main.m
deleted file mode 100644
index 15938a906e8b..000000000000
--- a/examples/example_apple_metal/Shared/main.m
+++ /dev/null
@@ -1,22 +0,0 @@
-#import
-
-#if TARGET_OS_IPHONE
-
-#import
-#import "AppDelegate.h"
-
-int main(int argc, char * argv[]) {
- @autoreleasepool {
- return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
- }
-}
-
-#else
-
-#import
-
-int main(int argc, const char * argv[]) {
- return NSApplicationMain(argc, argv);
-}
-
-#endif
diff --git a/examples/example_apple_metal/example_apple_metal.xcodeproj/project.pbxproj b/examples/example_apple_metal/example_apple_metal.xcodeproj/project.pbxproj
deleted file mode 100644
index f1c10494f86f..000000000000
--- a/examples/example_apple_metal/example_apple_metal.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,539 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 48;
- objects = {
-
-/* Begin PBXBuildFile section */
- 07A82ED82139413D0078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82ED72139413C0078D120 /* imgui_widgets.cpp */; };
- 07A82ED92139418F0078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82ED72139413C0078D120 /* imgui_widgets.cpp */; };
- 8307E7CC20E9F9C900473790 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7CB20E9F9C900473790 /* ViewController.mm */; };
- 8307E7CF20E9F9C900473790 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8307E7CD20E9F9C900473790 /* Main.storyboard */; };
- 8307E7DE20E9F9C900473790 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7DD20E9F9C900473790 /* AppDelegate.m */; };
- 8307E7E420E9F9C900473790 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8307E7E220E9F9C900473790 /* Main.storyboard */; };
- 8307E7E720E9F9C900473790 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7E620E9F9C900473790 /* main.m */; };
- 8307E7E820E9F9C900473790 /* Renderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7BC20E9F9C700473790 /* Renderer.mm */; };
- 8307E7E920E9F9C900473790 /* Renderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7BC20E9F9C700473790 /* Renderer.mm */; };
- 836D2A2E20EE208E0098E909 /* imgui_impl_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 836D2A2D20EE208E0098E909 /* imgui_impl_osx.mm */; };
- 836D2A3020EE4A180098E909 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 836D2A2F20EE4A180098E909 /* Default-568h@2x.png */; };
- 836D2A3220EE4A900098E909 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 836D2A3120EE4A900098E909 /* Launch Screen.storyboard */; };
- 83BBE9DE20EB3FFC00295997 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7E620E9F9C900473790 /* main.m */; };
- 83BBE9DF20EB40AE00295997 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7DD20E9F9C900473790 /* AppDelegate.m */; };
- 83BBE9E020EB42D000295997 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8307E7CB20E9F9C900473790 /* ViewController.mm */; };
- 83BBE9E520EB46B900295997 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9E420EB46B900295997 /* Metal.framework */; };
- 83BBE9E720EB46BD00295997 /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9E620EB46BD00295997 /* MetalKit.framework */; };
- 83BBE9E920EB46C100295997 /* ModelIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9E820EB46C100295997 /* ModelIO.framework */; };
- 83BBE9EC20EB471700295997 /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9EA20EB471700295997 /* MetalKit.framework */; };
- 83BBE9ED20EB471700295997 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9EB20EB471700295997 /* Metal.framework */; };
- 83BBE9EF20EB471C00295997 /* ModelIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83BBE9EE20EB471C00295997 /* ModelIO.framework */; };
- 83BBE9FE20EB54D800295997 /* imgui_impl_metal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */; };
- 83BBE9FF20EB54D800295997 /* imgui_impl_metal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */; };
- 83BBEA0520EB54E700295997 /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0120EB54E700295997 /* imgui_draw.cpp */; };
- 83BBEA0620EB54E700295997 /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0120EB54E700295997 /* imgui_draw.cpp */; };
- 83BBEA0720EB54E700295997 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0220EB54E700295997 /* imgui_demo.cpp */; };
- 83BBEA0820EB54E700295997 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0220EB54E700295997 /* imgui_demo.cpp */; };
- 83BBEA0920EB54E700295997 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0320EB54E700295997 /* imgui.cpp */; };
- 83BBEA0A20EB54E700295997 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BBEA0320EB54E700295997 /* imgui.cpp */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- 07A82ED62139413C0078D120 /* imgui_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_internal.h; path = ../../imgui_internal.h; sourceTree = ""; };
- 07A82ED72139413C0078D120 /* imgui_widgets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_widgets.cpp; path = ../../imgui_widgets.cpp; sourceTree = ""; };
- 8307E7BB20E9F9C700473790 /* Renderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Renderer.h; sourceTree = ""; };
- 8307E7BC20E9F9C700473790 /* Renderer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Renderer.mm; sourceTree = ""; };
- 8307E7C420E9F9C900473790 /* example_apple_metal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example_apple_metal.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 8307E7CA20E9F9C900473790 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
- 8307E7CB20E9F9C900473790 /* ViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = ""; };
- 8307E7CE20E9F9C900473790 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
- 8307E7D320E9F9C900473790 /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; };
- 8307E7DA20E9F9C900473790 /* example_apple_metal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example_apple_metal.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 8307E7DC20E9F9C900473790 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
- 8307E7DD20E9F9C900473790 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
- 8307E7E320E9F9C900473790 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
- 8307E7E520E9F9C900473790 /* Info-macOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-macOS.plist"; sourceTree = ""; };
- 8307E7E620E9F9C900473790 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
- 836D2A2C20EE208D0098E909 /* imgui_impl_osx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_osx.h; path = ../../imgui_impl_osx.h; sourceTree = ""; };
- 836D2A2D20EE208E0098E909 /* imgui_impl_osx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = imgui_impl_osx.mm; path = ../../imgui_impl_osx.mm; sourceTree = ""; };
- 836D2A2F20EE4A180098E909 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; };
- 836D2A3120EE4A900098E909 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; };
- 83BBE9E420EB46B900295997 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; };
- 83BBE9E620EB46BD00295997 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/MetalKit.framework; sourceTree = DEVELOPER_DIR; };
- 83BBE9E820EB46C100295997 /* ModelIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ModelIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/ModelIO.framework; sourceTree = DEVELOPER_DIR; };
- 83BBE9EA20EB471700295997 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; };
- 83BBE9EB20EB471700295997 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
- 83BBE9EE20EB471C00295997 /* ModelIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ModelIO.framework; path = System/Library/Frameworks/ModelIO.framework; sourceTree = SDKROOT; };
- 83BBE9FC20EB54D800295997 /* imgui_impl_metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_metal.h; path = ../../imgui_impl_metal.h; sourceTree = ""; };
- 83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = imgui_impl_metal.mm; path = ../../imgui_impl_metal.mm; sourceTree = ""; };
- 83BBEA0020EB54E700295997 /* imgui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui.h; path = ../../imgui.h; sourceTree = ""; };
- 83BBEA0120EB54E700295997 /* imgui_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_draw.cpp; path = ../../imgui_draw.cpp; sourceTree = ""; };
- 83BBEA0220EB54E700295997 /* imgui_demo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_demo.cpp; path = ../../imgui_demo.cpp; sourceTree = ""; };
- 83BBEA0320EB54E700295997 /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../imgui.cpp; sourceTree = ""; };
- 83BBEA0420EB54E700295997 /* imconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imconfig.h; path = ../../imconfig.h; sourceTree = ""; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 8307E7C120E9F9C900473790 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 83BBE9E920EB46C100295997 /* ModelIO.framework in Frameworks */,
- 83BBE9E720EB46BD00295997 /* MetalKit.framework in Frameworks */,
- 83BBE9E520EB46B900295997 /* Metal.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 8307E7D720E9F9C900473790 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 83BBE9EF20EB471C00295997 /* ModelIO.framework in Frameworks */,
- 83BBE9EC20EB471700295997 /* MetalKit.framework in Frameworks */,
- 83BBE9ED20EB471700295997 /* Metal.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 8307E7B520E9F9C700473790 = {
- isa = PBXGroup;
- children = (
- 83BBE9F020EB544400295997 /* imgui */,
- 8307E7BA20E9F9C700473790 /* Shared */,
- 8307E7C620E9F9C900473790 /* iOS */,
- 8307E7DB20E9F9C900473790 /* macOS */,
- 8307E7C520E9F9C900473790 /* Products */,
- 83BBE9E320EB46B800295997 /* Frameworks */,
- );
- sourceTree = "";
- };
- 8307E7BA20E9F9C700473790 /* Shared */ = {
- isa = PBXGroup;
- children = (
- 83BBE9FC20EB54D800295997 /* imgui_impl_metal.h */,
- 83BBE9FD20EB54D800295997 /* imgui_impl_metal.mm */,
- 836D2A2C20EE208D0098E909 /* imgui_impl_osx.h */,
- 836D2A2D20EE208E0098E909 /* imgui_impl_osx.mm */,
- 8307E7DC20E9F9C900473790 /* AppDelegate.h */,
- 8307E7DD20E9F9C900473790 /* AppDelegate.m */,
- 8307E7BB20E9F9C700473790 /* Renderer.h */,
- 8307E7BC20E9F9C700473790 /* Renderer.mm */,
- 8307E7CA20E9F9C900473790 /* ViewController.h */,
- 8307E7CB20E9F9C900473790 /* ViewController.mm */,
- 8307E7E620E9F9C900473790 /* main.m */,
- );
- path = Shared;
- sourceTree = "";
- };
- 8307E7C520E9F9C900473790 /* Products */ = {
- isa = PBXGroup;
- children = (
- 8307E7C420E9F9C900473790 /* example_apple_metal.app */,
- 8307E7DA20E9F9C900473790 /* example_apple_metal.app */,
- );
- name = Products;
- sourceTree = "";
- };
- 8307E7C620E9F9C900473790 /* iOS */ = {
- isa = PBXGroup;
- children = (
- 836D2A2F20EE4A180098E909 /* Default-568h@2x.png */,
- 8307E7CD20E9F9C900473790 /* Main.storyboard */,
- 8307E7D320E9F9C900473790 /* Info-iOS.plist */,
- 836D2A3120EE4A900098E909 /* Launch Screen.storyboard */,
- );
- path = iOS;
- sourceTree = "";
- };
- 8307E7DB20E9F9C900473790 /* macOS */ = {
- isa = PBXGroup;
- children = (
- 8307E7E220E9F9C900473790 /* Main.storyboard */,
- 8307E7E520E9F9C900473790 /* Info-macOS.plist */,
- );
- path = macOS;
- sourceTree = "";
- };
- 83BBE9E320EB46B800295997 /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- 83BBE9EE20EB471C00295997 /* ModelIO.framework */,
- 83BBE9EB20EB471700295997 /* Metal.framework */,
- 83BBE9EA20EB471700295997 /* MetalKit.framework */,
- 83BBE9E820EB46C100295997 /* ModelIO.framework */,
- 83BBE9E620EB46BD00295997 /* MetalKit.framework */,
- 83BBE9E420EB46B900295997 /* Metal.framework */,
- );
- name = Frameworks;
- sourceTree = "";
- };
- 83BBE9F020EB544400295997 /* imgui */ = {
- isa = PBXGroup;
- children = (
- 83BBEA0420EB54E700295997 /* imconfig.h */,
- 83BBEA0320EB54E700295997 /* imgui.cpp */,
- 83BBEA0020EB54E700295997 /* imgui.h */,
- 83BBEA0220EB54E700295997 /* imgui_demo.cpp */,
- 83BBEA0120EB54E700295997 /* imgui_draw.cpp */,
- 07A82ED62139413C0078D120 /* imgui_internal.h */,
- 07A82ED72139413C0078D120 /* imgui_widgets.cpp */,
- );
- name = imgui;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 8307E7C320E9F9C900473790 /* example_apple_metal_ios */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 8307E7F020E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_ios" */;
- buildPhases = (
- 8307E7C020E9F9C900473790 /* Sources */,
- 8307E7C120E9F9C900473790 /* Frameworks */,
- 8307E7C220E9F9C900473790 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = example_apple_metal_ios;
- productName = "imguiex iOS";
- productReference = 8307E7C420E9F9C900473790 /* example_apple_metal.app */;
- productType = "com.apple.product-type.application";
- };
- 8307E7D920E9F9C900473790 /* example_apple_metal_macos */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 8307E7F320E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_macos" */;
- buildPhases = (
- 8307E7D620E9F9C900473790 /* Sources */,
- 8307E7D720E9F9C900473790 /* Frameworks */,
- 8307E7D820E9F9C900473790 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = example_apple_metal_macos;
- productName = "imguiex macOS";
- productReference = 8307E7DA20E9F9C900473790 /* example_apple_metal.app */;
- productType = "com.apple.product-type.application";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 8307E7B620E9F9C700473790 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 0940;
- ORGANIZATIONNAME = "Warren Moore";
- TargetAttributes = {
- 8307E7C320E9F9C900473790 = {
- CreatedOnToolsVersion = 9.4.1;
- ProvisioningStyle = Automatic;
- };
- 8307E7D920E9F9C900473790 = {
- CreatedOnToolsVersion = 9.4.1;
- ProvisioningStyle = Automatic;
- };
- };
- };
- buildConfigurationList = 8307E7B920E9F9C700473790 /* Build configuration list for PBXProject "example_apple_metal" */;
- compatibilityVersion = "Xcode 8.0";
- developmentRegion = en;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- Base,
- );
- mainGroup = 8307E7B520E9F9C700473790;
- productRefGroup = 8307E7C520E9F9C900473790 /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 8307E7C320E9F9C900473790 /* example_apple_metal_ios */,
- 8307E7D920E9F9C900473790 /* example_apple_metal_macos */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 8307E7C220E9F9C900473790 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 836D2A3220EE4A900098E909 /* Launch Screen.storyboard in Resources */,
- 8307E7CF20E9F9C900473790 /* Main.storyboard in Resources */,
- 836D2A3020EE4A180098E909 /* Default-568h@2x.png in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 8307E7D820E9F9C900473790 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 8307E7E420E9F9C900473790 /* Main.storyboard in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 8307E7C020E9F9C900473790 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 8307E7E820E9F9C900473790 /* Renderer.mm in Sources */,
- 8307E7CC20E9F9C900473790 /* ViewController.mm in Sources */,
- 83BBEA0520EB54E700295997 /* imgui_draw.cpp in Sources */,
- 83BBE9DF20EB40AE00295997 /* AppDelegate.m in Sources */,
- 83BBEA0920EB54E700295997 /* imgui.cpp in Sources */,
- 83BBEA0720EB54E700295997 /* imgui_demo.cpp in Sources */,
- 83BBE9FE20EB54D800295997 /* imgui_impl_metal.mm in Sources */,
- 07A82ED82139413D0078D120 /* imgui_widgets.cpp in Sources */,
- 83BBE9DE20EB3FFC00295997 /* main.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 8307E7D620E9F9C900473790 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 83BBE9E020EB42D000295997 /* ViewController.mm in Sources */,
- 8307E7E920E9F9C900473790 /* Renderer.mm in Sources */,
- 83BBEA0620EB54E700295997 /* imgui_draw.cpp in Sources */,
- 07A82ED92139418F0078D120 /* imgui_widgets.cpp in Sources */,
- 8307E7E720E9F9C900473790 /* main.m in Sources */,
- 83BBEA0A20EB54E700295997 /* imgui.cpp in Sources */,
- 83BBEA0820EB54E700295997 /* imgui_demo.cpp in Sources */,
- 83BBE9FF20EB54D800295997 /* imgui_impl_metal.mm in Sources */,
- 836D2A2E20EE208E0098E909 /* imgui_impl_osx.mm in Sources */,
- 8307E7DE20E9F9C900473790 /* AppDelegate.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXVariantGroup section */
- 8307E7CD20E9F9C900473790 /* Main.storyboard */ = {
- isa = PBXVariantGroup;
- children = (
- 8307E7CE20E9F9C900473790 /* Base */,
- );
- name = Main.storyboard;
- sourceTree = "";
- };
- 8307E7E220E9F9C900473790 /* Main.storyboard */ = {
- isa = PBXVariantGroup;
- children = (
- 8307E7E320E9F9C900473790 /* Base */,
- );
- name = Main.storyboard;
- sourceTree = "";
- };
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
- 8307E7EE20E9F9C900473790 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- ENABLE_TESTABILITY = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MTL_ENABLE_DEBUG_INFO = YES;
- ONLY_ACTIVE_ARCH = YES;
- };
- name = Debug;
- };
- 8307E7EF20E9F9C900473790 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MTL_ENABLE_DEBUG_INFO = NO;
- };
- name = Release;
- };
- 8307E7F120E9F9C900473790 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_IDENTITY = "iPhone Developer";
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_TEAM = "";
- INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 10.0;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios";
- PRODUCT_NAME = example_apple_metal;
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- 8307E7F220E9F9C900473790 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_IDENTITY = "iPhone Developer";
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_TEAM = "";
- INFOPLIST_FILE = "$(SRCROOT)/iOS/Info-iOS.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 10.0;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-ios";
- PRODUCT_NAME = example_apple_metal;
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
- VALIDATE_PRODUCT = YES;
- };
- name = Release;
- };
- 8307E7F420E9F9C900473790 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_IDENTITY = "-";
- CODE_SIGN_STYLE = Automatic;
- COMBINE_HIDPI_IMAGES = YES;
- DEVELOPMENT_TEAM = "";
- INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist";
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
- MACOSX_DEPLOYMENT_TARGET = 10.12;
- PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos";
- PRODUCT_NAME = example_apple_metal;
- SDKROOT = macosx;
- };
- name = Debug;
- };
- 8307E7F520E9F9C900473790 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_IDENTITY = "-";
- CODE_SIGN_STYLE = Automatic;
- COMBINE_HIDPI_IMAGES = YES;
- DEVELOPMENT_TEAM = "";
- INFOPLIST_FILE = "$(SRCROOT)/macOS/Info-macOS.plist";
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
- MACOSX_DEPLOYMENT_TARGET = 10.12;
- PRODUCT_BUNDLE_IDENTIFIER = "org.imgui.example.apple-metal-macos";
- PRODUCT_NAME = example_apple_metal;
- SDKROOT = macosx;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 8307E7B920E9F9C700473790 /* Build configuration list for PBXProject "example_apple_metal" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 8307E7EE20E9F9C900473790 /* Debug */,
- 8307E7EF20E9F9C900473790 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 8307E7F020E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_ios" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 8307E7F120E9F9C900473790 /* Debug */,
- 8307E7F220E9F9C900473790 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 8307E7F320E9F9C900473790 /* Build configuration list for PBXNativeTarget "example_apple_metal_macos" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 8307E7F420E9F9C900473790 /* Debug */,
- 8307E7F520E9F9C900473790 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 8307E7B620E9F9C700473790 /* Project object */;
-}
diff --git a/examples/example_apple_metal/iOS/Base.lproj/Main.storyboard b/examples/example_apple_metal/iOS/Base.lproj/Main.storyboard
deleted file mode 100644
index 24a4009ef7d7..000000000000
--- a/examples/example_apple_metal/iOS/Base.lproj/Main.storyboard
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/example_apple_metal/iOS/Default-568h@2x.png b/examples/example_apple_metal/iOS/Default-568h@2x.png
deleted file mode 100644
index e3ce940a36b6bebefdc8944e931dac246a1ec425..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1673
zcmeHGJ7^R^7@j;(2?=PCLaT98iQdl4CimDSYfNtMyoGEyFAE;nxVJk=mSi8l0%a#sB~l
zdQEEpFuVi6Xn1CXdyE^C62H!~N|P-IE39or6wEt8i$dMAR%wG;PP+M?&H^wp>6%T}
zG!_**@I))ah=~_+HUP78Nod*Yl))BVb$wO%`f68zuA>S!^9DA;GF@|P+Yw#fUNY_N
zbz63XxvOwCQMiCdnFSMX!;h6j6*{^Ke`jtazz&41tHM!IO`{IWK}2C*EaYr5gJDq?
zNdeE~$rUJJQbah9a3P0@f=h}-VD|_-TI8%K4XxUZ#Vu7>V=Pn8D%9PCZg`mu
zB@v7H4#Y4N-H(~&+f>(7fs;hnbre$2uq0Qfi^YX1A(c|8f~Cqd(MkneDCeuV$JGLR
z%cDN)ah+rC%s_57eJ|vZH5$2hs8fvs4|b|l+`+k!fqGr8GdLG%AQ$muP&UgyX4`Y|
zg~^`%P31;^*Qw7JJmQ=D?os-X|AJHXMYF>1G)*trpNssX9qQV=nH+rCe>(y2`0$J8
zzxLfHpU&M{-0>fbn?DanYx1?Zy~}&2vrlw#PCD>kc3^Yp!;jG#dGlI7I~2X#eF{dv
Wx9{NM<9i1mvwHN(lJ;!j_TAqnTQ0Z&
diff --git a/examples/example_apple_metal/iOS/Info-iOS.plist b/examples/example_apple_metal/iOS/Info-iOS.plist
deleted file mode 100644
index 8d919d1e50d8..000000000000
--- a/examples/example_apple_metal/iOS/Info-iOS.plist
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- imgui
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- 1
- LSRequiresIPhoneOS
-
- UILaunchStoryboardName
- Launch Screen
- UIMainStoryboardFile
- Main
- UIRequiredDeviceCapabilities
-
- armv7
- metal
-
- UIRequiresFullScreen
-
- UIStatusBarHidden
-
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
- UIInterfaceOrientationPortraitUpsideDown
-
- UISupportedInterfaceOrientations~ipad
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
-
-
diff --git a/examples/example_apple_metal/iOS/Launch Screen.storyboard b/examples/example_apple_metal/iOS/Launch Screen.storyboard
deleted file mode 100644
index 96047e1fc755..000000000000
--- a/examples/example_apple_metal/iOS/Launch Screen.storyboard
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/example_apple_metal/macOS/Base.lproj/Main.storyboard b/examples/example_apple_metal/macOS/Base.lproj/Main.storyboard
deleted file mode 100644
index cf41461705af..000000000000
--- a/examples/example_apple_metal/macOS/Base.lproj/Main.storyboard
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/example_apple_metal/macOS/Info-macOS.plist b/examples/example_apple_metal/macOS/Info-macOS.plist
deleted file mode 100644
index 52d992048f9c..000000000000
--- a/examples/example_apple_metal/macOS/Info-macOS.plist
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIconFile
-
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- imgui
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- 1
- LSMinimumSystemVersion
- $(MACOSX_DEPLOYMENT_TARGET)
- NSHumanReadableCopyright
- Copyright © 2018 Warren Moore. All rights reserved.
- NSMainStoryboardFile
- Main
- NSPrincipalClass
- NSApplication
-
-
diff --git a/examples/example_apple_opengl2/example_apple_opengl2.xcodeproj/project.pbxproj b/examples/example_apple_opengl2/example_apple_opengl2.xcodeproj/project.pbxproj
deleted file mode 100644
index 5bdf74b58384..000000000000
--- a/examples/example_apple_opengl2/example_apple_opengl2.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,326 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 48;
- objects = {
-
-/* Begin PBXBuildFile section */
- 07A82EDB213941D00078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82EDA213941D00078D120 /* imgui_widgets.cpp */; };
- 4080A99820B02D340036BA46 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4080A98A20B02CD90036BA46 /* main.mm */; };
- 4080A9A220B034280036BA46 /* imgui_impl_opengl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */; };
- 4080A9AD20B0343C0036BA46 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A9A620B0343C0036BA46 /* imgui_demo.cpp */; };
- 4080A9AE20B0343C0036BA46 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A9A720B0343C0036BA46 /* imgui.cpp */; };
- 4080A9AF20B0343C0036BA46 /* imgui_draw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A9AA20B0343C0036BA46 /* imgui_draw.cpp */; };
- 4080A9B020B0347A0036BA46 /* imgui_impl_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4080A99F20B034280036BA46 /* imgui_impl_osx.mm */; };
- 4080A9B320B034E40036BA46 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4080A9B220B034E40036BA46 /* Cocoa.framework */; };
- 4080A9B520B034EA0036BA46 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4080A9B420B034EA0036BA46 /* OpenGL.framework */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXCopyFilesBuildPhase section */
- 4080A96920B029B00036BA46 /* CopyFiles */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = /usr/share/man/man1/;
- dstSubfolderSpec = 0;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 1;
- };
-/* End PBXCopyFilesBuildPhase section */
-
-/* Begin PBXFileReference section */
- 07A82EDA213941D00078D120 /* imgui_widgets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_widgets.cpp; path = ../../imgui_widgets.cpp; sourceTree = ""; };
- 4080A96B20B029B00036BA46 /* example_osx_opengl2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = example_osx_opengl2; sourceTree = BUILT_PRODUCTS_DIR; };
- 4080A98A20B02CD90036BA46 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = SOURCE_ROOT; };
- 4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_impl_opengl2.cpp; path = ../imgui_impl_opengl2.cpp; sourceTree = ""; };
- 4080A99F20B034280036BA46 /* imgui_impl_osx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = imgui_impl_osx.mm; path = ../imgui_impl_osx.mm; sourceTree = ""; };
- 4080A9A020B034280036BA46 /* imgui_impl_opengl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_opengl2.h; path = ../imgui_impl_opengl2.h; sourceTree = ""; };
- 4080A9A120B034280036BA46 /* imgui_impl_osx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_impl_osx.h; path = ../imgui_impl_osx.h; sourceTree = ""; };
- 4080A9A520B0343C0036BA46 /* imgui_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_internal.h; path = ../../imgui_internal.h; sourceTree = ""; };
- 4080A9A620B0343C0036BA46 /* imgui_demo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_demo.cpp; path = ../../imgui_demo.cpp; sourceTree = ""; };
- 4080A9A720B0343C0036BA46 /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../imgui.cpp; sourceTree = ""; };
- 4080A9A820B0343C0036BA46 /* imgui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui.h; path = ../../imgui.h; sourceTree = ""; };
- 4080A9AA20B0343C0036BA46 /* imgui_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_draw.cpp; path = ../../imgui_draw.cpp; sourceTree = ""; };
- 4080A9AC20B0343C0036BA46 /* imconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imconfig.h; path = ../../imconfig.h; sourceTree = ""; };
- 4080A9B220B034E40036BA46 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
- 4080A9B420B034EA0036BA46 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 4080A96820B029B00036BA46 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 4080A9B520B034EA0036BA46 /* OpenGL.framework in Frameworks */,
- 4080A9B320B034E40036BA46 /* Cocoa.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 4080A96220B029B00036BA46 = {
- isa = PBXGroup;
- children = (
- 4080A9AC20B0343C0036BA46 /* imconfig.h */,
- 4080A9A720B0343C0036BA46 /* imgui.cpp */,
- 4080A9A820B0343C0036BA46 /* imgui.h */,
- 07A82EDA213941D00078D120 /* imgui_widgets.cpp */,
- 4080A9A620B0343C0036BA46 /* imgui_demo.cpp */,
- 4080A9AA20B0343C0036BA46 /* imgui_draw.cpp */,
- 4080A9A520B0343C0036BA46 /* imgui_internal.h */,
- 4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */,
- 4080A9A020B034280036BA46 /* imgui_impl_opengl2.h */,
- 4080A9A120B034280036BA46 /* imgui_impl_osx.h */,
- 4080A99F20B034280036BA46 /* imgui_impl_osx.mm */,
- 4080A98A20B02CD90036BA46 /* main.mm */,
- 4080A96C20B029B00036BA46 /* Products */,
- 4080A9B120B034E40036BA46 /* Frameworks */,
- );
- sourceTree = "";
- };
- 4080A96C20B029B00036BA46 /* Products */ = {
- isa = PBXGroup;
- children = (
- 4080A96B20B029B00036BA46 /* example_osx_opengl2 */,
- );
- name = Products;
- sourceTree = "";
- };
- 4080A9B120B034E40036BA46 /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- 4080A9B420B034EA0036BA46 /* OpenGL.framework */,
- 4080A9B220B034E40036BA46 /* Cocoa.framework */,
- );
- name = Frameworks;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 4080A96A20B029B00036BA46 /* example_osx_opengl2 */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 4080A97220B029B00036BA46 /* Build configuration list for PBXNativeTarget "example_osx_opengl2" */;
- buildPhases = (
- 4080A96720B029B00036BA46 /* Sources */,
- 4080A96820B029B00036BA46 /* Frameworks */,
- 4080A96920B029B00036BA46 /* CopyFiles */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = example_osx_opengl2;
- productName = example_osx_opengl2;
- productReference = 4080A96B20B029B00036BA46 /* example_osx_opengl2 */;
- productType = "com.apple.product-type.tool";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 4080A96320B029B00036BA46 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 0930;
- ORGANIZATIONNAME = ImGui;
- TargetAttributes = {
- 4080A96A20B029B00036BA46 = {
- CreatedOnToolsVersion = 9.3.1;
- ProvisioningStyle = Automatic;
- };
- };
- };
- buildConfigurationList = 4080A96620B029B00036BA46 /* Build configuration list for PBXProject "example_apple_opengl2" */;
- compatibilityVersion = "Xcode 8.0";
- developmentRegion = en;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- );
- mainGroup = 4080A96220B029B00036BA46;
- productRefGroup = 4080A96C20B029B00036BA46 /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 4080A96A20B029B00036BA46 /* example_osx_opengl2 */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
- 4080A96720B029B00036BA46 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 4080A99820B02D340036BA46 /* main.mm in Sources */,
- 4080A9AD20B0343C0036BA46 /* imgui_demo.cpp in Sources */,
- 4080A9AF20B0343C0036BA46 /* imgui_draw.cpp in Sources */,
- 4080A9A220B034280036BA46 /* imgui_impl_opengl2.cpp in Sources */,
- 4080A9B020B0347A0036BA46 /* imgui_impl_osx.mm in Sources */,
- 4080A9AE20B0343C0036BA46 /* imgui.cpp in Sources */,
- 07A82EDB213941D00078D120 /* imgui_widgets.cpp in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 4080A97020B029B00036BA46 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "-";
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- ENABLE_TESTABILITY = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.13;
- MTL_ENABLE_DEBUG_INFO = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = macosx;
- };
- name = Debug;
- };
- 4080A97120B029B00036BA46 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "-";
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.13;
- MTL_ENABLE_DEBUG_INFO = NO;
- SDKROOT = macosx;
- };
- name = Release;
- };
- 4080A97320B029B00036BA46 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- MACOSX_DEPLOYMENT_TARGET = 10.12;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w;
- USER_HEADER_SEARCH_PATHS = ../..;
- };
- name = Debug;
- };
- 4080A97420B029B00036BA46 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- MACOSX_DEPLOYMENT_TARGET = 10.12;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SYSTEM_HEADER_SEARCH_PATHS = ../libs/gl3w;
- USER_HEADER_SEARCH_PATHS = ../..;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 4080A96620B029B00036BA46 /* Build configuration list for PBXProject "example_apple_opengl2" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 4080A97020B029B00036BA46 /* Debug */,
- 4080A97120B029B00036BA46 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 4080A97220B029B00036BA46 /* Build configuration list for PBXNativeTarget "example_osx_opengl2" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 4080A97320B029B00036BA46 /* Debug */,
- 4080A97420B029B00036BA46 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 4080A96320B029B00036BA46 /* Project object */;
-}
diff --git a/examples/example_apple_opengl2/main.mm b/examples/example_apple_opengl2/main.mm
deleted file mode 100644
index 7cbf3409a096..000000000000
--- a/examples/example_apple_opengl2/main.mm
+++ /dev/null
@@ -1,287 +0,0 @@
-// dear imgui: standalone example application for OSX + OpenGL2, using legacy fixed pipeline
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-#include "imgui.h"
-#include "../imgui_impl_osx.h"
-#include "../imgui_impl_opengl2.h"
-#include
-#import
-#import
-#import
-
-//-----------------------------------------------------------------------------------
-// ImGuiExampleView
-//-----------------------------------------------------------------------------------
-
-@interface ImGuiExampleView : NSOpenGLView
-{
- NSTimer* animationTimer;
-}
-@end
-
-@implementation ImGuiExampleView
-
--(void)animationTimerFired:(NSTimer*)timer
-{
- [self setNeedsDisplay:YES];
-}
-
--(void)prepareOpenGL
-{
- [super prepareOpenGL];
-
-#ifndef DEBUG
- GLint swapInterval = 1;
- [[self openGLContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
- if (swapInterval == 0)
- NSLog(@"Error: Cannot set swap interval.");
-#endif
-}
-
--(void)updateAndDrawDemoView
-{
- // Start the Dear ImGui frame
- ImGui_ImplOpenGL2_NewFrame();
- ImGui_ImplOSX_NewFrame(self);
- ImGui::NewFrame();
-
- // Global data for the demo
- static bool show_demo_window = true;
- static bool show_another_window = false;
- static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- [[self openGLContext] makeCurrentContext];
-
- ImDrawData* draw_data = ImGui::GetDrawData();
- GLsizei width = (GLsizei)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x);
- GLsizei height = (GLsizei)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y);
- glViewport(0, 0, width, height);
-
- glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
- glClear(GL_COLOR_BUFFER_BIT);
- ImGui_ImplOpenGL2_RenderDrawData(draw_data);
-
- // Present
- [[self openGLContext] flushBuffer];
-
- if (!animationTimer)
- animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES];
-}
-
--(void)reshape
-{
- [[self openGLContext] update];
- [self updateAndDrawDemoView];
-}
-
--(void)drawRect:(NSRect)bounds
-{
- [self updateAndDrawDemoView];
-}
-
--(BOOL)acceptsFirstResponder
-{
- return (YES);
-}
-
--(BOOL)becomeFirstResponder
-{
- return (YES);
-}
-
--(BOOL)resignFirstResponder
-{
- return (YES);
-}
-
--(void)dealloc
-{
- animationTimer = nil;
-}
-
-// Forward Mouse/Keyboard events to dear imgui OSX back-end. It returns true when imgui is expecting to use the event.
--(void)keyUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)keyDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)flagsChanged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)mouseDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)rightMouseDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)otherMouseDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)mouseUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)rightMouseUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)otherMouseUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)mouseMoved:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)rightMouseMoved:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)otherMouseMoved:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)mouseDragged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)rightMouseDragged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)otherMouseDragged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
--(void)scrollWheel:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-
-@end
-
-//-----------------------------------------------------------------------------------
-// ImGuiExampleAppDelegate
-//-----------------------------------------------------------------------------------
-
-@interface ImGuiExampleAppDelegate : NSObject
-@property (nonatomic, readonly) NSWindow* window;
-@end
-
-@implementation ImGuiExampleAppDelegate
-@synthesize window = _window;
-
--(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
-{
- return YES;
-}
-
--(NSWindow*)window
-{
- if (_window != nil)
- return (_window);
-
- NSRect viewRect = NSMakeRect(100.0, 100.0, 100.0 + 1280.0, 100 + 720.0);
-
- _window = [[NSWindow alloc] initWithContentRect:viewRect styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable|NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:YES];
- [_window setTitle:@"Dear ImGui OSX+OpenGL2 Example"];
- [_window setAcceptsMouseMovedEvents:YES];
- [_window setOpaque:YES];
- [_window makeKeyAndOrderFront:NSApp];
-
- return (_window);
-}
-
--(void)setupMenu
-{
- NSMenu* mainMenuBar = [[NSMenu alloc] init];
- NSMenu* appMenu;
- NSMenuItem* menuItem;
-
- appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+OpenGL2 Example"];
- menuItem = [appMenu addItemWithTitle:@"Quit Dear ImGui OSX+OpenGL2 Example" action:@selector(terminate:) keyEquivalent:@"q"];
- [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
-
- menuItem = [[NSMenuItem alloc] init];
- [menuItem setSubmenu:appMenu];
-
- [mainMenuBar addItem:menuItem];
-
- appMenu = nil;
- [NSApp setMainMenu:mainMenuBar];
-}
-
--(void)dealloc
-{
- _window = nil;
-}
-
--(void)applicationDidFinishLaunching:(NSNotification *)aNotification
-{
- // Make the application a foreground application (else it won't receive keyboard events)
- ProcessSerialNumber psn = {0, kCurrentProcess};
- TransformProcessType(&psn, kProcessTransformToForegroundApplication);
-
- // Menu
- [self setupMenu];
-
- NSOpenGLPixelFormatAttribute attrs[] =
- {
- NSOpenGLPFADoubleBuffer,
- NSOpenGLPFADepthSize, 32,
- 0
- };
-
- NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
- ImGuiExampleView* view = [[ImGuiExampleView alloc] initWithFrame:self.window.frame pixelFormat:format];
- format = nil;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
- [view setWantsBestResolutionOpenGLSurface:YES];
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- [self.window setContentView:view];
-
- if ([view openGLContext] == nil)
- NSLog(@"No OpenGL Context!");
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplOSX_Init();
- ImGui_ImplOpenGL2_Init();
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.txt' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-}
-
-@end
-
-int main(int argc, const char* argv[])
-{
- @autoreleasepool
- {
- NSApp = [NSApplication sharedApplication];
- ImGuiExampleAppDelegate* delegate = [[ImGuiExampleAppDelegate alloc] init];
- [[NSApplication sharedApplication] setDelegate:delegate];
- [NSApp run];
- }
- return NSApplicationMain(argc, argv);
-}
diff --git a/examples/example_emscripten/Makefile b/examples/example_emscripten/Makefile
deleted file mode 100644
index 9833270e5d98..000000000000
--- a/examples/example_emscripten/Makefile
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# Makefile to use with emscripten
-# See https://emscripten.org/docs/getting_started/downloads.html
-# for installation instructions.
-#
-# This Makefile assumes you have loaded emscripten's environment.
-# (On Windows, you may need to execute emsdk_env.bat or encmdprompt.bat ahead)
-#
-# Running `make` will produce three files:
-# - example_emscripten.html
-# - example_emscripten.js
-# - example_emscripten.wasm
-#
-# All three are needed to run the demo.
-
-CC = emcc
-CXX = em++
-EXE = example_emscripten.html
-SOURCES = main.cpp
-SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp
-SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-UNAME_S := $(shell uname -s)
-
-##---------------------------------------------------------------------
-## EMSCRIPTEN OPTIONS
-##---------------------------------------------------------------------
-
-EMS += -s USE_SDL=2 -s WASM=1
-EMS += -s ALLOW_MEMORY_GROWTH=1
-EMS += -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=0
-EMS += -s ASSERTIONS=1
-
-# Uncomment next line to fix possible rendering bugs with Emscripten version older then 1.39.0 (https://github.com/ocornut/imgui/issues/2877)
-#EMS += -s BINARYEN_TRAP_MODE=clamp
-#EMS += -s SAFE_HEAP=1 ## Adds overhead
-
-# Emscripten allows preloading a file or folder to be accessible at runtime.
-# The Makefile for this example project suggests embedding the misc/fonts/ folder into our application, it will then be accessible as "/fonts"
-# See documentation for more details: https://emscripten.org/docs/porting/files/packaging_files.html
-# (Default value is 0. Set to 1 to enable file-system and include the misc/fonts/ folder as part of the build.)
-USE_FILE_SYSTEM ?= 0
-ifeq ($(USE_FILE_SYSTEM), 0)
-EMS += -s NO_FILESYSTEM=1 -DIMGUI_DISABLE_FILE_FUNCTIONS
-endif
-ifeq ($(USE_FILE_SYSTEM), 1)
-LDFLAGS += --no-heap-copy --preload-file ../../misc/fonts@/fonts
-endif
-
-##---------------------------------------------------------------------
-## FINAL BUILD FLAGS
-##---------------------------------------------------------------------
-
-CPPFLAGS += -I../ -I../../
-#CPPFLAGS += -g
-CPPFLAGS += -Wall -Wformat -Os
-CPPFLAGS += $(EMS)
-LIBS += $(EMS)
-LDFLAGS += --shell-file shell_minimal.html
-
-##---------------------------------------------------------------------
-## BUILD RULES
-##---------------------------------------------------------------------
-
-%.o:%.cpp
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../libs/gl3w/GL/%.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete for $(EXE)
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS)
-
-clean:
- rm -f $(EXE) $(OBJS) *.js *.wasm *.wasm.pre
diff --git a/examples/example_emscripten/README.md b/examples/example_emscripten/README.md
deleted file mode 100644
index dcb7c1a72afa..000000000000
--- a/examples/example_emscripten/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-
-# How to Build
-
-- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
-
-- Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools.
-
-- Then build using `make` while in the `example_emscripten/` directory.
-
-- Note that Emscripten 1.39.0 (October 2019) obsoleted the `BINARYEN_TRAP_MODE=clamp` compilation flag which was required with version older than 1.39.0 to avoid rendering artefacts. See [#2877](https://github.com/ocornut/imgui/issues/2877) for details. If you use an older version, uncomment this line in the Makefile:
-
-`#EMS += -s BINARYEN_TRAP_MODE=clamp`
diff --git a/examples/example_emscripten/main.cpp b/examples/example_emscripten/main.cpp
deleted file mode 100644
index 6867b4cd90f5..000000000000
--- a/examples/example_emscripten/main.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-// dear imgui: standalone example application for Emscripten, using SDL2 + OpenGL3
-// This is mostly the same code as the SDL2 + OpenGL3 example, simply with the modifications needed to run on Emscripten.
-// It is possible to combine both code into a single source file that will compile properly on Desktop and using Emscripten.
-// See https://github.com/ocornut/imgui/pull/2492 as an example on how to do just that.
-//
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// (Emscripten is a C++-to-javascript compiler, used to publish executables for the web. See https://emscripten.org/)
-
-#include "imgui.h"
-#include "imgui_impl_sdl.h"
-#include "imgui_impl_opengl3.h"
-#include
-#include
-#include
-#include
-
-// Emscripten requires to have full control over the main loop. We're going to store our SDL book-keeping variables globally.
-// Having a single function that acts as a loop prevents us to store state in the stack of said function. So we need some location for this.
-SDL_Window* g_Window = NULL;
-SDL_GLContext g_GLContext = NULL;
-
-// For clarity, our main loop code is declared at the end.
-void main_loop(void*);
-
-int main(int, char**)
-{
- // Setup SDL
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
- {
- printf("Error: %s\n", SDL_GetError());
- return -1;
- }
-
- // For the browser using Emscripten, we are going to use WebGL1 with GL ES2. See the Makefile. for requirement details.
- // It is very likely the generated file won't work in many browsers. Firefox is the only sure bet, but I have successfully
- // run this code on Chrome for Android for example.
- const char* glsl_version = "#version 100";
- //const char* glsl_version = "#version 300 es";
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
-
- // Create window with graphics context
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
- SDL_DisplayMode current;
- SDL_GetCurrentDisplayMode(0, ¤t);
- SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
- g_Window = SDL_CreateWindow("Dear ImGui Emscripten example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
- g_GLContext = SDL_GL_CreateContext(g_Window);
- if (!g_GLContext)
- {
- fprintf(stderr, "Failed to initialize WebGL context!\n");
- return 1;
- }
- SDL_GL_SetSwapInterval(1); // Enable vsync
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // For an Emscripten build we are disabling file-system access, so let's not attempt to do a fopen() of the imgui.ini file.
- // You may manually call LoadIniSettingsFromMemory() to load settings from your own storage.
- io.IniFilename = NULL;
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplSDL2_InitForOpenGL(g_Window, g_GLContext);
- ImGui_ImplOpenGL3_Init(glsl_version);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- // - Emscripten allows preloading a file or folder to be accessible at runtime. See Makefile for details.
- //io.Fonts->AddFontDefault();
-#ifndef IMGUI_DISABLE_FILE_FUNCTIONS
- io.Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("fonts/ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-#endif
-
- // This function call won't return, and will engage in an infinite loop, processing events from the browser, and dispatching them.
- emscripten_set_main_loop_arg(main_loop, NULL, 0, true);
-}
-
-void main_loop(void* arg)
-{
- ImGuiIO& io = ImGui::GetIO();
- IM_UNUSED(arg); // We can pass this argument as the second parameter of emscripten_set_main_loop_arg(), but we don't use that.
-
- // Our state (make them static = more or less global) as a convenience to keep the example terse.
- static bool show_demo_window = true;
- static bool show_another_window = false;
- static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- SDL_Event event;
- while (SDL_PollEvent(&event))
- {
- ImGui_ImplSDL2_ProcessEvent(&event);
- // Capture events here, based on io.WantCaptureMouse and io.WantCaptureKeyboard
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplOpenGL3_NewFrame();
- ImGui_ImplSDL2_NewFrame(g_Window);
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- SDL_GL_MakeCurrent(g_Window, g_GLContext);
- glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
- glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
- glClear(GL_COLOR_BUFFER_BIT);
- ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
- SDL_GL_SwapWindow(g_Window);
-}
diff --git a/examples/example_emscripten/shell_minimal.html b/examples/example_emscripten/shell_minimal.html
deleted file mode 100644
index 514385d7cf5a..000000000000
--- a/examples/example_emscripten/shell_minimal.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
- Dear ImGui Emscripten example
-
-
-
-
-
- {{{ SCRIPT }}}
-
-
diff --git a/examples/example_glfw_metal/Makefile b/examples/example_glfw_metal/Makefile
deleted file mode 100644
index 35f1773773eb..000000000000
--- a/examples/example_glfw_metal/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# You will need GLFW (http://www.glfw.org):
-# brew install glfw
-#
-
-#CXX = g++
-#CXX = clang++
-
-EXE = example_glfw_metal
-SOURCES = main.mm
-SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_metal.mm
-SOURCES += ../../imgui.cpp ../../imgui_widgets.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-
-LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore
-LIBS += -L/usr/local/lib -lglfw
-
-CXXFLAGS = -I../ -I../../ -I/usr/local/include
-CXXFLAGS += -Wall -Wformat
-CFLAGS = $(CXXFLAGS)
-
-%.o:%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.mm
- $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $<
-
-%.o:%.mm
- $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
-
-clean:
- rm -f $(EXE) $(OBJS)
diff --git a/examples/example_glfw_metal/main.mm b/examples/example_glfw_metal/main.mm
deleted file mode 100644
index d6f9ae3f6029..000000000000
--- a/examples/example_glfw_metal/main.mm
+++ /dev/null
@@ -1,170 +0,0 @@
-// dear imgui: standalone example application for GLFW + Metal, using programmable pipeline
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
-
-#include "imgui.h"
-#include "imgui_impl_glfw.h"
-#include "imgui_impl_metal.h"
-#include
-
-#define GLFW_INCLUDE_NONE
-#define GLFW_EXPOSE_NATIVE_COCOA
-#include
-#include
-
-#import
-#import
-
-static void glfw_error_callback(int error, const char* description)
-{
- fprintf(stderr, "Glfw Error %d: %s\n", error, description);
-}
-
-int main(int, char**)
-{
- // Setup Dear ImGui binding
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.txt' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Setup window
- glfwSetErrorCallback(glfw_error_callback);
- if (!glfwInit())
- return 1;
-
- // Create window with graphics context
- glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
- GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+Metal example", NULL, NULL);
- if (window == NULL)
- return 1;
-
- id device = MTLCreateSystemDefaultDevice();;
- id commandQueue = [device newCommandQueue];
-
- ImGui_ImplGlfw_InitForOpenGL(window, true);
- ImGui_ImplMetal_Init(device);
-
- NSWindow *nswin = glfwGetCocoaWindow(window);
- CAMetalLayer *layer = [CAMetalLayer layer];
- layer.device = device;
- layer.pixelFormat = MTLPixelFormatBGRA8Unorm;
- nswin.contentView.layer = layer;
- nswin.contentView.wantsLayer = YES;
-
- MTLRenderPassDescriptor *renderPassDescriptor = [MTLRenderPassDescriptor new];
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- float clear_color[4] = {0.45f, 0.55f, 0.60f, 1.00f};
-
- // Main loop
- while (!glfwWindowShouldClose(window))
- {
- @autoreleasepool
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- glfwPollEvents();
-
- int width, height;
- glfwGetFramebufferSize(window, &width, &height);
- layer.drawableSize = CGSizeMake(width, height);
- id drawable = [layer nextDrawable];
-
- id commandBuffer = [commandQueue commandBuffer];
- renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clear_color[0], clear_color[1], clear_color[2], clear_color[3]);
- renderPassDescriptor.colorAttachments[0].texture = drawable.texture;
- renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionClear;
- renderPassDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore;
- id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
- [renderEncoder pushDebugGroup:@"ImGui demo"];
-
- // Start the Dear ImGui frame
- ImGui_ImplMetal_NewFrame(renderPassDescriptor);
- ImGui_ImplGlfw_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- ImGui_ImplMetal_RenderDrawData(ImGui::GetDrawData(), commandBuffer, renderEncoder);
-
- [renderEncoder popDebugGroup];
- [renderEncoder endEncoding];
-
- [commandBuffer presentDrawable:drawable];
- [commandBuffer commit];
- }
- }
-
- // Cleanup
- ImGui_ImplMetal_Shutdown();
- ImGui_ImplGlfw_Shutdown();
- ImGui::DestroyContext();
-
- glfwDestroyWindow(window);
- glfwTerminate();
-
- return 0;
-}
diff --git a/examples/example_glfw_opengl2/Makefile b/examples/example_glfw_opengl2/Makefile
deleted file mode 100644
index 38f865bae111..000000000000
--- a/examples/example_glfw_opengl2/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Cross Platform Makefile
-# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
-#
-# You will need GLFW (http://www.glfw.org):
-# Linux:
-# apt-get install libglfw-dev
-# Mac OS X:
-# brew install glfw
-# MSYS2:
-# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw
-#
-
-#CXX = g++
-#CXX = clang++
-
-EXE = example_glfw_opengl2
-SOURCES = main.cpp
-SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl2.cpp
-SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-UNAME_S := $(shell uname -s)
-
-CXXFLAGS = -I../ -I../../
-CXXFLAGS += -g -Wall -Wformat
-LIBS =
-
-##---------------------------------------------------------------------
-## BUILD FLAGS PER PLATFORM
-##---------------------------------------------------------------------
-
-ifeq ($(UNAME_S), Linux) #LINUX
- ECHO_MESSAGE = "Linux"
- LIBS += -lGL `pkg-config --static --libs glfw3`
-
- CXXFLAGS += `pkg-config --cflags glfw3`
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(UNAME_S), Darwin) #APPLE
- ECHO_MESSAGE = "Mac OS X"
- LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
- LIBS += -L/usr/local/lib -L/opt/local/lib
- #LIBS += -lglfw3
- LIBS += -lglfw
-
- CXXFLAGS += -I/usr/local/include -I/opt/local/include
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
- ECHO_MESSAGE = "MinGW"
- LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32
-
- CXXFLAGS += `pkg-config --cflags glfw3`
- CFLAGS = $(CXXFLAGS)
-endif
-
-##---------------------------------------------------------------------
-## BUILD RULES
-##---------------------------------------------------------------------
-
-%.o:%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete for $(ECHO_MESSAGE)
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
-
-clean:
- rm -f $(EXE) $(OBJS)
-
diff --git a/examples/example_glfw_opengl2/build_win32.bat b/examples/example_glfw_opengl2/build_win32.bat
deleted file mode 100644
index 538d9a52b23f..000000000000
--- a/examples/example_glfw_opengl2/build_win32.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_opengl2.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
diff --git a/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj b/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj
deleted file mode 100644
index b265fea045cd..000000000000
--- a/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj
+++ /dev/null
@@ -1,180 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {9CDA7840-B7A5-496D-A527-E95571496D18}
- example_glfw_opengl2
- 8.1
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- ..\..;..;..\libs\glfw\include;%(AdditionalIncludeDirectories)
-
-
- true
- ..\libs\glfw\lib-vc2010-32;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- ..\..;..;..\libs\glfw\include;%(AdditionalIncludeDirectories)
-
-
- true
- ..\libs\glfw\lib-vc2010-64;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;..\libs\glfw\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- ..\libs\glfw\lib-vc2010-32;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;..\libs\glfw\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- ..\libs\glfw\lib-vc2010-64;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters b/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters
deleted file mode 100644
index b7a37e68a589..000000000000
--- a/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
- {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222}
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- sources
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
deleted file mode 100644
index 411062faf74a..000000000000
--- a/examples/example_glfw_opengl2/main.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-// dear imgui: standalone example application for GLFW + OpenGL2, using legacy fixed pipeline
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
-
-// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
-// **Prefer using the code in the example_glfw_opengl2/ folder**
-// See imgui_impl_glfw.cpp for details.
-
-#include "imgui.h"
-#include "imgui_impl_glfw.h"
-#include "imgui_impl_opengl2.h"
-#include
-#ifdef __APPLE__
-#define GL_SILENCE_DEPRECATION
-#endif
-#include
-
-// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
-// To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma.
-// Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio.
-#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
-#pragma comment(lib, "legacy_stdio_definitions")
-#endif
-
-static void glfw_error_callback(int error, const char* description)
-{
- fprintf(stderr, "Glfw Error %d: %s\n", error, description);
-}
-
-int main(int, char**)
-{
- // Setup window
- glfwSetErrorCallback(glfw_error_callback);
- if (!glfwInit())
- return 1;
- GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL2 example", NULL, NULL);
- if (window == NULL)
- return 1;
- glfwMakeContextCurrent(window);
- glfwSwapInterval(1); // Enable vsync
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplGlfw_InitForOpenGL(window, true);
- ImGui_ImplOpenGL2_Init();
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- while (!glfwWindowShouldClose(window))
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- glfwPollEvents();
-
- // Start the Dear ImGui frame
- ImGui_ImplOpenGL2_NewFrame();
- ImGui_ImplGlfw_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- int display_w, display_h;
- glfwGetFramebufferSize(window, &display_w, &display_h);
- glViewport(0, 0, display_w, display_h);
- glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
- glClear(GL_COLOR_BUFFER_BIT);
-
- // If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
- // you may need to backup/reset/restore current shader using the commented lines below.
- //GLint last_program;
- //glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
- //glUseProgram(0);
- ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
- //glUseProgram(last_program);
-
- glfwMakeContextCurrent(window);
- glfwSwapBuffers(window);
- }
-
- // Cleanup
- ImGui_ImplOpenGL2_Shutdown();
- ImGui_ImplGlfw_Shutdown();
- ImGui::DestroyContext();
-
- glfwDestroyWindow(window);
- glfwTerminate();
-
- return 0;
-}
diff --git a/examples/example_glfw_opengl3/Makefile b/examples/example_glfw_opengl3/Makefile
deleted file mode 100644
index 3bc72b6f02da..000000000000
--- a/examples/example_glfw_opengl3/Makefile
+++ /dev/null
@@ -1,111 +0,0 @@
-#
-# Cross Platform Makefile
-# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
-#
-# You will need GLFW (http://www.glfw.org):
-# Linux:
-# apt-get install libglfw-dev
-# Mac OS X:
-# brew install glfw
-# MSYS2:
-# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw
-#
-
-#CXX = g++
-#CXX = clang++
-
-EXE = example_glfw_opengl3
-SOURCES = main.cpp
-SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl3.cpp
-SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-UNAME_S := $(shell uname -s)
-
-CXXFLAGS = -I../ -I../../
-CXXFLAGS += -g -Wall -Wformat
-LIBS =
-
-##---------------------------------------------------------------------
-## OPENGL LOADER
-##---------------------------------------------------------------------
-
-## Using OpenGL loader: gl3w [default]
-SOURCES += ../libs/gl3w/GL/gl3w.c
-CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
-
-## Using OpenGL loader: glew
-## (This assumes a system-wide installation)
-# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
-# LIBS += -lGLEW
-
-## Using OpenGL loader: glad
-# SOURCES += ../libs/glad/src/glad.c
-# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
-
-## Using OpenGL loader: glbinding
-## This assumes a system-wide installation
-## of either version 3.0.0 (or newer)
-# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
-# LIBS += -lglbinding
-## or the older version 2.x
-# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
-# LIBS += -lglbinding
-
-##---------------------------------------------------------------------
-## BUILD FLAGS PER PLATFORM
-##---------------------------------------------------------------------
-
-ifeq ($(UNAME_S), Linux) #LINUX
- ECHO_MESSAGE = "Linux"
- LIBS += -lGL `pkg-config --static --libs glfw3`
-
- CXXFLAGS += `pkg-config --cflags glfw3`
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(UNAME_S), Darwin) #APPLE
- ECHO_MESSAGE = "Mac OS X"
- LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
- LIBS += -L/usr/local/lib -L/opt/local/lib
- #LIBS += -lglfw3
- LIBS += -lglfw
-
- CXXFLAGS += -I/usr/local/include -I/opt/local/include
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
- ECHO_MESSAGE = "MinGW"
- LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32
-
- CXXFLAGS += `pkg-config --cflags glfw3`
- CFLAGS = $(CXXFLAGS)
-endif
-
-##---------------------------------------------------------------------
-## BUILD RULES
-##---------------------------------------------------------------------
-
-%.o:%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../libs/gl3w/GL/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-%.o:../libs/glad/src/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete for $(ECHO_MESSAGE)
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
-
-clean:
- rm -f $(EXE) $(OBJS)
diff --git a/examples/example_glfw_opengl3/build_win32.bat b/examples/example_glfw_opengl3/build_win32.bat
deleted file mode 100644
index e5c15c532ab1..000000000000
--- a/examples/example_glfw_opengl3/build_win32.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I ..\libs\gl3w *.cpp ..\imgui_impl_glfw.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_glfw_opengl3.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
diff --git a/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj b/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj
deleted file mode 100644
index 47d2538045c2..000000000000
--- a/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj
+++ /dev/null
@@ -1,183 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {4a1fb5ea-22f5-42a8-ab92-1d2df5d47fb9}
- example_glfw_opengl3
- 8.1
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- ..\..;..;..\libs\glfw\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
-
-
- true
- ..\libs\glfw\lib-vc2010-32;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- ..\..;..;..\libs\glfw\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
-
-
- true
- ..\libs\glfw\lib-vc2010-64;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;..\libs\glfw\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- ..\libs\glfw\lib-vc2010-32;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;..\libs\glfw\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- ..\libs\glfw\lib-vc2010-64;%(AdditionalLibraryDirectories)
- opengl32.lib;glfw3.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters b/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters
deleted file mode 100644
index efb570cec98b..000000000000
--- a/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
- {20b90ce4-7fcb-4731-b9a0-075f875de82d}
-
-
- {f18ab499-84e1-499f-8eff-9754361e0e52}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {42f99867-3108-43b8-99d0-fabefaf1f2e3}
-
-
-
-
- sources
-
-
- imgui
-
-
- gl3w
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- gl3w
-
-
- gl3w
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
deleted file mode 100644
index 6a3592f16257..000000000000
--- a/examples/example_glfw_opengl3/main.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-// dear imgui: standalone example application for GLFW + OpenGL 3, using programmable pipeline
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
-
-#include "imgui.h"
-#include "imgui_impl_glfw.h"
-#include "imgui_impl_opengl3.h"
-#include
-
-// About Desktop OpenGL function loaders:
-// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
-// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
-// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
-#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
-#include // Initialize with gl3wInit()
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
-#include // Initialize with glewInit()
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
-#include // Initialize with gladLoadGL()
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2)
-#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
-#include // Initialize with glbinding::Binding::initialize()
-#include
-using namespace gl;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3)
-#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
-#include // Initialize with glbinding::initialize()
-#include
-using namespace gl;
-#else
-#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
-#endif
-
-// Include glfw3.h after our OpenGL definitions
-#include
-
-// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
-// To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma.
-// Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio.
-#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
-#pragma comment(lib, "legacy_stdio_definitions")
-#endif
-
-static void glfw_error_callback(int error, const char* description)
-{
- fprintf(stderr, "Glfw Error %d: %s\n", error, description);
-}
-
-int main(int, char**)
-{
- // Setup window
- glfwSetErrorCallback(glfw_error_callback);
- if (!glfwInit())
- return 1;
-
- // Decide GL+GLSL versions
-#if __APPLE__
- // GL 3.2 + GLSL 150
- const char* glsl_version = "#version 150";
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
- glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac
-#else
- // GL 3.0 + GLSL 130
- const char* glsl_version = "#version 130";
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
- //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
- //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only
-#endif
-
- // Create window with graphics context
- GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL3 example", NULL, NULL);
- if (window == NULL)
- return 1;
- glfwMakeContextCurrent(window);
- glfwSwapInterval(1); // Enable vsync
-
- // Initialize OpenGL loader
-#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
- bool err = gl3wInit() != 0;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
- bool err = glewInit() != GLEW_OK;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
- bool err = gladLoadGL() == 0;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2)
- bool err = false;
- glbinding::Binding::initialize();
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3)
- bool err = false;
- glbinding::initialize([](const char* name) { return (glbinding::ProcAddress)glfwGetProcAddress(name); });
-#else
- bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
-#endif
- if (err)
- {
- fprintf(stderr, "Failed to initialize OpenGL loader!\n");
- return 1;
- }
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplGlfw_InitForOpenGL(window, true);
- ImGui_ImplOpenGL3_Init(glsl_version);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- while (!glfwWindowShouldClose(window))
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- glfwPollEvents();
-
- // Start the Dear ImGui frame
- ImGui_ImplOpenGL3_NewFrame();
- ImGui_ImplGlfw_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- int display_w, display_h;
- glfwGetFramebufferSize(window, &display_w, &display_h);
- glViewport(0, 0, display_w, display_h);
- glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
- glClear(GL_COLOR_BUFFER_BIT);
- ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
-
- glfwSwapBuffers(window);
- }
-
- // Cleanup
- ImGui_ImplOpenGL3_Shutdown();
- ImGui_ImplGlfw_Shutdown();
- ImGui::DestroyContext();
-
- glfwDestroyWindow(window);
- glfwTerminate();
-
- return 0;
-}
diff --git a/examples/example_glfw_vulkan/CMakeLists.txt b/examples/example_glfw_vulkan/CMakeLists.txt
deleted file mode 100644
index 68155ec88398..000000000000
--- a/examples/example_glfw_vulkan/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Example usage:
-# mkdir build
-# cd build
-# cmake -g "Visual Studio 14 2015" ..
-
-cmake_minimum_required(VERSION 2.8)
-project(imgui_example_glfw_vulkan C CXX)
-
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
-endif()
-
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES")
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES")
-
-# GLFW
-set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo
-option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
-option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
-option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
-option(GLFW_INSTALL "Generate installation target" OFF)
-option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
-add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL)
-include_directories(${GLFW_DIR}/include)
-
-# Dear ImGui
-set(IMGUI_DIR ../../)
-include_directories(${IMGUI_DIR} ..)
-
-# Libraries
-find_library(VULKAN_LIBRARY
- NAMES vulkan vulkan-1)
-set(LIBRARIES "glfw;${VULKAN_LIBRARY}")
-
-# Use vulkan headers from glfw:
-include_directories(${GLFW_DIR}/deps)
-
-file(GLOB sources *.cpp)
-
-add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/examples/imgui_impl_glfw.cpp ${IMGUI_DIR}/examples/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp ${IMGUI_DIR}/imgui_widgets.cpp)
-target_link_libraries(example_glfw_vulkan ${LIBRARIES})
diff --git a/examples/example_glfw_vulkan/build_win32.bat b/examples/example_glfw_vulkan/build_win32.bat
deleted file mode 100644
index 0d991b9d2f97..000000000000
--- a/examples/example_glfw_vulkan/build_win32.bat
+++ /dev/null
@@ -1,7 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
-
-mkdir Release
-cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
diff --git a/examples/example_glfw_vulkan/build_win64.bat b/examples/example_glfw_vulkan/build_win64.bat
deleted file mode 100644
index ddedf597c96f..000000000000
--- a/examples/example_glfw_vulkan/build_win64.bat
+++ /dev/null
@@ -1,7 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of amd64/vcvars32.bat to setup 64-bit command-line compiler.
-
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
-
-mkdir Release
-cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib
diff --git a/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj b/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj
deleted file mode 100644
index 9e2c9b3825f7..000000000000
--- a/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj
+++ /dev/null
@@ -1,180 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {57E2DF5A-6FC8-45BB-99DD-91A18C646E80}
- example_glfw_vulkan
- 8.1
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- ..\..;..;%VULKAN_SDK%\include;..\libs\glfw\include;%(AdditionalIncludeDirectories)
-
-
- true
- %VULKAN_SDK%\lib32;..\libs\glfw\lib-vc2010-32;%(AdditionalLibraryDirectories)
- vulkan-1.lib;glfw3.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- ..\..;..;%VULKAN_SDK%\include;..\libs\glfw\include;%(AdditionalIncludeDirectories)
-
-
- true
- %VULKAN_SDK%\lib;..\libs\glfw\lib-vc2010-64;%(AdditionalLibraryDirectories)
- vulkan-1.lib;glfw3.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%VULKAN_SDK%\include;..\libs\glfw\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %VULKAN_SDK%\lib32;..\libs\glfw\lib-vc2010-32;%(AdditionalLibraryDirectories)
- vulkan-1.lib;glfw3.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%VULKAN_SDK%\include;..\libs\glfw\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %VULKAN_SDK%\lib;..\libs\glfw\lib-vc2010-64;%(AdditionalLibraryDirectories)
- vulkan-1.lib;glfw3.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters b/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters
deleted file mode 100644
index 98a445d4d220..000000000000
--- a/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
- {20b90ce4-7fcb-4731-b9a0-075f875de82d}
-
-
- {f18ab499-84e1-499f-8eff-9754361e0e52}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_glfw_vulkan/gen_spv.sh b/examples/example_glfw_vulkan/gen_spv.sh
deleted file mode 100755
index e0d7f3b0286a..000000000000
--- a/examples/example_glfw_vulkan/gen_spv.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-glslangValidator -V -x -o glsl_shader.frag.u32 glsl_shader.frag
-glslangValidator -V -x -o glsl_shader.vert.u32 glsl_shader.vert
diff --git a/examples/example_glfw_vulkan/glsl_shader.frag b/examples/example_glfw_vulkan/glsl_shader.frag
deleted file mode 100644
index ce7e6f72b25d..000000000000
--- a/examples/example_glfw_vulkan/glsl_shader.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-#version 450 core
-layout(location = 0) out vec4 fColor;
-
-layout(set=0, binding=0) uniform sampler2D sTexture;
-
-layout(location = 0) in struct {
- vec4 Color;
- vec2 UV;
-} In;
-
-void main()
-{
- fColor = In.Color * texture(sTexture, In.UV.st);
-}
diff --git a/examples/example_glfw_vulkan/glsl_shader.vert b/examples/example_glfw_vulkan/glsl_shader.vert
deleted file mode 100644
index 9425365a53c3..000000000000
--- a/examples/example_glfw_vulkan/glsl_shader.vert
+++ /dev/null
@@ -1,25 +0,0 @@
-#version 450 core
-layout(location = 0) in vec2 aPos;
-layout(location = 1) in vec2 aUV;
-layout(location = 2) in vec4 aColor;
-
-layout(push_constant) uniform uPushConstant {
- vec2 uScale;
- vec2 uTranslate;
-} pc;
-
-out gl_PerVertex {
- vec4 gl_Position;
-};
-
-layout(location = 0) out struct {
- vec4 Color;
- vec2 UV;
-} Out;
-
-void main()
-{
- Out.Color = aColor;
- Out.UV = aUV;
- gl_Position = vec4(aPos * pc.uScale + pc.uTranslate, 0, 1);
-}
diff --git a/examples/example_glfw_vulkan/main.cpp b/examples/example_glfw_vulkan/main.cpp
deleted file mode 100644
index 80763a01e2d7..000000000000
--- a/examples/example_glfw_vulkan/main.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-// dear imgui: standalone example application for Glfw + Vulkan
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
-// - Common ImGui_ImplVulkan_XXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
-// You will use those if you want to use this rendering back-end in your engine/app.
-// - Helper ImGui_ImplVulkanH_XXX functions and structures are only used by this example (main.cpp) and by
-// the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
-// Read comments in imgui_impl_vulkan.h.
-
-#include "imgui.h"
-#include "imgui_impl_glfw.h"
-#include "imgui_impl_vulkan.h"
-#include // printf, fprintf
-#include // abort
-#define GLFW_INCLUDE_NONE
-#define GLFW_INCLUDE_VULKAN
-#include
-#include
-
-// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
-// To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma.
-// Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio.
-#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
-#pragma comment(lib, "legacy_stdio_definitions")
-#endif
-
-//#define IMGUI_UNLIMITED_FRAME_RATE
-#ifdef _DEBUG
-#define IMGUI_VULKAN_DEBUG_REPORT
-#endif
-
-static VkAllocationCallbacks* g_Allocator = NULL;
-static VkInstance g_Instance = VK_NULL_HANDLE;
-static VkPhysicalDevice g_PhysicalDevice = VK_NULL_HANDLE;
-static VkDevice g_Device = VK_NULL_HANDLE;
-static uint32_t g_QueueFamily = (uint32_t)-1;
-static VkQueue g_Queue = VK_NULL_HANDLE;
-static VkDebugReportCallbackEXT g_DebugReport = VK_NULL_HANDLE;
-static VkPipelineCache g_PipelineCache = VK_NULL_HANDLE;
-static VkDescriptorPool g_DescriptorPool = VK_NULL_HANDLE;
-
-static ImGui_ImplVulkanH_Window g_MainWindowData;
-static int g_MinImageCount = 2;
-static bool g_SwapChainRebuild = false;
-static int g_SwapChainResizeWidth = 0;
-static int g_SwapChainResizeHeight = 0;
-
-static void check_vk_result(VkResult err)
-{
- if (err == 0)
- return;
- fprintf(stderr, "[vulkan] Error: VkResult = %d\n", err);
- if (err < 0)
- abort();
-}
-
-#ifdef IMGUI_VULKAN_DEBUG_REPORT
-static VKAPI_ATTR VkBool32 VKAPI_CALL debug_report(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData)
-{
- (void)flags; (void)object; (void)location; (void)messageCode; (void)pUserData; (void)pLayerPrefix; // Unused arguments
- fprintf(stderr, "[vulkan] Debug report from ObjectType: %i\nMessage: %s\n\n", objectType, pMessage);
- return VK_FALSE;
-}
-#endif // IMGUI_VULKAN_DEBUG_REPORT
-
-static void SetupVulkan(const char** extensions, uint32_t extensions_count)
-{
- VkResult err;
-
- // Create Vulkan Instance
- {
- VkInstanceCreateInfo create_info = {};
- create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
- create_info.enabledExtensionCount = extensions_count;
- create_info.ppEnabledExtensionNames = extensions;
-
-#ifdef IMGUI_VULKAN_DEBUG_REPORT
- // Enabling multiple validation layers grouped as LunarG standard validation
- const char* layers[] = { "VK_LAYER_LUNARG_standard_validation" };
- create_info.enabledLayerCount = 1;
- create_info.ppEnabledLayerNames = layers;
-
- // Enable debug report extension (we need additional storage, so we duplicate the user array to add our new extension to it)
- const char** extensions_ext = (const char**)malloc(sizeof(const char*) * (extensions_count + 1));
- memcpy(extensions_ext, extensions, extensions_count * sizeof(const char*));
- extensions_ext[extensions_count] = "VK_EXT_debug_report";
- create_info.enabledExtensionCount = extensions_count + 1;
- create_info.ppEnabledExtensionNames = extensions_ext;
-
- // Create Vulkan Instance
- err = vkCreateInstance(&create_info, g_Allocator, &g_Instance);
- check_vk_result(err);
- free(extensions_ext);
-
- // Get the function pointer (required for any extensions)
- auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT");
- IM_ASSERT(vkCreateDebugReportCallbackEXT != NULL);
-
- // Setup the debug report callback
- VkDebugReportCallbackCreateInfoEXT debug_report_ci = {};
- debug_report_ci.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
- debug_report_ci.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
- debug_report_ci.pfnCallback = debug_report;
- debug_report_ci.pUserData = NULL;
- err = vkCreateDebugReportCallbackEXT(g_Instance, &debug_report_ci, g_Allocator, &g_DebugReport);
- check_vk_result(err);
-#else
- // Create Vulkan Instance without any debug feature
- err = vkCreateInstance(&create_info, g_Allocator, &g_Instance);
- check_vk_result(err);
- IM_UNUSED(g_DebugReport);
-#endif
- }
-
- // Select GPU
- {
- uint32_t gpu_count;
- err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, NULL);
- check_vk_result(err);
- IM_ASSERT(gpu_count > 0);
-
- VkPhysicalDevice* gpus = (VkPhysicalDevice*)malloc(sizeof(VkPhysicalDevice) * gpu_count);
- err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, gpus);
- check_vk_result(err);
-
- // If a number >1 of GPUs got reported, you should find the best fit GPU for your purpose
- // e.g. VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU if available, or with the greatest memory available, etc.
- // for sake of simplicity we'll just take the first one, assuming it has a graphics queue family.
- g_PhysicalDevice = gpus[0];
- free(gpus);
- }
-
- // Select graphics queue family
- {
- uint32_t count;
- vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, NULL);
- VkQueueFamilyProperties* queues = (VkQueueFamilyProperties*)malloc(sizeof(VkQueueFamilyProperties) * count);
- vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, queues);
- for (uint32_t i = 0; i < count; i++)
- if (queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
- {
- g_QueueFamily = i;
- break;
- }
- free(queues);
- IM_ASSERT(g_QueueFamily != (uint32_t)-1);
- }
-
- // Create Logical Device (with 1 queue)
- {
- int device_extension_count = 1;
- const char* device_extensions[] = { "VK_KHR_swapchain" };
- const float queue_priority[] = { 1.0f };
- VkDeviceQueueCreateInfo queue_info[1] = {};
- queue_info[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queue_info[0].queueFamilyIndex = g_QueueFamily;
- queue_info[0].queueCount = 1;
- queue_info[0].pQueuePriorities = queue_priority;
- VkDeviceCreateInfo create_info = {};
- create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
- create_info.queueCreateInfoCount = sizeof(queue_info) / sizeof(queue_info[0]);
- create_info.pQueueCreateInfos = queue_info;
- create_info.enabledExtensionCount = device_extension_count;
- create_info.ppEnabledExtensionNames = device_extensions;
- err = vkCreateDevice(g_PhysicalDevice, &create_info, g_Allocator, &g_Device);
- check_vk_result(err);
- vkGetDeviceQueue(g_Device, g_QueueFamily, 0, &g_Queue);
- }
-
- // Create Descriptor Pool
- {
- VkDescriptorPoolSize pool_sizes[] =
- {
- { VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
- { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1000 },
- { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1000 },
- { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 1000 },
- { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1000 }
- };
- VkDescriptorPoolCreateInfo pool_info = {};
- pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
- pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
- pool_info.maxSets = 1000 * IM_ARRAYSIZE(pool_sizes);
- pool_info.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes);
- pool_info.pPoolSizes = pool_sizes;
- err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &g_DescriptorPool);
- check_vk_result(err);
- }
-}
-
-// All the ImGui_ImplVulkanH_XXX structures/functions are optional helpers used by the demo.
-// Your real engine/app may not use them.
-static void SetupVulkanWindow(ImGui_ImplVulkanH_Window* wd, VkSurfaceKHR surface, int width, int height)
-{
- wd->Surface = surface;
-
- // Check for WSI support
- VkBool32 res;
- vkGetPhysicalDeviceSurfaceSupportKHR(g_PhysicalDevice, g_QueueFamily, wd->Surface, &res);
- if (res != VK_TRUE)
- {
- fprintf(stderr, "Error no WSI support on physical device 0\n");
- exit(-1);
- }
-
- // Select Surface Format
- const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
- const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
- wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
-
- // Select Present Mode
-#ifdef IMGUI_UNLIMITED_FRAME_RATE
- VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR };
-#else
- VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR };
-#endif
- wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_modes[0], IM_ARRAYSIZE(present_modes));
- //printf("[vulkan] Selected PresentMode = %d\n", wd->PresentMode);
-
- // Create SwapChain, RenderPass, Framebuffer, etc.
- IM_ASSERT(g_MinImageCount >= 2);
- ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, wd, g_QueueFamily, g_Allocator, width, height, g_MinImageCount);
-}
-
-static void CleanupVulkan()
-{
- vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator);
-
-#ifdef IMGUI_VULKAN_DEBUG_REPORT
- // Remove the debug report callback
- auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT");
- vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator);
-#endif // IMGUI_VULKAN_DEBUG_REPORT
-
- vkDestroyDevice(g_Device, g_Allocator);
- vkDestroyInstance(g_Instance, g_Allocator);
-}
-
-static void CleanupVulkanWindow()
-{
- ImGui_ImplVulkanH_DestroyWindow(g_Instance, g_Device, &g_MainWindowData, g_Allocator);
-}
-
-static void FrameRender(ImGui_ImplVulkanH_Window* wd, ImDrawData* draw_data)
-{
- VkResult err;
-
- VkSemaphore image_acquired_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].ImageAcquiredSemaphore;
- VkSemaphore render_complete_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].RenderCompleteSemaphore;
- err = vkAcquireNextImageKHR(g_Device, wd->Swapchain, UINT64_MAX, image_acquired_semaphore, VK_NULL_HANDLE, &wd->FrameIndex);
- check_vk_result(err);
-
- ImGui_ImplVulkanH_Frame* fd = &wd->Frames[wd->FrameIndex];
- {
- err = vkWaitForFences(g_Device, 1, &fd->Fence, VK_TRUE, UINT64_MAX); // wait indefinitely instead of periodically checking
- check_vk_result(err);
-
- err = vkResetFences(g_Device, 1, &fd->Fence);
- check_vk_result(err);
- }
- {
- err = vkResetCommandPool(g_Device, fd->CommandPool, 0);
- check_vk_result(err);
- VkCommandBufferBeginInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- err = vkBeginCommandBuffer(fd->CommandBuffer, &info);
- check_vk_result(err);
- }
- {
- VkRenderPassBeginInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
- info.renderPass = wd->RenderPass;
- info.framebuffer = fd->Framebuffer;
- info.renderArea.extent.width = wd->Width;
- info.renderArea.extent.height = wd->Height;
- info.clearValueCount = 1;
- info.pClearValues = &wd->ClearValue;
- vkCmdBeginRenderPass(fd->CommandBuffer, &info, VK_SUBPASS_CONTENTS_INLINE);
- }
-
- // Record dear imgui primitives into command buffer
- ImGui_ImplVulkan_RenderDrawData(draw_data, fd->CommandBuffer);
-
- // Submit command buffer
- vkCmdEndRenderPass(fd->CommandBuffer);
- {
- VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
- VkSubmitInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- info.waitSemaphoreCount = 1;
- info.pWaitSemaphores = &image_acquired_semaphore;
- info.pWaitDstStageMask = &wait_stage;
- info.commandBufferCount = 1;
- info.pCommandBuffers = &fd->CommandBuffer;
- info.signalSemaphoreCount = 1;
- info.pSignalSemaphores = &render_complete_semaphore;
-
- err = vkEndCommandBuffer(fd->CommandBuffer);
- check_vk_result(err);
- err = vkQueueSubmit(g_Queue, 1, &info, fd->Fence);
- check_vk_result(err);
- }
-}
-
-static void FramePresent(ImGui_ImplVulkanH_Window* wd)
-{
- VkSemaphore render_complete_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].RenderCompleteSemaphore;
- VkPresentInfoKHR info = {};
- info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
- info.waitSemaphoreCount = 1;
- info.pWaitSemaphores = &render_complete_semaphore;
- info.swapchainCount = 1;
- info.pSwapchains = &wd->Swapchain;
- info.pImageIndices = &wd->FrameIndex;
- VkResult err = vkQueuePresentKHR(g_Queue, &info);
- check_vk_result(err);
- wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->ImageCount; // Now we can use the next set of semaphores
-}
-
-static void glfw_error_callback(int error, const char* description)
-{
- fprintf(stderr, "Glfw Error %d: %s\n", error, description);
-}
-
-static void glfw_resize_callback(GLFWwindow*, int w, int h)
-{
- g_SwapChainRebuild = true;
- g_SwapChainResizeWidth = w;
- g_SwapChainResizeHeight = h;
-}
-
-int main(int, char**)
-{
- // Setup GLFW window
- glfwSetErrorCallback(glfw_error_callback);
- if (!glfwInit())
- return 1;
-
- glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
- GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+Vulkan example", NULL, NULL);
-
- // Setup Vulkan
- if (!glfwVulkanSupported())
- {
- printf("GLFW: Vulkan Not Supported\n");
- return 1;
- }
- uint32_t extensions_count = 0;
- const char** extensions = glfwGetRequiredInstanceExtensions(&extensions_count);
- SetupVulkan(extensions, extensions_count);
-
- // Create Window Surface
- VkSurfaceKHR surface;
- VkResult err = glfwCreateWindowSurface(g_Instance, window, g_Allocator, &surface);
- check_vk_result(err);
-
- // Create Framebuffers
- int w, h;
- glfwGetFramebufferSize(window, &w, &h);
- glfwSetFramebufferSizeCallback(window, glfw_resize_callback);
- ImGui_ImplVulkanH_Window* wd = &g_MainWindowData;
- SetupVulkanWindow(wd, surface, w, h);
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplGlfw_InitForVulkan(window, true);
- ImGui_ImplVulkan_InitInfo init_info = {};
- init_info.Instance = g_Instance;
- init_info.PhysicalDevice = g_PhysicalDevice;
- init_info.Device = g_Device;
- init_info.QueueFamily = g_QueueFamily;
- init_info.Queue = g_Queue;
- init_info.PipelineCache = g_PipelineCache;
- init_info.DescriptorPool = g_DescriptorPool;
- init_info.Allocator = g_Allocator;
- init_info.MinImageCount = g_MinImageCount;
- init_info.ImageCount = wd->ImageCount;
- init_info.CheckVkResultFn = check_vk_result;
- ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Upload Fonts
- {
- // Use any command queue
- VkCommandPool command_pool = wd->Frames[wd->FrameIndex].CommandPool;
- VkCommandBuffer command_buffer = wd->Frames[wd->FrameIndex].CommandBuffer;
-
- err = vkResetCommandPool(g_Device, command_pool, 0);
- check_vk_result(err);
- VkCommandBufferBeginInfo begin_info = {};
- begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- begin_info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- err = vkBeginCommandBuffer(command_buffer, &begin_info);
- check_vk_result(err);
-
- ImGui_ImplVulkan_CreateFontsTexture(command_buffer);
-
- VkSubmitInfo end_info = {};
- end_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- end_info.commandBufferCount = 1;
- end_info.pCommandBuffers = &command_buffer;
- err = vkEndCommandBuffer(command_buffer);
- check_vk_result(err);
- err = vkQueueSubmit(g_Queue, 1, &end_info, VK_NULL_HANDLE);
- check_vk_result(err);
-
- err = vkDeviceWaitIdle(g_Device);
- check_vk_result(err);
- ImGui_ImplVulkan_DestroyFontUploadObjects();
- }
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- while (!glfwWindowShouldClose(window))
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- glfwPollEvents();
-
- // Resize swap chain?
- if (g_SwapChainRebuild && g_SwapChainResizeWidth > 0 && g_SwapChainResizeHeight > 0)
- {
- g_SwapChainRebuild = false;
- ImGui_ImplVulkan_SetMinImageCount(g_MinImageCount);
- ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, &g_MainWindowData, g_QueueFamily, g_Allocator, g_SwapChainResizeWidth, g_SwapChainResizeHeight, g_MinImageCount);
- g_MainWindowData.FrameIndex = 0;
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplVulkan_NewFrame();
- ImGui_ImplGlfw_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- ImDrawData* draw_data = ImGui::GetDrawData();
- const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
- if (!is_minimized)
- {
- FrameRender(wd, draw_data);
- FramePresent(wd);
- }
- }
-
- // Cleanup
- err = vkDeviceWaitIdle(g_Device);
- check_vk_result(err);
- ImGui_ImplVulkan_Shutdown();
- ImGui_ImplGlfw_Shutdown();
- ImGui::DestroyContext();
-
- CleanupVulkanWindow();
- CleanupVulkan();
-
- glfwDestroyWindow(window);
- glfwTerminate();
-
- return 0;
-}
diff --git a/examples/example_glut_opengl2/Makefile b/examples/example_glut_opengl2/Makefile
deleted file mode 100644
index 70576b8f944e..000000000000
--- a/examples/example_glut_opengl2/Makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# Cross Platform Makefile
-# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
-#
-# Linux:
-# apt-get install freeglut3-dev
-#
-
-#CXX = g++
-#CXX = clang++
-
-EXE = example_glut_opengl2
-SOURCES = main.cpp
-SOURCES += ../imgui_impl_glut.cpp ../imgui_impl_opengl2.cpp
-SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-UNAME_S := $(shell uname -s)
-
-CXXFLAGS = -I../ -I../../
-CXXFLAGS += -g -Wall -Wformat
-LIBS =
-
-##---------------------------------------------------------------------
-## BUILD FLAGS PER PLATFORM
-##---------------------------------------------------------------------
-
-ifeq ($(UNAME_S), Linux) #LINUX
- ECHO_MESSAGE = "Linux"
- LIBS += -lGL -lglut
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(UNAME_S), Darwin) #APPLE
- ECHO_MESSAGE = "Mac OS X"
- LIBS += -framework OpenGL -framework GLUT
- LIBS += -L/usr/local/lib -L/opt/local/lib
-
- CXXFLAGS += -I/usr/local/include -I/opt/local/include
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
- ECHO_MESSAGE = "MinGW"
- LIBS += -lgdi32 -lopengl32 -limm32
-ifeq ($(shell pkg-config freeglut --exists 2> /dev/null && echo yes || echo no),yes)
- CXXFLAGS += $(shell pkg-config freeglut --cflags)
- LIBS += $(shell pkg-config freeglut --libs)
-else
- LIBS += -lglut
-endif
- CFLAGS = $(CXXFLAGS)
-endif
-
-##---------------------------------------------------------------------
-## BUILD RULES
-##---------------------------------------------------------------------
-
-%.o:%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete for $(ECHO_MESSAGE)
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
-
-clean:
- rm -f $(EXE) $(OBJS)
diff --git a/examples/example_glut_opengl2/example_glut_opengl2.vcxproj b/examples/example_glut_opengl2/example_glut_opengl2.vcxproj
deleted file mode 100644
index 9a23951694ff..000000000000
--- a/examples/example_glut_opengl2/example_glut_opengl2.vcxproj
+++ /dev/null
@@ -1,180 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {F90D0333-5FB1-440D-918D-DD39A1B5187E}
- example_glut_opengl2
- 8.1
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- $(GLUT_INCLUDE_DIR);..\..;%(AdditionalIncludeDirectories)
-
-
- true
- $(GLUT_ROOT_PATH)/lib;%(AdditionalLibraryDirectories)
- opengl32.lib;freeglut.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- $(GLUT_INCLUDE_DIR);..\..;%(AdditionalIncludeDirectories)
-
-
- true
- $(GLUT_ROOT_PATH)/lib/x64;%(AdditionalLibraryDirectories)
- opengl32.lib;freeglut.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- $(GLUT_INCLUDE_DIR);..\..;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- $(GLUT_ROOT_PATH)/lib;%(AdditionalLibraryDirectories)
- opengl32.lib;freeglut.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- $(GLUT_INCLUDE_DIR);..\..;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- $(GLUT_ROOT_PATH)/lib/x64;%(AdditionalLibraryDirectories)
- opengl32.lib;freeglut.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_glut_opengl2/example_glut_opengl2.vcxproj.filters b/examples/example_glut_opengl2/example_glut_opengl2.vcxproj.filters
deleted file mode 100644
index 290d43d7bc8f..000000000000
--- a/examples/example_glut_opengl2/example_glut_opengl2.vcxproj.filters
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
- {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222}
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- sources
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
-
- sources
-
-
-
diff --git a/examples/example_glut_opengl2/main.cpp b/examples/example_glut_opengl2/main.cpp
deleted file mode 100644
index 997eeaef339f..000000000000
--- a/examples/example_glut_opengl2/main.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-// dear imgui: standalone example application for GLUT/FreeGLUT + OpenGL2, using legacy fixed pipeline
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-// !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!!
-// !!! If someone or something is teaching you GLUT in 2020, you are being abused. Please show some resistance. !!!
-// !!! Nowadays, prefer using GLFW or SDL instead!
-
-#include "imgui.h"
-#include "imgui_impl_glut.h"
-#include "imgui_impl_opengl2.h"
-#ifdef __APPLE__
- #include
-#else
- #include
-#endif
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4505) // unreferenced local function has been removed
-#endif
-
-// Our state
-static bool show_demo_window = true;
-static bool show_another_window = false;
-static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
-void my_display_code()
-{
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-}
-
-void glut_display_func()
-{
- // Start the Dear ImGui frame
- ImGui_ImplOpenGL2_NewFrame();
- ImGui_ImplGLUT_NewFrame();
-
- my_display_code();
-
- // Rendering
- ImGui::Render();
- ImGuiIO& io = ImGui::GetIO();
- glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y);
- glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
- glClear(GL_COLOR_BUFFER_BIT);
- //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound, but prefer using the GL3+ code.
- ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
-
- glutSwapBuffers();
- glutPostRedisplay();
-}
-
-// 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.
-// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
-
-int main(int argc, char** argv)
-{
- // Create GLUT window
- glutInit(&argc, argv);
-#ifdef __FREEGLUT_EXT_H__
- glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
-#endif
- glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
- glutInitWindowSize(1280, 720);
- glutCreateWindow("Dear ImGui GLUT+OpenGL2 Example");
-
- // Setup GLUT display function
- // We will also call ImGui_ImplGLUT_InstallFuncs() to get all the other functions installed for us,
- // otherwise it is possible to install our own functions and call the imgui_impl_glut.h functions ourselves.
- glutDisplayFunc(glut_display_func);
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplGLUT_Init();
- ImGui_ImplGLUT_InstallFuncs();
- ImGui_ImplOpenGL2_Init();
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- glutMainLoop();
-
- // Cleanup
- ImGui_ImplOpenGL2_Shutdown();
- ImGui_ImplGLUT_Shutdown();
- ImGui::DestroyContext();
-
- return 0;
-}
diff --git a/examples/example_marmalade/data/app.icf b/examples/example_marmalade/data/app.icf
deleted file mode 100644
index fcd6585a4f47..000000000000
--- a/examples/example_marmalade/data/app.icf
+++ /dev/null
@@ -1,32 +0,0 @@
-# This file is for configuration settings for your
-# application.
-#
-# The syntax is similar to windows .ini files ie
-#
-# [GroupName]
-# Setting = Value
-#
-# Which can be read by your application using
-# e.g s3eConfigGetString("GroupName", "Setting", string)
-#
-# All settings must be documented in .config.txt files.
-# New settings specific to this application should be
-# documented in app.config.txt
-#
-# Some conditional operations are also permitted, see the
-# S3E documentation for details.
-
-[S3E]
-MemSize=6000000
-MemSizeDebug=6000000
-DispFixRot=FixedLandscape
-
-# emulate iphone 5 resolution, change these settings to emulate other display resolution
-WinWidth=1136
-WinHeight=640
-
-[GX]
-DataCacheSize=131070
-
-[Util]
-#MemoryBreakpoint=1282
diff --git a/examples/example_marmalade/main.cpp b/examples/example_marmalade/main.cpp
deleted file mode 100644
index 9f2ef7987f2e..000000000000
--- a/examples/example_marmalade/main.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-// dear imgui: standalone example application for Marmalade
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-// Copyright (C) 2015 by Giovanni Zito
-// This file is part of Dear ImGui
-
-#include "imgui.h"
-#include "imgui_impl_marmalade.h"
-#include
-
-#include
-#include
-#include
-
-int main(int, char**)
-{
- IwGxInit();
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_Marmalade_Init(true);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- while (true)
- {
- if (s3eDeviceCheckQuitRequest())
- break;
-
- // Poll and handle inputs
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- s3eKeyboardUpdate();
- s3ePointerUpdate();
-
- // Start the Dear ImGui frame
- ImGui_Marmalade_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
- IwGxClear();
- ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData());
- IwGxSwapBuffers();
-
- s3eDeviceYield(0);
- }
-
- // Cleanup
- ImGui_Marmalade_Shutdown();
- ImGui::DestroyContext();
- IwGxTerminate();
-
- return 0;
-}
diff --git a/examples/example_marmalade/marmalade_example.mkb b/examples/example_marmalade/marmalade_example.mkb
deleted file mode 100644
index 34315b9a7293..000000000000
--- a/examples/example_marmalade/marmalade_example.mkb
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env mkb
-
-# ImGui - standalone example application for Marmalade
-# Copyright (C) 2015 by Giovanni Zito
-# This file is part of ImGui
-# https://github.com/ocornut/imgui
-
-define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
-define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
-define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
-define _snprintf=snprintf
-
-options
-{
- optimise-speed=1
-}
-
-includepaths
-{
- ..
- ../..
-}
-
-subprojects
-{
- iwgx
-}
-
-files
-{
- (.)
- ["imgui"]
- ../../imgui.cpp
- ../../imgui_demo.cpp
- ../../imgui_draw.cpp
- ../../imgui_widgets.cpp
- ../../imconfig.h
- ../../imgui.h
- ../../imgui_internal.h
-
- ["imgui","Marmalade binding"]
- ../imgui_impl_marmalade.h
- ../imgui_impl_marmalade.cpp
- main.cpp
-
-}
diff --git a/examples/example_null/Makefile b/examples/example_null/Makefile
deleted file mode 100644
index 15c547a5f4a9..000000000000
--- a/examples/example_null/Makefile
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# Cross Platform Makefile
-# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
-#
-# Important: This is a "null back-end" application, with no visible output or interaction!
-# This is used for testing purpose and continuous integration, and has little use for end-user.
-#
-
-# Options
-WITH_EXTRA_WARNINGS ?= 0
-WITH_FREETYPE ?= 0
-
-EXE = example_null
-SOURCES = main.cpp
-SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-UNAME_S := $(shell uname -s)
-
-CXXFLAGS += -I../ -I../../
-CXXFLAGS += -g -Wall -Wformat
-LIBS =
-
-# We use the WITH_EXTRA_WARNINGS flag on our CI setup to eagerly catch zealous warnings
-ifeq ($(WITH_EXTRA_WARNINGS), 1)
- CXXFLAGS += -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros
-endif
-
-# We use the WITH_FREETYPE flag on our CI setup to test compiling misc/freetype/imgui_freetype.cpp
-# (only supported on Linux, and note that the imgui_freetype code currently won't be executed)
-ifeq ($(WITH_FREETYPE), 1)
- SOURCES += ../../misc/freetype/imgui_freetype.cpp
- CXXFLAGS += $(shell pkg-config --cflags freetype2)
- LIBS += $(shell pkg-config --libs freetype2)
-endif
-
-##---------------------------------------------------------------------
-## BUILD FLAGS PER PLATFORM
-##---------------------------------------------------------------------
-
-ifeq ($(UNAME_S), Linux) #LINUX
- ECHO_MESSAGE = "Linux"
- ifneq ($(WITH_EXTRA_WARNINGS), 0)
- CXXFLAGS += -Wextra -Wpedantic
- ifeq ($(shell $(CXX) -v 2>&1 | grep -c "clang version"), 1)
- CXXFLAGS += -Wshadow -Wsign-conversion
- endif
- endif
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(UNAME_S), Darwin) #APPLE
- ECHO_MESSAGE = "Mac OS X"
- ifneq ($(WITH_EXTRA_WARNINGS), 0)
- CXXFLAGS += -Weverything -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-padded -Wno-c++11-long-long
- endif
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
- ECHO_MESSAGE = "MinGW"
- ifneq ($(WITH_EXTRA_WARNINGS), 0)
- CXXFLAGS += -Wextra -Wpedantic
- endif
- CFLAGS = $(CXXFLAGS)
-endif
-
-##---------------------------------------------------------------------
-## BUILD RULES
-##---------------------------------------------------------------------
-
-%.o:%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../misc/freetype/%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete for $(ECHO_MESSAGE)
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
-
-clean:
- rm -f $(EXE) $(OBJS)
diff --git a/examples/example_null/build_win32.bat b/examples/example_null/build_win32.bat
deleted file mode 100644
index 38e791481e0b..000000000000
--- a/examples/example_null/build_win32.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-mkdir Debug
-cl /nologo /Zi /MD /I ..\.. %* *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib
diff --git a/examples/example_null/main.cpp b/examples/example_null/main.cpp
deleted file mode 100644
index aa2f6dba5741..000000000000
--- a/examples/example_null/main.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// dear imgui: null/dummy example application
-// (compile and link imgui, create context, run headless with NO INPUTS, NO GRAPHICS OUTPUT)
-// This is useful to test building, but you cannot interact with anything here!
-#include "imgui.h"
-#include
-
-int main(int, char**)
-{
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO();
-
- // Build atlas
- unsigned char* tex_pixels = NULL;
- int tex_w, tex_h;
- io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h);
-
- for (int n = 0; n < 20; n++)
- {
- printf("NewFrame() %d\n", n);
- io.DisplaySize = ImVec2(1920, 1080);
- io.DeltaTime = 1.0f / 60.0f;
- ImGui::NewFrame();
-
- static float f = 0.0f;
- ImGui::Text("Hello, world!");
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
- ImGui::ShowDemoWindow(NULL);
-
- ImGui::Render();
- }
-
- printf("DestroyContext()\n");
- ImGui::DestroyContext();
- return 0;
-}
diff --git a/examples/example_sdl_directx11/build_win32.bat b/examples/example_sdl_directx11/build_win32.bat
deleted file mode 100644
index 8fc702bb618f..000000000000
--- a/examples/example_sdl_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_sdl_directx11
-set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include"
-set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\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
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj b/examples/example_sdl_directx11/example_sdl_directx11.vcxproj
deleted file mode 100644
index 804bd500d78c..000000000000
--- a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj
+++ /dev/null
@@ -1,181 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {9E1987E3-1F19-45CA-B9C9-D31E791836D8}
- example_sdl_directx11
- 8.1
- example_sdl_directx11
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- ..\..;..;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
-
-
- true
- %SDL2_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- ..\..;..;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
-
-
- true
- %SDL2_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %SDL2_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %SDL2_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters b/examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters
deleted file mode 100644
index 879f0dbe623a..000000000000
--- a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6}
-
-
- {08e36723-ce4f-4cff-9662-c40801cf1acf}
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
- imgui
-
-
- sources
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- imgui
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_sdl_directx11/main.cpp b/examples/example_sdl_directx11/main.cpp
deleted file mode 100644
index 61a93070937c..000000000000
--- a/examples/example_sdl_directx11/main.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-// dear imgui: standalone example application for SDL2 + DirectX 11
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
-
-#include "imgui.h"
-#include "imgui_impl_sdl.h"
-#include "imgui_impl_dx11.h"
-#include
-#include
-#include
-#include
-
-// Data
-static ID3D11Device* g_pd3dDevice = NULL;
-static ID3D11DeviceContext* g_pd3dDeviceContext = NULL;
-static IDXGISwapChain* g_pSwapChain = NULL;
-static ID3D11RenderTargetView* g_mainRenderTargetView = NULL;
-
-// Forward declarations of helper functions
-bool CreateDeviceD3D(HWND hWnd);
-void CleanupDeviceD3D();
-void CreateRenderTarget();
-void CleanupRenderTarget();
-
-// Main code
-int main(int, char**)
-{
- // Setup SDL
- // (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
- // depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
- {
- printf("Error: %s\n", SDL_GetError());
- return -1;
- }
-
- // Setup window
- SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
- SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+DirectX11 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
- SDL_SysWMinfo wmInfo;
- SDL_VERSION(&wmInfo.version);
- SDL_GetWindowWMInfo(window, &wmInfo);
- HWND hwnd = (HWND)wmInfo.info.win.window;
-
- // Initialize Direct3D
- if (!CreateDeviceD3D(hwnd))
- {
- CleanupDeviceD3D();
- return 1;
- }
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplSDL2_InitForD3D(window);
- ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- bool done = false;
- while (!done)
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- SDL_Event event;
- while (SDL_PollEvent(&event))
- {
- ImGui_ImplSDL2_ProcessEvent(&event);
- if (event.type == SDL_QUIT)
- done = true;
- if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
- done = true;
- if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED && event.window.windowID == SDL_GetWindowID(window))
- {
- // Release all outstanding references to the swap chain's buffers before resizing.
- CleanupRenderTarget();
- g_pSwapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
- CreateRenderTarget();
- }
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplDX11_NewFrame();
- ImGui_ImplSDL2_NewFrame(window);
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- g_pd3dDeviceContext->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
- g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color);
- ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
-
- g_pSwapChain->Present(1, 0); // Present with vsync
- //g_pSwapChain->Present(0, 0); // Present without vsync
- }
-
- // Cleanup
- ImGui_ImplDX11_Shutdown();
- ImGui_ImplSDL2_Shutdown();
- ImGui::DestroyContext();
-
- CleanupDeviceD3D();
- SDL_DestroyWindow(window);
- SDL_Quit();
-
- return 0;
-}
-
-// Helper functions
-
-bool CreateDeviceD3D(HWND hWnd)
-{
- // Setup swap chain
- DXGI_SWAP_CHAIN_DESC sd;
- ZeroMemory(&sd, sizeof(sd));
- sd.BufferCount = 2;
- sd.BufferDesc.Width = 0;
- sd.BufferDesc.Height = 0;
- sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- sd.BufferDesc.RefreshRate.Numerator = 60;
- sd.BufferDesc.RefreshRate.Denominator = 1;
- sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
- sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- sd.OutputWindow = hWnd;
- sd.SampleDesc.Count = 1;
- sd.SampleDesc.Quality = 0;
- sd.Windowed = TRUE;
- sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-
- UINT createDeviceFlags = 0;
- //createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
- D3D_FEATURE_LEVEL featureLevel;
- const D3D_FEATURE_LEVEL featureLevelArray[2] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0, };
- if (D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext) != S_OK)
- return false;
-
- CreateRenderTarget();
- return true;
-}
-
-void CleanupDeviceD3D()
-{
- CleanupRenderTarget();
- if (g_pSwapChain) { g_pSwapChain->Release(); g_pSwapChain = NULL; }
- if (g_pd3dDeviceContext) { g_pd3dDeviceContext->Release(); g_pd3dDeviceContext = NULL; }
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
-}
-
-void CreateRenderTarget()
-{
- ID3D11Texture2D* pBackBuffer;
- g_pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
- g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_mainRenderTargetView);
- pBackBuffer->Release();
-}
-
-void CleanupRenderTarget()
-{
- if (g_mainRenderTargetView) { g_mainRenderTargetView->Release(); g_mainRenderTargetView = NULL; }
-}
diff --git a/examples/example_sdl_metal/Makefile b/examples/example_sdl_metal/Makefile
deleted file mode 100644
index 9d0d5e0f0c22..000000000000
--- a/examples/example_sdl_metal/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# You will need SDL2 (http://www.libsdl.org):
-# brew install sdl2
-#
-
-#CXX = g++
-#CXX = clang++
-
-EXE = example_sdl_metal
-SOURCES = main.mm
-SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_metal.mm
-SOURCES += ../../imgui.cpp ../../imgui_widgets.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-
-LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore
-LIBS += `sdl2-config --libs`
-LIBS += -L/usr/local/lib
-
-CXXFLAGS = -I../ -I../../ -I/usr/local/include
-CXXFLAGS += `sdl2-config --cflags`
-CXXFLAGS += -Wall -Wformat
-CFLAGS = $(CXXFLAGS)
-
-%.o:%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.mm
- $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $<
-
-%.o:%.mm
- $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
-
-clean:
- rm -f $(EXE) $(OBJS)
diff --git a/examples/example_sdl_metal/main.mm b/examples/example_sdl_metal/main.mm
deleted file mode 100644
index 3cb1ea4d3d57..000000000000
--- a/examples/example_sdl_metal/main.mm
+++ /dev/null
@@ -1,179 +0,0 @@
-// Dear ImGui: standalone example application for SDL2 + Metal
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
-
-#include "imgui.h"
-#include "imgui_impl_sdl.h"
-#include "imgui_impl_metal.h"
-#include
-#include
-
-#import
-#import
-
-int main(int, char**)
-{
- // Setup Dear ImGui binding
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.txt' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Setup SDL
- // (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
- // depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
- {
- printf("Error: %s\n", SDL_GetError());
- return -1;
- }
-
- // Inform SDL that we will be using metal for rendering. Without this hint initialization of metal renderer may fail.
- SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal");
-
- SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL+Metal example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
- if (window == NULL)
- {
- printf("Error creating window: %s\n", SDL_GetError());
- return -2;
- }
-
- SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
- if (renderer == NULL)
- {
- printf("Error creating renderer: %s\n", SDL_GetError());
- return -3;
- }
-
- CAMetalLayer* layer = (__bridge CAMetalLayer*)SDL_RenderGetMetalLayer(renderer);
- layer.pixelFormat = MTLPixelFormatBGRA8Unorm;
- ImGui_ImplMetal_Init(layer.device);
- ImGui_ImplSDL2_InitForMetal(window);
-
- id commandQueue = [layer.device newCommandQueue];
- MTLRenderPassDescriptor* renderPassDescriptor = [MTLRenderPassDescriptor new];
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- float clear_color[4] = {0.45f, 0.55f, 0.60f, 1.00f};
-
- // Main loop
- bool done = false;
- while (!done)
- {
- @autoreleasepool
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- SDL_Event event;
- while (SDL_PollEvent(&event))
- {
- ImGui_ImplSDL2_ProcessEvent(&event);
- if (event.type == SDL_QUIT)
- done = true;
- if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
- done = true;
- }
-
- int width, height;
- SDL_GetRendererOutputSize(renderer, &width, &height);
- layer.drawableSize = CGSizeMake(width, height);
- id drawable = [layer nextDrawable];
-
- id commandBuffer = [commandQueue commandBuffer];
- renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clear_color[0], clear_color[1], clear_color[2], clear_color[3]);
- renderPassDescriptor.colorAttachments[0].texture = drawable.texture;
- renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionClear;
- renderPassDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore;
- id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor];
- [renderEncoder pushDebugGroup:@"ImGui demo"];
-
- // Start the Dear ImGui frame
- ImGui_ImplMetal_NewFrame(renderPassDescriptor);
- ImGui_ImplSDL2_NewFrame(window);
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- ImGui_ImplMetal_RenderDrawData(ImGui::GetDrawData(), commandBuffer, renderEncoder);
-
- [renderEncoder popDebugGroup];
- [renderEncoder endEncoding];
-
- [commandBuffer presentDrawable:drawable];
- [commandBuffer commit];
- }
- }
-
- // Cleanup
- ImGui_ImplMetal_Shutdown();
- ImGui_ImplSDL2_Shutdown();
- ImGui::DestroyContext();
-
- SDL_DestroyRenderer(renderer);
- SDL_DestroyWindow(window);
- SDL_Quit();
-
- return 0;
-}
diff --git a/examples/example_sdl_opengl3/Makefile b/examples/example_sdl_opengl3/Makefile
deleted file mode 100644
index 41826741b27f..000000000000
--- a/examples/example_sdl_opengl3/Makefile
+++ /dev/null
@@ -1,110 +0,0 @@
-#
-# Cross Platform Makefile
-# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
-#
-# You will need SDL2 (http://www.libsdl.org):
-# Linux:
-# apt-get install libsdl2-dev
-# Mac OS X:
-# brew install sdl2
-# MSYS2:
-# pacman -S mingw-w64-i686-SDL2
-#
-
-#CXX = g++
-#CXX = clang++
-
-EXE = example_sdl_opengl3
-SOURCES = main.cpp
-SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp
-SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
-OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
-UNAME_S := $(shell uname -s)
-
-CXXFLAGS = -I../ -I../../
-CXXFLAGS += -g -Wall -Wformat
-LIBS =
-
-##---------------------------------------------------------------------
-## OPENGL LOADER
-##---------------------------------------------------------------------
-
-## Using OpenGL loader: gl3w [default]
-SOURCES += ../libs/gl3w/GL/gl3w.c
-CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
-
-## Using OpenGL loader: glew
-## (This assumes a system-wide installation)
-# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
-# LIBS += -lGLEW
-
-## Using OpenGL loader: glad
-# SOURCES += ../libs/glad/src/glad.c
-# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
-
-## Using OpenGL loader: glbinding
-## This assumes a system-wide installation
-## of either version 3.0.0 (or newer)
-# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
-# LIBS += -lglbinding
-## or the older version 2.x
-# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
-# LIBS += -lglbinding
-
-##---------------------------------------------------------------------
-## BUILD FLAGS PER PLATFORM
-##---------------------------------------------------------------------
-
-ifeq ($(UNAME_S), Linux) #LINUX
- ECHO_MESSAGE = "Linux"
- LIBS += -lGL -ldl `sdl2-config --libs`
-
- CXXFLAGS += `sdl2-config --cflags`
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(UNAME_S), Darwin) #APPLE
- ECHO_MESSAGE = "Mac OS X"
- LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
- LIBS += -L/usr/local/lib -L/opt/local/lib
-
- CXXFLAGS += `sdl2-config --cflags`
- CXXFLAGS += -I/usr/local/include -I/opt/local/include
- CFLAGS = $(CXXFLAGS)
-endif
-
-ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
- ECHO_MESSAGE = "MinGW"
- LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2`
-
- CXXFLAGS += `pkg-config --cflags sdl2`
- CFLAGS = $(CXXFLAGS)
-endif
-
-##---------------------------------------------------------------------
-## BUILD RULES
-##---------------------------------------------------------------------
-
-%.o:%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../../%.cpp
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-
-%.o:../libs/gl3w/GL/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-%.o:../libs/glad/src/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-all: $(EXE)
- @echo Build complete for $(ECHO_MESSAGE)
-
-$(EXE): $(OBJS)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
-
-clean:
- rm -f $(EXE) $(OBJS)
diff --git a/examples/example_sdl_opengl3/README.md b/examples/example_sdl_opengl3/README.md
deleted file mode 100644
index ec21fb78aac0..000000000000
--- a/examples/example_sdl_opengl3/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-
-# How to Build
-
-- On Windows with Visual Studio's CLI
-
-```
-set SDL2_DIR=path_to_your_sdl2_folder
-cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
-# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries
-# or for 64-bit:
-cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
-```
-
-- On Linux and similar Unixes
-
-```
-c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl
-```
-
-- On Mac OS X
-
-```
-brew install sdl2
-c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation
-```
diff --git a/examples/example_sdl_opengl3/build_win32.bat b/examples/example_sdl_opengl3/build_win32.bat
deleted file mode 100644
index ce105602f709..000000000000
--- a/examples/example_sdl_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_sdl_opengl3
-set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w
-set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c
-set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib
-mkdir %OUT_DIR%
-cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
diff --git a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj b/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj
deleted file mode 100644
index 54aaa79661eb..000000000000
--- a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj
+++ /dev/null
@@ -1,183 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {BBAEB705-1669-40F3-8567-04CF6A991F4C}
- example_sdl_opengl3
- 8.1
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- ..\..;..;%SDL2_DIR%\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
-
-
- true
- %SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)
- opengl32.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- ..\..;..;%SDL2_DIR%\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
-
-
- true
- %SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)
- opengl32.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%SDL2_DIR%\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)
- opengl32.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%SDL2_DIR%\include;..\libs\gl3w;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)
- opengl32.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters b/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters
deleted file mode 100644
index fbef18ac915c..000000000000
--- a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
- {20b90ce4-7fcb-4731-b9a0-075f875de82d}
-
-
- {f18ab499-84e1-499f-8eff-9754361e0e52}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {f9997b32-5479-4756-9ffc-77793ad3764f}
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- gl3w
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- gl3w
-
-
- gl3w
-
-
- sources
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
deleted file mode 100644
index 3146084dcda8..000000000000
--- a/examples/example_sdl_opengl3/main.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-// dear imgui: standalone example application for SDL2 + OpenGL
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
-// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.)
-
-#include "imgui.h"
-#include "imgui_impl_sdl.h"
-#include "imgui_impl_opengl3.h"
-#include
-#include
-
-// About Desktop OpenGL function loaders:
-// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
-// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
-// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
-#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
-#include // Initialize with gl3wInit()
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
-#include // Initialize with glewInit()
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
-#include // Initialize with gladLoadGL()
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2)
-#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
-#include // Initialize with glbinding::Binding::initialize()
-#include
-using namespace gl;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3)
-#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
-#include // Initialize with glbinding::initialize()
-#include
-using namespace gl;
-#else
-#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
-#endif
-
-// Main code
-int main(int, char**)
-{
- // Setup SDL
- // (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
- // depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
- {
- printf("Error: %s\n", SDL_GetError());
- return -1;
- }
-
- // Decide GL+GLSL versions
-#if __APPLE__
- // GL 3.2 Core + GLSL 150
- const char* glsl_version = "#version 150";
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
-#else
- // GL 3.0 + GLSL 130
- const char* glsl_version = "#version 130";
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
-#endif
-
- // Create window with graphics context
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
- SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
- SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL3 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
- SDL_GLContext gl_context = SDL_GL_CreateContext(window);
- SDL_GL_MakeCurrent(window, gl_context);
- SDL_GL_SetSwapInterval(1); // Enable vsync
-
- // Initialize OpenGL loader
-#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
- bool err = gl3wInit() != 0;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
- bool err = glewInit() != GLEW_OK;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
- bool err = gladLoadGL() == 0;
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2)
- bool err = false;
- glbinding::Binding::initialize();
-#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3)
- bool err = false;
- glbinding::initialize([](const char* name) { return (glbinding::ProcAddress)SDL_GL_GetProcAddress(name); });
-#else
- bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
-#endif
- if (err)
- {
- fprintf(stderr, "Failed to initialize OpenGL loader!\n");
- return 1;
- }
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
- ImGui_ImplOpenGL3_Init(glsl_version);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- bool done = false;
- while (!done)
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- SDL_Event event;
- while (SDL_PollEvent(&event))
- {
- ImGui_ImplSDL2_ProcessEvent(&event);
- if (event.type == SDL_QUIT)
- done = true;
- if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
- done = true;
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplOpenGL3_NewFrame();
- ImGui_ImplSDL2_NewFrame(window);
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
- glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
- glClear(GL_COLOR_BUFFER_BIT);
- ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
- SDL_GL_SwapWindow(window);
- }
-
- // Cleanup
- ImGui_ImplOpenGL3_Shutdown();
- ImGui_ImplSDL2_Shutdown();
- ImGui::DestroyContext();
-
- SDL_GL_DeleteContext(gl_context);
- SDL_DestroyWindow(window);
- SDL_Quit();
-
- return 0;
-}
diff --git a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj b/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj
deleted file mode 100644
index ac701a2a8095..000000000000
--- a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj
+++ /dev/null
@@ -1,180 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {BAE3D0B5-9695-4EB1-AD0F-75890EB4A3B3}
- example_sdl_vulkan
- 8.1
-
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
- Application
- false
- true
- MultiByte
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
- $(IncludePath)
-
-
-
- Level4
- Disabled
- ..\..;..;%VULKAN_SDK%\include;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
-
-
- true
- %VULKAN_SDK%\lib32;%SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)
- vulkan-1.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- Disabled
- ..\..;..;%VULKAN_SDK%\include;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
-
-
- true
- %VULKAN_SDK%\lib;%SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)
- vulkan-1.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
- msvcrt.lib
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%VULKAN_SDK%\include;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %VULKAN_SDK%\lib32;%SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)
- vulkan-1.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%VULKAN_SDK%\include;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)
- false
-
-
- true
- true
- true
- %VULKAN_SDK%\lib;%SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)
- vulkan-1.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters b/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters
deleted file mode 100644
index 6f08252419f3..000000000000
--- a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
- {20b90ce4-7fcb-4731-b9a0-075f875de82d}
-
-
- {f18ab499-84e1-499f-8eff-9754361e0e52}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_sdl_vulkan/main.cpp b/examples/example_sdl_vulkan/main.cpp
deleted file mode 100644
index 0a2ea9ee78d7..000000000000
--- a/examples/example_sdl_vulkan/main.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-// dear imgui: standalone example application for SDL2 + Vulkan
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
-// - Common ImGui_ImplVulkan_XXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
-// You will use those if you want to use this rendering back-end in your engine/app.
-// - Helper ImGui_ImplVulkanH_XXX functions and structures are only used by this example (main.cpp) and by
-// the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
-// Read comments in imgui_impl_vulkan.h.
-
-#include "imgui.h"
-#include "imgui_impl_sdl.h"
-#include "imgui_impl_vulkan.h"
-#include // printf, fprintf
-#include // abort
-#include
-#include
-#include
-
-//#define IMGUI_UNLIMITED_FRAME_RATE
-#ifdef _DEBUG
-#define IMGUI_VULKAN_DEBUG_REPORT
-#endif
-
-static VkAllocationCallbacks* g_Allocator = NULL;
-static VkInstance g_Instance = VK_NULL_HANDLE;
-static VkPhysicalDevice g_PhysicalDevice = VK_NULL_HANDLE;
-static VkDevice g_Device = VK_NULL_HANDLE;
-static uint32_t g_QueueFamily = (uint32_t)-1;
-static VkQueue g_Queue = VK_NULL_HANDLE;
-static VkDebugReportCallbackEXT g_DebugReport = VK_NULL_HANDLE;
-static VkPipelineCache g_PipelineCache = VK_NULL_HANDLE;
-static VkDescriptorPool g_DescriptorPool = VK_NULL_HANDLE;
-
-static ImGui_ImplVulkanH_Window g_MainWindowData;
-static uint32_t g_MinImageCount = 2;
-static bool g_SwapChainRebuild = false;
-static int g_SwapChainResizeWidth = 0;
-static int g_SwapChainResizeHeight = 0;
-
-static void check_vk_result(VkResult err)
-{
- if (err == 0)
- return;
- fprintf(stderr, "[vulkan] Error: VkResult = %d\n", err);
- if (err < 0)
- abort();
-}
-
-#ifdef IMGUI_VULKAN_DEBUG_REPORT
-static VKAPI_ATTR VkBool32 VKAPI_CALL debug_report(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData)
-{
- (void)flags; (void)object; (void)location; (void)messageCode; (void)pUserData; (void)pLayerPrefix; // Unused arguments
- fprintf(stderr, "[vulkan] Debug report from ObjectType: %i\nMessage: %s\n\n", objectType, pMessage);
- return VK_FALSE;
-}
-#endif // IMGUI_VULKAN_DEBUG_REPORT
-
-static void SetupVulkan(const char** extensions, uint32_t extensions_count)
-{
- VkResult err;
-
- // Create Vulkan Instance
- {
- VkInstanceCreateInfo create_info = {};
- create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
- create_info.enabledExtensionCount = extensions_count;
- create_info.ppEnabledExtensionNames = extensions;
-
-#ifdef IMGUI_VULKAN_DEBUG_REPORT
- // Enabling multiple validation layers grouped as LunarG standard validation
- const char* layers[] = { "VK_LAYER_LUNARG_standard_validation" };
- create_info.enabledLayerCount = 1;
- create_info.ppEnabledLayerNames = layers;
-
- // Enable debug report extension (we need additional storage, so we duplicate the user array to add our new extension to it)
- const char** extensions_ext = (const char**)malloc(sizeof(const char*) * (extensions_count + 1));
- memcpy(extensions_ext, extensions, extensions_count * sizeof(const char*));
- extensions_ext[extensions_count] = "VK_EXT_debug_report";
- create_info.enabledExtensionCount = extensions_count + 1;
- create_info.ppEnabledExtensionNames = extensions_ext;
-
- // Create Vulkan Instance
- err = vkCreateInstance(&create_info, g_Allocator, &g_Instance);
- check_vk_result(err);
- free(extensions_ext);
-
- // Get the function pointer (required for any extensions)
- auto vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkCreateDebugReportCallbackEXT");
- IM_ASSERT(vkCreateDebugReportCallbackEXT != NULL);
-
- // Setup the debug report callback
- VkDebugReportCallbackCreateInfoEXT debug_report_ci = {};
- debug_report_ci.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
- debug_report_ci.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
- debug_report_ci.pfnCallback = debug_report;
- debug_report_ci.pUserData = NULL;
- err = vkCreateDebugReportCallbackEXT(g_Instance, &debug_report_ci, g_Allocator, &g_DebugReport);
- check_vk_result(err);
-#else
- // Create Vulkan Instance without any debug feature
- err = vkCreateInstance(&create_info, g_Allocator, &g_Instance);
- check_vk_result(err);
- IM_UNUSED(g_DebugReport);
-#endif
- }
-
- // Select GPU
- {
- uint32_t gpu_count;
- err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, NULL);
- check_vk_result(err);
- IM_ASSERT(gpu_count > 0);
-
- VkPhysicalDevice* gpus = (VkPhysicalDevice*)malloc(sizeof(VkPhysicalDevice) * gpu_count);
- err = vkEnumeratePhysicalDevices(g_Instance, &gpu_count, gpus);
- check_vk_result(err);
-
- // If a number >1 of GPUs got reported, you should find the best fit GPU for your purpose
- // e.g. VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU if available, or with the greatest memory available, etc.
- // for sake of simplicity we'll just take the first one, assuming it has a graphics queue family.
- g_PhysicalDevice = gpus[0];
- free(gpus);
- }
-
- // Select graphics queue family
- {
- uint32_t count;
- vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, NULL);
- VkQueueFamilyProperties* queues = (VkQueueFamilyProperties*)malloc(sizeof(VkQueueFamilyProperties) * count);
- vkGetPhysicalDeviceQueueFamilyProperties(g_PhysicalDevice, &count, queues);
- for (uint32_t i = 0; i < count; i++)
- if (queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
- {
- g_QueueFamily = i;
- break;
- }
- free(queues);
- IM_ASSERT(g_QueueFamily != (uint32_t)-1);
- }
-
- // Create Logical Device (with 1 queue)
- {
- int device_extension_count = 1;
- const char* device_extensions[] = { "VK_KHR_swapchain" };
- const float queue_priority[] = { 1.0f };
- VkDeviceQueueCreateInfo queue_info[1] = {};
- queue_info[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queue_info[0].queueFamilyIndex = g_QueueFamily;
- queue_info[0].queueCount = 1;
- queue_info[0].pQueuePriorities = queue_priority;
- VkDeviceCreateInfo create_info = {};
- create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
- create_info.queueCreateInfoCount = sizeof(queue_info) / sizeof(queue_info[0]);
- create_info.pQueueCreateInfos = queue_info;
- create_info.enabledExtensionCount = device_extension_count;
- create_info.ppEnabledExtensionNames = device_extensions;
- err = vkCreateDevice(g_PhysicalDevice, &create_info, g_Allocator, &g_Device);
- check_vk_result(err);
- vkGetDeviceQueue(g_Device, g_QueueFamily, 0, &g_Queue);
- }
-
- // Create Descriptor Pool
- {
- VkDescriptorPoolSize pool_sizes[] =
- {
- { VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
- { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1000 },
- { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1000 },
- { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1000 },
- { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1000 },
- { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 1000 },
- { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1000 }
- };
- VkDescriptorPoolCreateInfo pool_info = {};
- pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
- pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
- pool_info.maxSets = 1000 * IM_ARRAYSIZE(pool_sizes);
- pool_info.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes);
- pool_info.pPoolSizes = pool_sizes;
- err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &g_DescriptorPool);
- check_vk_result(err);
- }
-}
-
-// All the ImGui_ImplVulkanH_XXX structures/functions are optional helpers used by the demo.
-// Your real engine/app may not use them.
-static void SetupVulkanWindow(ImGui_ImplVulkanH_Window* wd, VkSurfaceKHR surface, int width, int height)
-{
- wd->Surface = surface;
-
- // Check for WSI support
- VkBool32 res;
- vkGetPhysicalDeviceSurfaceSupportKHR(g_PhysicalDevice, g_QueueFamily, wd->Surface, &res);
- if (res != VK_TRUE)
- {
- fprintf(stderr, "Error no WSI support on physical device 0\n");
- exit(-1);
- }
-
- // Select Surface Format
- const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
- const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
- wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
-
- // Select Present Mode
-#ifdef IMGUI_UNLIMITED_FRAME_RATE
- VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR };
-#else
- VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR };
-#endif
- wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_modes[0], IM_ARRAYSIZE(present_modes));
- //printf("[vulkan] Selected PresentMode = %d\n", wd->PresentMode);
-
- // Create SwapChain, RenderPass, Framebuffer, etc.
- IM_ASSERT(g_MinImageCount >= 2);
- ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, wd, g_QueueFamily, g_Allocator, width, height, g_MinImageCount);
-}
-
-static void CleanupVulkan()
-{
- vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator);
-
-#ifdef IMGUI_VULKAN_DEBUG_REPORT
- // Remove the debug report callback
- auto vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(g_Instance, "vkDestroyDebugReportCallbackEXT");
- vkDestroyDebugReportCallbackEXT(g_Instance, g_DebugReport, g_Allocator);
-#endif // IMGUI_VULKAN_DEBUG_REPORT
-
- vkDestroyDevice(g_Device, g_Allocator);
- vkDestroyInstance(g_Instance, g_Allocator);
-}
-
-static void CleanupVulkanWindow()
-{
- ImGui_ImplVulkanH_DestroyWindow(g_Instance, g_Device, &g_MainWindowData, g_Allocator);
-}
-
-static void FrameRender(ImGui_ImplVulkanH_Window* wd, ImDrawData* draw_data)
-{
- VkResult err;
-
- VkSemaphore image_acquired_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].ImageAcquiredSemaphore;
- VkSemaphore render_complete_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].RenderCompleteSemaphore;
- err = vkAcquireNextImageKHR(g_Device, wd->Swapchain, UINT64_MAX, image_acquired_semaphore, VK_NULL_HANDLE, &wd->FrameIndex);
- check_vk_result(err);
-
- ImGui_ImplVulkanH_Frame* fd = &wd->Frames[wd->FrameIndex];
- {
- err = vkWaitForFences(g_Device, 1, &fd->Fence, VK_TRUE, UINT64_MAX); // wait indefinitely instead of periodically checking
- check_vk_result(err);
-
- err = vkResetFences(g_Device, 1, &fd->Fence);
- check_vk_result(err);
- }
- {
- err = vkResetCommandPool(g_Device, fd->CommandPool, 0);
- check_vk_result(err);
- VkCommandBufferBeginInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- err = vkBeginCommandBuffer(fd->CommandBuffer, &info);
- check_vk_result(err);
- }
- {
- VkRenderPassBeginInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
- info.renderPass = wd->RenderPass;
- info.framebuffer = fd->Framebuffer;
- info.renderArea.extent.width = wd->Width;
- info.renderArea.extent.height = wd->Height;
- info.clearValueCount = 1;
- info.pClearValues = &wd->ClearValue;
- vkCmdBeginRenderPass(fd->CommandBuffer, &info, VK_SUBPASS_CONTENTS_INLINE);
- }
-
- // Record dear imgui primitives into command buffer
- ImGui_ImplVulkan_RenderDrawData(draw_data, fd->CommandBuffer);
-
- // Submit command buffer
- vkCmdEndRenderPass(fd->CommandBuffer);
- {
- VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
- VkSubmitInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- info.waitSemaphoreCount = 1;
- info.pWaitSemaphores = &image_acquired_semaphore;
- info.pWaitDstStageMask = &wait_stage;
- info.commandBufferCount = 1;
- info.pCommandBuffers = &fd->CommandBuffer;
- info.signalSemaphoreCount = 1;
- info.pSignalSemaphores = &render_complete_semaphore;
-
- err = vkEndCommandBuffer(fd->CommandBuffer);
- check_vk_result(err);
- err = vkQueueSubmit(g_Queue, 1, &info, fd->Fence);
- check_vk_result(err);
- }
-}
-
-static void FramePresent(ImGui_ImplVulkanH_Window* wd)
-{
- VkSemaphore render_complete_semaphore = wd->FrameSemaphores[wd->SemaphoreIndex].RenderCompleteSemaphore;
- VkPresentInfoKHR info = {};
- info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
- info.waitSemaphoreCount = 1;
- info.pWaitSemaphores = &render_complete_semaphore;
- info.swapchainCount = 1;
- info.pSwapchains = &wd->Swapchain;
- info.pImageIndices = &wd->FrameIndex;
- VkResult err = vkQueuePresentKHR(g_Queue, &info);
- check_vk_result(err);
- wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->ImageCount; // Now we can use the next set of semaphores
-}
-
-int main(int, char**)
-{
- // Setup SDL
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
- {
- printf("Error: %s\n", SDL_GetError());
- return -1;
- }
-
- // Setup window
- SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
- SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+Vulkan example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
-
- // Setup Vulkan
- uint32_t extensions_count = 0;
- SDL_Vulkan_GetInstanceExtensions(window, &extensions_count, NULL);
- const char** extensions = new const char*[extensions_count];
- SDL_Vulkan_GetInstanceExtensions(window, &extensions_count, extensions);
- SetupVulkan(extensions, extensions_count);
- delete[] extensions;
-
- // Create Window Surface
- VkSurfaceKHR surface;
- VkResult err;
- if (SDL_Vulkan_CreateSurface(window, g_Instance, &surface) == 0)
- {
- printf("Failed to create Vulkan surface.\n");
- return 1;
- }
-
- // Create Framebuffers
- int w, h;
- SDL_GetWindowSize(window, &w, &h);
- ImGui_ImplVulkanH_Window* wd = &g_MainWindowData;
- SetupVulkanWindow(wd, surface, w, h);
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplSDL2_InitForVulkan(window);
- ImGui_ImplVulkan_InitInfo init_info = {};
- init_info.Instance = g_Instance;
- init_info.PhysicalDevice = g_PhysicalDevice;
- init_info.Device = g_Device;
- init_info.QueueFamily = g_QueueFamily;
- init_info.Queue = g_Queue;
- init_info.PipelineCache = g_PipelineCache;
- init_info.DescriptorPool = g_DescriptorPool;
- init_info.Allocator = g_Allocator;
- init_info.MinImageCount = g_MinImageCount;
- init_info.ImageCount = wd->ImageCount;
- init_info.CheckVkResultFn = check_vk_result;
- ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Upload Fonts
- {
- // Use any command queue
- VkCommandPool command_pool = wd->Frames[wd->FrameIndex].CommandPool;
- VkCommandBuffer command_buffer = wd->Frames[wd->FrameIndex].CommandBuffer;
-
- err = vkResetCommandPool(g_Device, command_pool, 0);
- check_vk_result(err);
- VkCommandBufferBeginInfo begin_info = {};
- begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- begin_info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- err = vkBeginCommandBuffer(command_buffer, &begin_info);
- check_vk_result(err);
-
- ImGui_ImplVulkan_CreateFontsTexture(command_buffer);
-
- VkSubmitInfo end_info = {};
- end_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- end_info.commandBufferCount = 1;
- end_info.pCommandBuffers = &command_buffer;
- err = vkEndCommandBuffer(command_buffer);
- check_vk_result(err);
- err = vkQueueSubmit(g_Queue, 1, &end_info, VK_NULL_HANDLE);
- check_vk_result(err);
-
- err = vkDeviceWaitIdle(g_Device);
- check_vk_result(err);
- ImGui_ImplVulkan_DestroyFontUploadObjects();
- }
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- bool done = false;
- while (!done)
- {
- // Poll and handle events (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- SDL_Event event;
- while (SDL_PollEvent(&event))
- {
- ImGui_ImplSDL2_ProcessEvent(&event);
- if (event.type == SDL_QUIT)
- done = true;
- if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED && event.window.windowID == SDL_GetWindowID(window))
- {
- // Note: your own application may rely on SDL_WINDOWEVENT_MINIMIZED/SDL_WINDOWEVENT_RESTORED to skip updating all-together.
- // Here ImGui_ImplSDL2_NewFrame() will set io.DisplaySize to zero which will disable rendering but let application run.
- // Please note that you can't Present into a minimized window.
- g_SwapChainResizeWidth = (int)event.window.data1;
- g_SwapChainResizeHeight = (int)event.window.data2;
- g_SwapChainRebuild = true;
- }
- }
-
- // Resize swap chain?
- if (g_SwapChainRebuild && g_SwapChainResizeWidth > 0 && g_SwapChainResizeHeight > 0)
- {
- g_SwapChainRebuild = false;
- ImGui_ImplVulkan_SetMinImageCount(g_MinImageCount);
- ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, &g_MainWindowData, g_QueueFamily, g_Allocator, g_SwapChainResizeWidth, g_SwapChainResizeHeight, g_MinImageCount);
- g_MainWindowData.FrameIndex = 0;
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplVulkan_NewFrame();
- ImGui_ImplSDL2_NewFrame(window);
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- ImDrawData* draw_data = ImGui::GetDrawData();
- const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
- if (!is_minimized)
- {
- FrameRender(wd, draw_data);
- FramePresent(wd);
- }
- }
-
- // Cleanup
- err = vkDeviceWaitIdle(g_Device);
- check_vk_result(err);
- ImGui_ImplVulkan_Shutdown();
- ImGui_ImplSDL2_Shutdown();
- ImGui::DestroyContext();
-
- CleanupVulkanWindow();
- CleanupVulkan();
-
- SDL_DestroyWindow(window);
- SDL_Quit();
-
- return 0;
-}
diff --git a/examples/example_win32_directx10/build_win32.bat b/examples/example_win32_directx10/build_win32.bat
deleted file mode 100644
index d79cb8f7b527..000000000000
--- a/examples/example_win32_directx10/build_win32.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_win32.cpp ..\imgui_impl_dx10.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx10.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib
-
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
deleted file mode 100644
index 5c3aa69f4ade..000000000000
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {345A953E-A004-4648-B442-DC5F9F11068C}
- example_win32_directx10
- 8.1
-
-
-
- Application
- true
- Unicode
- v110
-
-
- Application
- true
- Unicode
- v110
-
-
- Application
- false
- true
- Unicode
- v110
-
-
- Application
- false
- true
- Unicode
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories);
-
-
- true
- d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories);
-
-
- true
- d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories);
- false
-
-
- true
- true
- true
- d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories);
- false
-
-
- true
- true
- true
- d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj.filters b/examples/example_win32_directx10/example_win32_directx10.vcxproj.filters
deleted file mode 100644
index 976200285bff..000000000000
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj.filters
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6}
-
-
- {08e36723-ce4f-4cff-9662-c40801cf1acf}
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
- imgui
-
-
- sources
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx10/main.cpp b/examples/example_win32_directx10/main.cpp
deleted file mode 100644
index f6b8b2155c09..000000000000
--- a/examples/example_win32_directx10/main.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-// dear imgui: standalone example application for DirectX 10
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-#include "imgui.h"
-#include "imgui_impl_win32.h"
-#include "imgui_impl_dx10.h"
-#include
-#include
-#define DIRECTINPUT_VERSION 0x0800
-#include
-#include
-
-// Data
-static ID3D10Device* g_pd3dDevice = NULL;
-static IDXGISwapChain* g_pSwapChain = NULL;
-static ID3D10RenderTargetView* g_mainRenderTargetView = NULL;
-
-// Forward declarations of helper functions
-bool CreateDeviceD3D(HWND hWnd);
-void CleanupDeviceD3D();
-void CreateRenderTarget();
-void CleanupRenderTarget();
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Main code
-int main(int, char**)
-{
- // Create application window
- WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
- ::RegisterClassEx(&wc);
- HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
-
- // Initialize Direct3D
- if (!CreateDeviceD3D(hwnd))
- {
- CleanupDeviceD3D();
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
- return 1;
- }
-
- // Show the window
- ::ShowWindow(hwnd, SW_SHOWDEFAULT);
- ::UpdateWindow(hwnd);
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplWin32_Init(hwnd);
- ImGui_ImplDX10_Init(g_pd3dDevice);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- MSG msg;
- ZeroMemory(&msg, sizeof(msg));
- while (msg.message != WM_QUIT)
- {
- // Poll and handle messages (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- if (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
- {
- ::TranslateMessage(&msg);
- ::DispatchMessage(&msg);
- continue;
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplDX10_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- g_pd3dDevice->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
- g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color);
- ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
-
- g_pSwapChain->Present(1, 0); // Present with vsync
- //g_pSwapChain->Present(0, 0); // Present without vsync
- }
-
- ImGui_ImplDX10_Shutdown();
- ImGui_ImplWin32_Shutdown();
- ImGui::DestroyContext();
-
- CleanupDeviceD3D();
- ::DestroyWindow(hwnd);
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
-
- return 0;
-}
-
-// Helper functions
-
-bool CreateDeviceD3D(HWND hWnd)
-{
- // Setup swap chain
- DXGI_SWAP_CHAIN_DESC sd;
- ZeroMemory(&sd, sizeof(sd));
- sd.BufferCount = 2;
- sd.BufferDesc.Width = 0;
- sd.BufferDesc.Height = 0;
- sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- sd.BufferDesc.RefreshRate.Numerator = 60;
- sd.BufferDesc.RefreshRate.Denominator = 1;
- sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
- sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- sd.OutputWindow = hWnd;
- sd.SampleDesc.Count = 1;
- sd.SampleDesc.Quality = 0;
- sd.Windowed = TRUE;
- sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-
- UINT createDeviceFlags = 0;
- //createDeviceFlags |= D3D10_CREATE_DEVICE_DEBUG;
- if (D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags, D3D10_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice) != S_OK)
- return false;
-
- CreateRenderTarget();
- return true;
-}
-
-void CleanupDeviceD3D()
-{
- CleanupRenderTarget();
- if (g_pSwapChain) { g_pSwapChain->Release(); g_pSwapChain = NULL; }
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
-}
-
-void CreateRenderTarget()
-{
- ID3D10Texture2D* pBackBuffer;
- g_pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
- g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_mainRenderTargetView);
- pBackBuffer->Release();
-}
-
-void CleanupRenderTarget()
-{
- if (g_mainRenderTargetView) { g_mainRenderTargetView->Release(); g_mainRenderTargetView = NULL; }
-}
-
-// Forward declare message handler from imgui_impl_win32.cpp
-extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Win32 message handler
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
- return true;
-
- switch (msg)
- {
- case WM_SIZE:
- if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
- {
- CleanupRenderTarget();
- g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0);
- CreateRenderTarget();
- }
- return 0;
- case WM_SYSCOMMAND:
- if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
- return 0;
- break;
- case WM_DESTROY:
- ::PostQuitMessage(0);
- return 0;
- }
- return ::DefWindowProc(hWnd, msg, wParam, lParam);
-}
diff --git a/examples/example_win32_directx11/build_win32.bat b/examples/example_win32_directx11/build_win32.bat
deleted file mode 100644
index 05e6a6f6ca13..000000000000
--- a/examples/example_win32_directx11/build_win32.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx11.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx11.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib
-
diff --git a/examples/example_win32_directx11/example_win32_directx11.vcxproj b/examples/example_win32_directx11/example_win32_directx11.vcxproj
deleted file mode 100644
index 64af0866e6bc..000000000000
--- a/examples/example_win32_directx11/example_win32_directx11.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {9F316E83-5AE5-4939-A723-305A94F48005}
- example_win32_directx11
- 10.0.17763.0
-
-
-
- Application
- true
- Unicode
- v110
-
-
- Application
- true
- Unicode
- v110
-
-
- Application
- false
- true
- Unicode
- v110
-
-
- Application
- false
- true
- Unicode
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories);
-
-
- true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories);
-
-
- true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories);
- false
-
-
- true
- true
- true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories);
- false
-
-
- true
- true
- true
- d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx11/example_win32_directx11.vcxproj.filters b/examples/example_win32_directx11/example_win32_directx11.vcxproj.filters
deleted file mode 100644
index 1df6a0c415aa..000000000000
--- a/examples/example_win32_directx11/example_win32_directx11.vcxproj.filters
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6}
-
-
- {08e36723-ce4f-4cff-9662-c40801cf1acf}
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
- imgui
-
-
- sources
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx11/main.cpp b/examples/example_win32_directx11/main.cpp
deleted file mode 100644
index 2cc36a7f1314..000000000000
--- a/examples/example_win32_directx11/main.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-// dear imgui - standalone example application for DirectX 11
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-#include "imgui.h"
-#include "imgui_impl_win32.h"
-#include "imgui_impl_dx11.h"
-#include
-#define DIRECTINPUT_VERSION 0x0800
-#include
-#include
-
-// Data
-static ID3D11Device* g_pd3dDevice = NULL;
-static ID3D11DeviceContext* g_pd3dDeviceContext = NULL;
-static IDXGISwapChain* g_pSwapChain = NULL;
-static ID3D11RenderTargetView* g_mainRenderTargetView = NULL;
-
-// Forward declarations of helper functions
-bool CreateDeviceD3D(HWND hWnd);
-void CleanupDeviceD3D();
-void CreateRenderTarget();
-void CleanupRenderTarget();
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Main code
-int main(int, char**)
-{
- // Create application window
- WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
- ::RegisterClassEx(&wc);
- HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
-
- // Initialize Direct3D
- if (!CreateDeviceD3D(hwnd))
- {
- CleanupDeviceD3D();
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
- return 1;
- }
-
- // Show the window
- ::ShowWindow(hwnd, SW_SHOWDEFAULT);
- ::UpdateWindow(hwnd);
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplWin32_Init(hwnd);
- ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- MSG msg;
- ZeroMemory(&msg, sizeof(msg));
- while (msg.message != WM_QUIT)
- {
- // Poll and handle messages (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- if (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
- {
- ::TranslateMessage(&msg);
- ::DispatchMessage(&msg);
- continue;
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplDX11_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::Render();
- g_pd3dDeviceContext->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
- g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color);
- ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
-
- g_pSwapChain->Present(1, 0); // Present with vsync
- //g_pSwapChain->Present(0, 0); // Present without vsync
- }
-
- // Cleanup
- ImGui_ImplDX11_Shutdown();
- ImGui_ImplWin32_Shutdown();
- ImGui::DestroyContext();
-
- CleanupDeviceD3D();
- ::DestroyWindow(hwnd);
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
-
- return 0;
-}
-
-// Helper functions
-
-bool CreateDeviceD3D(HWND hWnd)
-{
- // Setup swap chain
- DXGI_SWAP_CHAIN_DESC sd;
- ZeroMemory(&sd, sizeof(sd));
- sd.BufferCount = 2;
- sd.BufferDesc.Width = 0;
- sd.BufferDesc.Height = 0;
- sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- sd.BufferDesc.RefreshRate.Numerator = 60;
- sd.BufferDesc.RefreshRate.Denominator = 1;
- sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
- sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- sd.OutputWindow = hWnd;
- sd.SampleDesc.Count = 1;
- sd.SampleDesc.Quality = 0;
- sd.Windowed = TRUE;
- sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-
- UINT createDeviceFlags = 0;
- //createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
- D3D_FEATURE_LEVEL featureLevel;
- const D3D_FEATURE_LEVEL featureLevelArray[2] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0, };
- if (D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext) != S_OK)
- return false;
-
- CreateRenderTarget();
- return true;
-}
-
-void CleanupDeviceD3D()
-{
- CleanupRenderTarget();
- if (g_pSwapChain) { g_pSwapChain->Release(); g_pSwapChain = NULL; }
- if (g_pd3dDeviceContext) { g_pd3dDeviceContext->Release(); g_pd3dDeviceContext = NULL; }
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
-}
-
-void CreateRenderTarget()
-{
- ID3D11Texture2D* pBackBuffer;
- g_pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
- g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_mainRenderTargetView);
- pBackBuffer->Release();
-}
-
-void CleanupRenderTarget()
-{
- if (g_mainRenderTargetView) { g_mainRenderTargetView->Release(); g_mainRenderTargetView = NULL; }
-}
-
-// Forward declare message handler from imgui_impl_win32.cpp
-extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Win32 message handler
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
- return true;
-
- switch (msg)
- {
- case WM_SIZE:
- if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
- {
- CleanupRenderTarget();
- g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0);
- CreateRenderTarget();
- }
- return 0;
- case WM_SYSCOMMAND:
- if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
- return 0;
- break;
- case WM_DESTROY:
- ::PostQuitMessage(0);
- return 0;
- }
- return ::DefWindowProc(hWnd, msg, wParam, lParam);
-}
diff --git a/examples/example_win32_directx12/build_win32.bat b/examples/example_win32_directx12/build_win32.bat
deleted file mode 100644
index 2cd7fcdff7cb..000000000000
--- a/examples/example_win32_directx12/build_win32.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx12.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx12.exe /FoDebug/ /link d3d12.lib d3dcompiler.lib dxgi.lib
-
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
deleted file mode 100644
index dabd6d840935..000000000000
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- example_win32_directx12
- 10.0.14393.0
-
-
-
- Application
- true
- Unicode
- v140
-
-
- Application
- true
- Unicode
- v140
-
-
- Application
- false
- true
- Unicode
- v140
-
-
- Application
- false
- true
- Unicode
- v140
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories)
-
-
- true
- d3d12.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- %(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories)
-
-
- true
- d3d12.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- %(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories)
-
-
- true
- true
- true
- d3d12.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- %(AdditionalLibraryDirectories)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories)
-
-
- true
- true
- true
- d3d12.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies)
- %(AdditionalLibraryDirectories)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj.filters b/examples/example_win32_directx12/example_win32_directx12.vcxproj.filters
deleted file mode 100644
index 28a25572ebd5..000000000000
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj.filters
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
- {fb3d294f-51ec-478e-a627-25831c80fefd}
-
-
- {4f33ddea-9910-456d-b868-4267eb3c2b19}
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
- imgui
-
-
- sources
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx12/main.cpp b/examples/example_win32_directx12/main.cpp
deleted file mode 100644
index 6ea896bc616d..000000000000
--- a/examples/example_win32_directx12/main.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-// dear imgui: standalone example application for DirectX 12
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
-
-#include "imgui.h"
-#include "imgui_impl_win32.h"
-#include "imgui_impl_dx12.h"
-#include
-#include
-#include
-
-#ifdef _DEBUG
-#define DX12_ENABLE_DEBUG_LAYER
-#endif
-
-#ifdef DX12_ENABLE_DEBUG_LAYER
-#include
-#pragma comment(lib, "dxguid.lib")
-#endif
-
-struct FrameContext
-{
- ID3D12CommandAllocator* CommandAllocator;
- UINT64 FenceValue;
-};
-
-// Data
-static int const NUM_FRAMES_IN_FLIGHT = 3;
-static FrameContext g_frameContext[NUM_FRAMES_IN_FLIGHT] = {};
-static UINT g_frameIndex = 0;
-
-static int const NUM_BACK_BUFFERS = 3;
-static ID3D12Device* g_pd3dDevice = NULL;
-static ID3D12DescriptorHeap* g_pd3dRtvDescHeap = NULL;
-static ID3D12DescriptorHeap* g_pd3dSrvDescHeap = NULL;
-static ID3D12CommandQueue* g_pd3dCommandQueue = NULL;
-static ID3D12GraphicsCommandList* g_pd3dCommandList = NULL;
-static ID3D12Fence* g_fence = NULL;
-static HANDLE g_fenceEvent = NULL;
-static UINT64 g_fenceLastSignaledValue = 0;
-static IDXGISwapChain3* g_pSwapChain = NULL;
-static HANDLE g_hSwapChainWaitableObject = NULL;
-static ID3D12Resource* g_mainRenderTargetResource[NUM_BACK_BUFFERS] = {};
-static D3D12_CPU_DESCRIPTOR_HANDLE g_mainRenderTargetDescriptor[NUM_BACK_BUFFERS] = {};
-
-// Forward declarations of helper functions
-bool CreateDeviceD3D(HWND hWnd);
-void CleanupDeviceD3D();
-void CreateRenderTarget();
-void CleanupRenderTarget();
-void WaitForLastSubmittedFrame();
-FrameContext* WaitForNextFrameResources();
-void ResizeSwapChain(HWND hWnd, int width, int height);
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Main code
-int main(int, char**)
-{
- // Create application window
- WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
- ::RegisterClassEx(&wc);
- HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
-
- // Initialize Direct3D
- if (!CreateDeviceD3D(hwnd))
- {
- CleanupDeviceD3D();
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
- return 1;
- }
-
- // Show the window
- ::ShowWindow(hwnd, SW_SHOWDEFAULT);
- ::UpdateWindow(hwnd);
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplWin32_Init(hwnd);
- ImGui_ImplDX12_Init(g_pd3dDevice, NUM_FRAMES_IN_FLIGHT,
- DXGI_FORMAT_R8G8B8A8_UNORM, g_pd3dSrvDescHeap,
- g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
- g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- MSG msg;
- ZeroMemory(&msg, sizeof(msg));
- while (msg.message != WM_QUIT)
- {
- // Poll and handle messages (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- if (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
- {
- ::TranslateMessage(&msg);
- ::DispatchMessage(&msg);
- continue;
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplDX12_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- FrameContext* frameCtxt = WaitForNextFrameResources();
- UINT backBufferIdx = g_pSwapChain->GetCurrentBackBufferIndex();
- frameCtxt->CommandAllocator->Reset();
-
- D3D12_RESOURCE_BARRIER barrier = {};
- barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
- barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
- barrier.Transition.pResource = g_mainRenderTargetResource[backBufferIdx];
- barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
- barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_PRESENT;
- barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_RENDER_TARGET;
-
- g_pd3dCommandList->Reset(frameCtxt->CommandAllocator, NULL);
- g_pd3dCommandList->ResourceBarrier(1, &barrier);
- g_pd3dCommandList->ClearRenderTargetView(g_mainRenderTargetDescriptor[backBufferIdx], (float*)&clear_color, 0, NULL);
- g_pd3dCommandList->OMSetRenderTargets(1, &g_mainRenderTargetDescriptor[backBufferIdx], FALSE, NULL);
- g_pd3dCommandList->SetDescriptorHeaps(1, &g_pd3dSrvDescHeap);
- ImGui::Render();
- ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), g_pd3dCommandList);
- barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
- barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PRESENT;
- g_pd3dCommandList->ResourceBarrier(1, &barrier);
- g_pd3dCommandList->Close();
-
- g_pd3dCommandQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*)&g_pd3dCommandList);
-
- g_pSwapChain->Present(1, 0); // Present with vsync
- //g_pSwapChain->Present(0, 0); // Present without vsync
-
- UINT64 fenceValue = g_fenceLastSignaledValue + 1;
- g_pd3dCommandQueue->Signal(g_fence, fenceValue);
- g_fenceLastSignaledValue = fenceValue;
- frameCtxt->FenceValue = fenceValue;
- }
-
- WaitForLastSubmittedFrame();
- ImGui_ImplDX12_Shutdown();
- ImGui_ImplWin32_Shutdown();
- ImGui::DestroyContext();
-
- CleanupDeviceD3D();
- ::DestroyWindow(hwnd);
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
-
- return 0;
-}
-
-// Helper functions
-
-bool CreateDeviceD3D(HWND hWnd)
-{
- // Setup swap chain
- DXGI_SWAP_CHAIN_DESC1 sd;
- {
- ZeroMemory(&sd, sizeof(sd));
- sd.BufferCount = NUM_BACK_BUFFERS;
- sd.Width = 0;
- sd.Height = 0;
- sd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- sd.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
- sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- sd.SampleDesc.Count = 1;
- sd.SampleDesc.Quality = 0;
- sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
- sd.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
- sd.Scaling = DXGI_SCALING_STRETCH;
- sd.Stereo = FALSE;
- }
-
-#ifdef DX12_ENABLE_DEBUG_LAYER
- ID3D12Debug* pdx12Debug = NULL;
- if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&pdx12Debug))))
- {
- pdx12Debug->EnableDebugLayer();
- pdx12Debug->Release();
- }
-#endif
-
- D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0;
- if (D3D12CreateDevice(NULL, featureLevel, IID_PPV_ARGS(&g_pd3dDevice)) != S_OK)
- return false;
-
- {
- D3D12_DESCRIPTOR_HEAP_DESC desc = {};
- desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
- desc.NumDescriptors = NUM_BACK_BUFFERS;
- desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
- desc.NodeMask = 1;
- if (g_pd3dDevice->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&g_pd3dRtvDescHeap)) != S_OK)
- return false;
-
- SIZE_T rtvDescriptorSize = g_pd3dDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
- D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = g_pd3dRtvDescHeap->GetCPUDescriptorHandleForHeapStart();
- for (UINT i = 0; i < NUM_BACK_BUFFERS; i++)
- {
- g_mainRenderTargetDescriptor[i] = rtvHandle;
- rtvHandle.ptr += rtvDescriptorSize;
- }
- }
-
- {
- D3D12_DESCRIPTOR_HEAP_DESC desc = {};
- desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
- desc.NumDescriptors = 1;
- desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
- if (g_pd3dDevice->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&g_pd3dSrvDescHeap)) != S_OK)
- return false;
- }
-
- {
- D3D12_COMMAND_QUEUE_DESC desc = {};
- desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
- desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
- desc.NodeMask = 1;
- if (g_pd3dDevice->CreateCommandQueue(&desc, IID_PPV_ARGS(&g_pd3dCommandQueue)) != S_OK)
- return false;
- }
-
- for (UINT i = 0; i < NUM_FRAMES_IN_FLIGHT; i++)
- if (g_pd3dDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&g_frameContext[i].CommandAllocator)) != S_OK)
- return false;
-
- if (g_pd3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, g_frameContext[0].CommandAllocator, NULL, IID_PPV_ARGS(&g_pd3dCommandList)) != S_OK ||
- g_pd3dCommandList->Close() != S_OK)
- return false;
-
- if (g_pd3dDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&g_fence)) != S_OK)
- return false;
-
- g_fenceEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (g_fenceEvent == NULL)
- return false;
-
- {
- IDXGIFactory4* dxgiFactory = NULL;
- IDXGISwapChain1* swapChain1 = NULL;
- if (CreateDXGIFactory1(IID_PPV_ARGS(&dxgiFactory)) != S_OK ||
- dxgiFactory->CreateSwapChainForHwnd(g_pd3dCommandQueue, hWnd, &sd, NULL, NULL, &swapChain1) != S_OK ||
- swapChain1->QueryInterface(IID_PPV_ARGS(&g_pSwapChain)) != S_OK)
- return false;
- swapChain1->Release();
- dxgiFactory->Release();
- g_pSwapChain->SetMaximumFrameLatency(NUM_BACK_BUFFERS);
- g_hSwapChainWaitableObject = g_pSwapChain->GetFrameLatencyWaitableObject();
- }
-
- CreateRenderTarget();
- return true;
-}
-
-void CleanupDeviceD3D()
-{
- CleanupRenderTarget();
- if (g_pSwapChain) { g_pSwapChain->Release(); g_pSwapChain = NULL; }
- if (g_hSwapChainWaitableObject != NULL) { CloseHandle(g_hSwapChainWaitableObject); }
- for (UINT i = 0; i < NUM_FRAMES_IN_FLIGHT; i++)
- if (g_frameContext[i].CommandAllocator) { g_frameContext[i].CommandAllocator->Release(); g_frameContext[i].CommandAllocator = NULL; }
- if (g_pd3dCommandQueue) { g_pd3dCommandQueue->Release(); g_pd3dCommandQueue = NULL; }
- if (g_pd3dCommandList) { g_pd3dCommandList->Release(); g_pd3dCommandList = NULL; }
- if (g_pd3dRtvDescHeap) { g_pd3dRtvDescHeap->Release(); g_pd3dRtvDescHeap = NULL; }
- if (g_pd3dSrvDescHeap) { g_pd3dSrvDescHeap->Release(); g_pd3dSrvDescHeap = NULL; }
- if (g_fence) { g_fence->Release(); g_fence = NULL; }
- if (g_fenceEvent) { CloseHandle(g_fenceEvent); g_fenceEvent = NULL; }
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
-
-#ifdef DX12_ENABLE_DEBUG_LAYER
- IDXGIDebug1* pDebug = NULL;
- if (SUCCEEDED(DXGIGetDebugInterface1(0, IID_PPV_ARGS(&pDebug))))
- {
- pDebug->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_SUMMARY);
- pDebug->Release();
- }
-#endif
-}
-
-void CreateRenderTarget()
-{
- for (UINT i = 0; i < NUM_BACK_BUFFERS; i++)
- {
- ID3D12Resource* pBackBuffer = NULL;
- g_pSwapChain->GetBuffer(i, IID_PPV_ARGS(&pBackBuffer));
- g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, g_mainRenderTargetDescriptor[i]);
- g_mainRenderTargetResource[i] = pBackBuffer;
- }
-}
-
-void CleanupRenderTarget()
-{
- WaitForLastSubmittedFrame();
-
- for (UINT i = 0; i < NUM_BACK_BUFFERS; i++)
- if (g_mainRenderTargetResource[i]) { g_mainRenderTargetResource[i]->Release(); g_mainRenderTargetResource[i] = NULL; }
-}
-
-void WaitForLastSubmittedFrame()
-{
- FrameContext* frameCtxt = &g_frameContext[g_frameIndex % NUM_FRAMES_IN_FLIGHT];
-
- UINT64 fenceValue = frameCtxt->FenceValue;
- if (fenceValue == 0)
- return; // No fence was signaled
-
- frameCtxt->FenceValue = 0;
- if (g_fence->GetCompletedValue() >= fenceValue)
- return;
-
- g_fence->SetEventOnCompletion(fenceValue, g_fenceEvent);
- WaitForSingleObject(g_fenceEvent, INFINITE);
-}
-
-FrameContext* WaitForNextFrameResources()
-{
- UINT nextFrameIndex = g_frameIndex + 1;
- g_frameIndex = nextFrameIndex;
-
- HANDLE waitableObjects[] = { g_hSwapChainWaitableObject, NULL };
- DWORD numWaitableObjects = 1;
-
- FrameContext* frameCtxt = &g_frameContext[nextFrameIndex % NUM_FRAMES_IN_FLIGHT];
- UINT64 fenceValue = frameCtxt->FenceValue;
- if (fenceValue != 0) // means no fence was signaled
- {
- frameCtxt->FenceValue = 0;
- g_fence->SetEventOnCompletion(fenceValue, g_fenceEvent);
- waitableObjects[1] = g_fenceEvent;
- numWaitableObjects = 2;
- }
-
- WaitForMultipleObjects(numWaitableObjects, waitableObjects, TRUE, INFINITE);
-
- return frameCtxt;
-}
-
-void ResizeSwapChain(HWND hWnd, int width, int height)
-{
- DXGI_SWAP_CHAIN_DESC1 sd;
- g_pSwapChain->GetDesc1(&sd);
- sd.Width = width;
- sd.Height = height;
-
- IDXGIFactory4* dxgiFactory = NULL;
- g_pSwapChain->GetParent(IID_PPV_ARGS(&dxgiFactory));
-
- g_pSwapChain->Release();
- CloseHandle(g_hSwapChainWaitableObject);
-
- IDXGISwapChain1* swapChain1 = NULL;
- dxgiFactory->CreateSwapChainForHwnd(g_pd3dCommandQueue, hWnd, &sd, NULL, NULL, &swapChain1);
- swapChain1->QueryInterface(IID_PPV_ARGS(&g_pSwapChain));
- swapChain1->Release();
- dxgiFactory->Release();
-
- g_pSwapChain->SetMaximumFrameLatency(NUM_BACK_BUFFERS);
-
- g_hSwapChainWaitableObject = g_pSwapChain->GetFrameLatencyWaitableObject();
- assert(g_hSwapChainWaitableObject != NULL);
-}
-
-// Forward declare message handler from imgui_impl_win32.cpp
-extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Win32 message handler
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
- return true;
-
- switch (msg)
- {
- case WM_SIZE:
- if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
- {
- WaitForLastSubmittedFrame();
- ImGui_ImplDX12_InvalidateDeviceObjects();
- CleanupRenderTarget();
- ResizeSwapChain(hWnd, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam));
- CreateRenderTarget();
- ImGui_ImplDX12_CreateDeviceObjects();
- }
- return 0;
- case WM_SYSCOMMAND:
- if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
- return 0;
- break;
- case WM_DESTROY:
- ::PostQuitMessage(0);
- return 0;
- }
- return ::DefWindowProc(hWnd, msg, wParam, lParam);
-}
diff --git a/examples/example_win32_directx9/build_win32.bat b/examples/example_win32_directx9/build_win32.bat
deleted file mode 100644
index 4db27653e595..000000000000
--- a/examples/example_win32_directx9/build_win32.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-mkdir Debug
-cl /nologo /Zi /MD /I .. /I ..\.. /I "%DXSDK_DIR%/Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx9.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx9.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib
diff --git a/examples/example_win32_directx9/example_win32_directx9.vcxproj b/examples/example_win32_directx9/example_win32_directx9.vcxproj
deleted file mode 100644
index 25bdd8599df2..000000000000
--- a/examples/example_win32_directx9/example_win32_directx9.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}
- example_win32_directx9
- 8.1
-
-
-
- Application
- true
- Unicode
- v110
-
-
- Application
- true
- Unicode
- v110
-
-
- Application
- false
- true
- Unicode
- v110
-
-
- Application
- false
- true
- Unicode
- v110
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
- $(ProjectDir)$(Configuration)\
- $(ProjectDir)$(Configuration)\
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;
-
-
- true
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- d3d9.lib;%(AdditionalDependencies)
- Console
-
-
-
-
- Level4
- Disabled
- ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;
-
-
- true
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- d3d9.lib;%(AdditionalDependencies)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;
- false
-
-
- true
- true
- true
- $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)
- d3d9.lib;%(AdditionalDependencies)
- Console
-
-
-
-
- Level4
- MaxSpeed
- true
- true
- ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;
- false
-
-
- true
- true
- true
- $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories)
- d3d9.lib;%(AdditionalDependencies)
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx9/example_win32_directx9.vcxproj.filters b/examples/example_win32_directx9/example_win32_directx9.vcxproj.filters
deleted file mode 100644
index 914cd260cb34..000000000000
--- a/examples/example_win32_directx9/example_win32_directx9.vcxproj.filters
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {a82cba23-9de0-45c2-b1e3-2eb1666702de}
-
-
-
-
- sources
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
- imgui
-
-
-
-
- imgui
-
-
- imgui
-
-
- imgui
-
-
- sources
-
-
- sources
-
-
-
-
-
- sources
-
-
-
\ No newline at end of file
diff --git a/examples/example_win32_directx9/main.cpp b/examples/example_win32_directx9/main.cpp
deleted file mode 100644
index c8ad69f12cd9..000000000000
--- a/examples/example_win32_directx9/main.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-// dear imgui: standalone example application for DirectX 9
-// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
-
-#include "imgui.h"
-#include "imgui_impl_dx9.h"
-#include "imgui_impl_win32.h"
-#include
-#define DIRECTINPUT_VERSION 0x0800
-#include
-#include
-
-// Data
-static LPDIRECT3D9 g_pD3D = NULL;
-static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
-static D3DPRESENT_PARAMETERS g_d3dpp = {};
-
-// Forward declarations of helper functions
-bool CreateDeviceD3D(HWND hWnd);
-void CleanupDeviceD3D();
-void ResetDevice();
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Main code
-int main(int, char**)
-{
- // Create application window
- WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
- ::RegisterClassEx(&wc);
- HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
-
- // Initialize Direct3D
- if (!CreateDeviceD3D(hwnd))
- {
- CleanupDeviceD3D();
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
- return 1;
- }
-
- // Show the window
- ::ShowWindow(hwnd, SW_SHOWDEFAULT);
- ::UpdateWindow(hwnd);
-
- // Setup Dear ImGui context
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- ImGuiIO& io = ImGui::GetIO(); (void)io;
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
-
- // Setup Dear ImGui style
- ImGui::StyleColorsDark();
- //ImGui::StyleColorsClassic();
-
- // Setup Platform/Renderer bindings
- ImGui_ImplWin32_Init(hwnd);
- ImGui_ImplDX9_Init(g_pd3dDevice);
-
- // Load Fonts
- // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
- // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
- // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
- // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
- // - Read 'docs/FONTS.md' for more instructions and details.
- // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
- //io.Fonts->AddFontDefault();
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
- //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
- //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
- //IM_ASSERT(font != NULL);
-
- // Our state
- bool show_demo_window = true;
- bool show_another_window = false;
- ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
- // Main loop
- MSG msg;
- ZeroMemory(&msg, sizeof(msg));
- while (msg.message != WM_QUIT)
- {
- // Poll and handle messages (inputs, window resize, etc.)
- // 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.
- // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
- if (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
- {
- ::TranslateMessage(&msg);
- ::DispatchMessage(&msg);
- continue;
- }
-
- // Start the Dear ImGui frame
- ImGui_ImplDX9_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
-
- // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
- if (show_demo_window)
- ImGui::ShowDemoWindow(&show_demo_window);
-
- // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
- {
- static float f = 0.0f;
- static int counter = 0;
-
- ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
-
- ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
- ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
- ImGui::Checkbox("Another Window", &show_another_window);
-
- ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
- ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
- if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
- counter++;
- ImGui::SameLine();
- ImGui::Text("counter = %d", counter);
-
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::End();
- }
-
- // 3. Show another simple window.
- if (show_another_window)
- {
- ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
- ImGui::Text("Hello from another window!");
- if (ImGui::Button("Close Me"))
- show_another_window = false;
- ImGui::End();
- }
-
- // Rendering
- ImGui::EndFrame();
- g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
- g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
- g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_color.x*255.0f), (int)(clear_color.y*255.0f), (int)(clear_color.z*255.0f), (int)(clear_color.w*255.0f));
- g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clear_col_dx, 1.0f, 0);
- if (g_pd3dDevice->BeginScene() >= 0)
- {
- ImGui::Render();
- ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
- g_pd3dDevice->EndScene();
- }
- HRESULT result = g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
-
- // Handle loss of D3D9 device
- if (result == D3DERR_DEVICELOST && g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
- ResetDevice();
- }
-
- ImGui_ImplDX9_Shutdown();
- ImGui_ImplWin32_Shutdown();
- ImGui::DestroyContext();
-
- CleanupDeviceD3D();
- ::DestroyWindow(hwnd);
- ::UnregisterClass(wc.lpszClassName, wc.hInstance);
-
- return 0;
-}
-
-// Helper functions
-
-bool CreateDeviceD3D(HWND hWnd)
-{
- if ((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
- return false;
-
- // Create the D3DDevice
- ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
- g_d3dpp.Windowed = TRUE;
- g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
- g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
- g_d3dpp.EnableAutoDepthStencil = TRUE;
- g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
- g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync
- //g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate
- if (g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
- return false;
-
- return true;
-}
-
-void CleanupDeviceD3D()
-{
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
- if (g_pD3D) { g_pD3D->Release(); g_pD3D = NULL; }
-}
-
-void ResetDevice()
-{
- ImGui_ImplDX9_InvalidateDeviceObjects();
- HRESULT hr = g_pd3dDevice->Reset(&g_d3dpp);
- if (hr == D3DERR_INVALIDCALL)
- IM_ASSERT(0);
- ImGui_ImplDX9_CreateDeviceObjects();
-}
-
-// Forward declare message handler from imgui_impl_win32.cpp
-extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-// Win32 message handler
-LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
- return true;
-
- switch (msg)
- {
- case WM_SIZE:
- if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
- {
- g_d3dpp.BackBufferWidth = LOWORD(lParam);
- g_d3dpp.BackBufferHeight = HIWORD(lParam);
- ResetDevice();
- }
- return 0;
- case WM_SYSCOMMAND:
- if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
- return 0;
- break;
- case WM_DESTROY:
- ::PostQuitMessage(0);
- return 0;
- }
- return ::DefWindowProc(hWnd, msg, wParam, lParam);
-}
diff --git a/examples/imgui_examples.sln b/examples/imgui_examples.sln
deleted file mode 100644
index 52105559bbef..000000000000
--- a/examples/imgui_examples.sln
+++ /dev/null
@@ -1,81 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28307.168
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx9", "example_win32_directx9\example_win32_directx9.vcxproj", "{4165A294-21F2-44CA-9B38-E3F935ABADF5}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx10", "example_win32_directx10\example_win32_directx10.vcxproj", "{345A953E-A004-4648-B442-DC5F9F11068C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx11", "example_win32_directx11\example_win32_directx11.vcxproj", "{9F316E83-5AE5-4939-A723-305A94F48005}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl2", "example_glfw_opengl2\example_glfw_opengl2.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl3", "example_glfw_opengl3\example_glfw_opengl3.vcxproj", "{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl_opengl2", "example_sdl_opengl2\example_sdl_opengl2.vcxproj", "{94E991D0-790A-4DAF-B442-AAADE3233C75}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|Win32.ActiveCfg = Debug|Win32
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|Win32.Build.0 = Debug|Win32
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|x64.ActiveCfg = Debug|x64
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|x64.Build.0 = Debug|x64
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|Win32.ActiveCfg = Release|Win32
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|Win32.Build.0 = Release|Win32
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|x64.ActiveCfg = Release|x64
- {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|x64.Build.0 = Release|x64
- {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|Win32.ActiveCfg = Debug|Win32
- {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|Win32.Build.0 = Debug|Win32
- {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|x64.ActiveCfg = Debug|x64
- {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|x64.Build.0 = Debug|x64
- {345A953E-A004-4648-B442-DC5F9F11068C}.Release|Win32.ActiveCfg = Release|Win32
- {345A953E-A004-4648-B442-DC5F9F11068C}.Release|Win32.Build.0 = Release|Win32
- {345A953E-A004-4648-B442-DC5F9F11068C}.Release|x64.ActiveCfg = Release|x64
- {345A953E-A004-4648-B442-DC5F9F11068C}.Release|x64.Build.0 = Release|x64
- {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|Win32.ActiveCfg = Debug|Win32
- {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|Win32.Build.0 = Debug|Win32
- {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|x64.ActiveCfg = Debug|x64
- {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|x64.Build.0 = Debug|x64
- {9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.ActiveCfg = Release|Win32
- {9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.Build.0 = Release|Win32
- {9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.ActiveCfg = Release|x64
- {9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.Build.0 = Release|x64
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.ActiveCfg = Debug|Win32
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.Build.0 = Debug|Win32
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.ActiveCfg = Debug|x64
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.Build.0 = Debug|x64
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|Win32.ActiveCfg = Release|Win32
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|Win32.Build.0 = Release|Win32
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|x64.ActiveCfg = Release|x64
- {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|x64.Build.0 = Release|x64
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|Win32.ActiveCfg = Debug|Win32
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|Win32.Build.0 = Debug|Win32
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|x64.ActiveCfg = Debug|x64
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|x64.Build.0 = Debug|x64
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.ActiveCfg = Release|Win32
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.Build.0 = Release|Win32
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.ActiveCfg = Release|x64
- {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.Build.0 = Release|x64
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Debug|Win32.ActiveCfg = Debug|Win32
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Debug|Win32.Build.0 = Debug|Win32
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Debug|x64.ActiveCfg = Debug|x64
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Debug|x64.Build.0 = Debug|x64
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Release|Win32.ActiveCfg = Release|Win32
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Release|Win32.Build.0 = Release|Win32
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Release|x64.ActiveCfg = Release|x64
- {94E991D0-790A-4DAF-B442-AAADE3233C75}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {78198AA5-E0F8-45B2-98DA-188854A8A5A4}
- EndGlobalSection
-EndGlobal
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
deleted file mode 100644
index 2c7df9a92433..000000000000
--- a/examples/imgui_impl_allegro5.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-// dear imgui: Renderer + Platform Binding for Allegro 5
-// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID!
-// [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 copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui, Original Allegro 5 code by @birthggd
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
-// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
-// 2019-05-11: Inputs: Don't filter character value from ALLEGRO_EVENT_KEY_CHAR before calling AddInputCharacter().
-// 2019-04-30: Renderer: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2018-11-30: Platform: Added touchscreen support.
-// 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: 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.
-// 2018-04-18: Misc: Added support for 32-bit vertex indices to avoid conversion at runtime. Added imconfig_allegro5.h to enforce 32-bit indices when included from imgui.h.
-// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplAllegro5_RenderDrawData() in the .h file so you can call it yourself.
-// 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"
-#include "imgui_impl_allegro5.h"
-
-// Allegro
-#include
-#include
-#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
-
-// Visual Studio warnings
-#ifdef _MSC_VER
-#pragma warning (disable: 4127) // condition expression is constant
-#endif
-
-// Data
-static ALLEGRO_DISPLAY* g_Display = NULL;
-static ALLEGRO_BITMAP* g_Texture = NULL;
-static double g_Time = 0.0;
-static ALLEGRO_MOUSE_CURSOR* g_MouseCursorInvisible = NULL;
-static ALLEGRO_VERTEX_DECL* g_VertexDecl = NULL;
-static char* g_ClipboardTextData = NULL;
-
-struct ImDrawVertAllegro
-{
- ImVec2 pos;
- ImVec2 uv;
- ALLEGRO_COLOR col;
-};
-
-static void ImGui_ImplAllegro5_SetupRenderState(ImDrawData* draw_data)
-{
- // Setup blending
- al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
-
- // Setup orthographic projection matrix
- // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right).
- {
- float L = draw_data->DisplayPos.x;
- float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
- float T = draw_data->DisplayPos.y;
- float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
- ALLEGRO_TRANSFORM transform;
- al_identity_transform(&transform);
- al_use_transform(&transform);
- al_orthographic_transform(&transform, L, T, 1.0f, R, B, -1.0f);
- al_use_projection_transform(&transform);
- }
-}
-
-// Render function.
-// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
-void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
-{
- // Avoid rendering when minimized
- if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
- return;
-
- // Backup Allegro state that will be modified
- ALLEGRO_TRANSFORM last_transform = *al_get_current_transform();
- ALLEGRO_TRANSFORM last_projection_transform = *al_get_current_projection_transform();
- int last_clip_x, last_clip_y, last_clip_w, last_clip_h;
- al_get_clipping_rectangle(&last_clip_x, &last_clip_y, &last_clip_w, &last_clip_h);
- int last_blender_op, last_blender_src, last_blender_dst;
- al_get_blender(&last_blender_op, &last_blender_src, &last_blender_dst);
-
- // Setup desired render state
- ImGui_ImplAllegro5_SetupRenderState(draw_data);
-
- // Render command lists
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- 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++)
- {
- const ImDrawVert* src_v = &cmd_list->VtxBuffer[cmd_list->IdxBuffer[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]);
- }
-
- const int* indices = NULL;
- 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.
- // 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);
- for (int i = 0; i < cmd_list->IdxBuffer.Size; ++i)
- indices_converted[i] = (int)cmd_list->IdxBuffer.Data[i];
- indices = indices_converted.Data;
- }
- else if (sizeof(ImDrawIdx) == 4)
- {
- indices = (const int*)cmd_list->IdxBuffer.Data;
- }
-
- // Render command lists
- int idx_offset = 0;
- ImVec2 clip_off = draw_data->DisplayPos;
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback)
- {
- // User callback, registered via ImDrawList::AddCallback()
- // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
- if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
- ImGui_ImplAllegro5_SetupRenderState(draw_data);
- else
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- // Draw
- ALLEGRO_BITMAP* texture = (ALLEGRO_BITMAP*)pcmd->TextureId;
- al_set_clipping_rectangle(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y, pcmd->ClipRect.z - pcmd->ClipRect.x, pcmd->ClipRect.w - pcmd->ClipRect.y);
- al_draw_prim(&vertices[0], g_VertexDecl, texture, idx_offset, idx_offset + pcmd->ElemCount, ALLEGRO_PRIM_TRIANGLE_LIST);
- }
- idx_offset += pcmd->ElemCount;
- }
- }
-
- // Restore modified Allegro state
- al_set_blender(last_blender_op, last_blender_src, last_blender_dst);
- al_set_clipping_rectangle(last_clip_x, last_clip_y, last_clip_w, last_clip_h);
- al_use_transform(&last_transform);
- al_use_projection_transform(&last_projection_transform);
-}
-
-bool ImGui_ImplAllegro5_CreateDeviceObjects()
-{
- // Build texture atlas
- ImGuiIO &io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
-
- // Create texture
- 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);
- al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE);
- ALLEGRO_BITMAP* img = al_create_bitmap(width, height);
- al_set_new_bitmap_flags(flags);
- al_set_new_bitmap_format(fmt);
- if (!img)
- return false;
-
- ALLEGRO_LOCKED_REGION *locked_img = al_lock_bitmap(img, al_get_bitmap_format(img), ALLEGRO_LOCK_WRITEONLY);
- if (!locked_img)
- {
- al_destroy_bitmap(img);
- return false;
- }
- memcpy(locked_img->data, pixels, sizeof(int)*width*height);
- al_unlock_bitmap(img);
-
- // Convert software texture to hardware texture.
- ALLEGRO_BITMAP* cloned_img = al_clone_bitmap(img);
- al_destroy_bitmap(img);
- if (!cloned_img)
- return false;
-
- // Store our identifier
- io.Fonts->TexID = (void*)cloned_img;
- g_Texture = cloned_img;
-
- // Create an invisible mouse cursor
- // Because al_hide_mouse_cursor() seems to mess up with the actual inputs..
- ALLEGRO_BITMAP* mouse_cursor = al_create_bitmap(8,8);
- g_MouseCursorInvisible = al_create_mouse_cursor(mouse_cursor, 0, 0);
- al_destroy_bitmap(mouse_cursor);
-
- return true;
-}
-
-void ImGui_ImplAllegro5_InvalidateDeviceObjects()
-{
- if (g_Texture)
- {
- al_destroy_bitmap(g_Texture);
- ImGui::GetIO().Fonts->TexID = NULL;
- g_Texture = NULL;
- }
- if (g_MouseCursorInvisible)
- {
- al_destroy_mouse_cursor(g_MouseCursorInvisible);
- g_MouseCursorInvisible = NULL;
- }
-}
-
-#if ALLEGRO_HAS_CLIPBOARD
-static const char* ImGui_ImplAllegro5_GetClipboardText(void*)
-{
- if (g_ClipboardTextData)
- al_free(g_ClipboardTextData);
- g_ClipboardTextData = al_get_clipboard_text(g_Display);
- return g_ClipboardTextData;
-}
-
-static void ImGui_ImplAllegro5_SetClipboardText(void*, const char* text)
-{
- al_set_clipboard_text(g_Display, text);
-}
-#endif
-
-bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
-{
- g_Display = display;
-
- // Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
- io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
- io.BackendPlatformName = io.BackendRendererName = "imgui_impl_allegro5";
-
- // Create custom vertex declaration.
- // Unfortunately Allegro doesn't support 32-bit packed colors so we have to convert them to 4 floats.
- // 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) },
- { 0, 0, 0 }
- };
- g_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;
-#endif
-
- return true;
-}
-
-void ImGui_ImplAllegro5_Shutdown()
-{
- ImGui_ImplAllegro5_InvalidateDeviceObjects();
-
- g_Display = NULL;
- g_Time = 0.0;
-
- if (g_VertexDecl)
- al_destroy_vertex_decl(g_VertexDecl);
- g_VertexDecl = NULL;
-
- if (g_ClipboardTextData)
- al_free(g_ClipboardTextData);
- g_ClipboardTextData = NULL;
-}
-
-// 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.
-// 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)
-{
- ImGuiIO& io = ImGui::GetIO();
-
- switch (ev->type)
- {
- case ALLEGRO_EVENT_MOUSE_AXES:
- if (ev->mouse.display == g_Display)
- {
- io.MouseWheel += ev->mouse.dz;
- io.MouseWheelH += ev->mouse.dw;
- io.MousePos = ImVec2(ev->mouse.x, ev->mouse.y);
- }
- return true;
- case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN:
- case ALLEGRO_EVENT_MOUSE_BUTTON_UP:
- if (ev->mouse.display == g_Display && ev->mouse.button <= 5)
- io.MouseDown[ev->mouse.button - 1] = (ev->type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN);
- return true;
- case ALLEGRO_EVENT_TOUCH_MOVE:
- if (ev->touch.display == g_Display)
- io.MousePos = ImVec2(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 == g_Display && ev->touch.primary)
- io.MouseDown[0] = (ev->type == ALLEGRO_EVENT_TOUCH_BEGIN);
- return true;
- case ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY:
- if (ev->mouse.display == g_Display)
- io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
- return true;
- case ALLEGRO_EVENT_KEY_CHAR:
- if (ev->keyboard.display == g_Display)
- if (ev->keyboard.unichar != 0)
- io.AddInputCharacter((unsigned int)ev->keyboard.unichar);
- return true;
- case ALLEGRO_EVENT_KEY_DOWN:
- case ALLEGRO_EVENT_KEY_UP:
- if (ev->keyboard.display == g_Display)
- io.KeysDown[ev->keyboard.keycode] = (ev->type == ALLEGRO_EVENT_KEY_DOWN);
- return true;
- }
- return false;
-}
-
-static void ImGui_ImplAllegro5_UpdateMouseCursor()
-{
- ImGuiIO& io = ImGui::GetIO();
- if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
- return;
-
- ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
- if (io.MouseDrawCursor || imgui_cursor == ImGuiMouseCursor_None)
- {
- // Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (imgui_cursor)
- {
- case ImGuiMouseCursor_TextInput: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT; break;
- case ImGuiMouseCursor_ResizeAll: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE; break;
- case ImGuiMouseCursor_ResizeNS: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N; break;
- case ImGuiMouseCursor_ResizeEW: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E; break;
- case ImGuiMouseCursor_ResizeNESW: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE; break;
- case ImGuiMouseCursor_ResizeNWSE: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW; break;
- case ImGuiMouseCursor_NotAllowed: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE; break;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
-}
-
-void ImGui_ImplAllegro5_NewFrame()
-{
- if (!g_Texture)
- ImGui_ImplAllegro5_CreateDeviceObjects();
-
- ImGuiIO &io = ImGui::GetIO();
-
- // Setup display size (every frame to accommodate for window resizing)
- int w, h;
- w = al_get_display_width(g_Display);
- h = al_get_display_height(g_Display);
- io.DisplaySize = ImVec2((float)w, (float)h);
-
- // Setup time step
- double current_time = al_get_time();
- io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f);
- g_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);
-
- ImGui_ImplAllegro5_UpdateMouseCursor();
-}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
deleted file mode 100644
index f41e4c90968c..000000000000
--- a/examples/imgui_impl_allegro5.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// dear imgui: Renderer + Platform Binding for Allegro 5
-// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID!
-// [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 copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui, Original Allegro 5 code by @birthggd
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-struct ALLEGRO_DISPLAY;
-union ALLEGRO_EVENT;
-
-IMGUI_IMPL_API bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display);
-IMGUI_IMPL_API void ImGui_ImplAllegro5_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplAllegro5_NewFrame();
-IMGUI_IMPL_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data);
-IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event);
-
-// Use if you want to reset your rendering device without losing Dear ImGui state.
-IMGUI_IMPL_API bool ImGui_ImplAllegro5_CreateDeviceObjects();
-IMGUI_IMPL_API void ImGui_ImplAllegro5_InvalidateDeviceObjects();
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
deleted file mode 100644
index 23ade277dca5..000000000000
--- a/examples/imgui_impl_dx10.cpp
+++ /dev/null
@@ -1,536 +0,0 @@
-// dear imgui: Renderer for DirectX10
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-07-21: DirectX10: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData().
-// 2019-05-29: DirectX10: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
-// 2019-04-30: DirectX10: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
-// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
-// 2018-07-13: DirectX10: Fixed unreleased resources in Init and Shutdown functions.
-// 2018-06-08: Misc: Extracted imgui_impl_dx10.cpp/.h away from the old combined DX10+Win32 example.
-// 2018-06-08: DirectX10: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
-// 2018-04-09: Misc: Fixed erroneous call to io.Fonts->ClearInputData() + ClearTexData() that was left in DX10 example but removed in 1.47 (Nov 2015) on other back-ends.
-// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX10_RenderDrawData() in the .h file so you can call it yourself.
-// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
-// 2016-05-07: DirectX10: Disabling depth-write.
-
-#include "imgui.h"
-#include "imgui_impl_dx10.h"
-
-// DirectX
-#include
-#include
-#include
-#include
-#ifdef _MSC_VER
-#pragma comment(lib, "d3dcompiler") // Automatically link with d3dcompiler.lib as we are using D3DCompile() below.
-#endif
-
-// DirectX data
-static ID3D10Device* g_pd3dDevice = NULL;
-static IDXGIFactory* g_pFactory = NULL;
-static ID3D10Buffer* g_pVB = NULL;
-static ID3D10Buffer* g_pIB = NULL;
-static ID3D10VertexShader* g_pVertexShader = NULL;
-static ID3D10InputLayout* g_pInputLayout = NULL;
-static ID3D10Buffer* g_pVertexConstantBuffer = NULL;
-static ID3D10PixelShader* g_pPixelShader = NULL;
-static ID3D10SamplerState* g_pFontSampler = NULL;
-static ID3D10ShaderResourceView*g_pFontTextureView = NULL;
-static ID3D10RasterizerState* g_pRasterizerState = NULL;
-static ID3D10BlendState* g_pBlendState = NULL;
-static ID3D10DepthStencilState* g_pDepthStencilState = NULL;
-static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
-
-struct VERTEX_CONSTANT_BUFFER
-{
- float mvp[4][4];
-};
-
-static void ImGui_ImplDX10_SetupRenderState(ImDrawData* draw_data, ID3D10Device* ctx)
-{
- // Setup viewport
- D3D10_VIEWPORT vp;
- memset(&vp, 0, sizeof(D3D10_VIEWPORT));
- vp.Width = (UINT)draw_data->DisplaySize.x;
- vp.Height = (UINT)draw_data->DisplaySize.y;
- vp.MinDepth = 0.0f;
- vp.MaxDepth = 1.0f;
- vp.TopLeftX = vp.TopLeftY = 0;
- ctx->RSSetViewports(1, &vp);
-
- // Bind shader and vertex buffers
- unsigned int stride = sizeof(ImDrawVert);
- unsigned int offset = 0;
- ctx->IASetInputLayout(g_pInputLayout);
- ctx->IASetVertexBuffers(0, 1, &g_pVB, &stride, &offset);
- ctx->IASetIndexBuffer(g_pIB, sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);
- ctx->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
- ctx->VSSetShader(g_pVertexShader);
- ctx->VSSetConstantBuffers(0, 1, &g_pVertexConstantBuffer);
- ctx->PSSetShader(g_pPixelShader);
- ctx->PSSetSamplers(0, 1, &g_pFontSampler);
- ctx->GSSetShader(NULL);
-
- // Setup render state
- const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
- ctx->OMSetBlendState(g_pBlendState, blend_factor, 0xffffffff);
- ctx->OMSetDepthStencilState(g_pDepthStencilState, 0);
- ctx->RSSetState(g_pRasterizerState);
-}
-
-// Render function
-// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
-void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
-{
- // Avoid rendering when minimized
- if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
- return;
-
- ID3D10Device* ctx = g_pd3dDevice;
-
- // Create and grow vertex/index buffers if needed
- if (!g_pVB || g_VertexBufferSize < draw_data->TotalVtxCount)
- {
- if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
- g_VertexBufferSize = draw_data->TotalVtxCount + 5000;
- D3D10_BUFFER_DESC desc;
- memset(&desc, 0, sizeof(D3D10_BUFFER_DESC));
- desc.Usage = D3D10_USAGE_DYNAMIC;
- desc.ByteWidth = g_VertexBufferSize * sizeof(ImDrawVert);
- desc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
- desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
- desc.MiscFlags = 0;
- if (ctx->CreateBuffer(&desc, NULL, &g_pVB) < 0)
- return;
- }
-
- if (!g_pIB || g_IndexBufferSize < draw_data->TotalIdxCount)
- {
- if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
- g_IndexBufferSize = draw_data->TotalIdxCount + 10000;
- D3D10_BUFFER_DESC desc;
- memset(&desc, 0, sizeof(D3D10_BUFFER_DESC));
- desc.Usage = D3D10_USAGE_DYNAMIC;
- desc.ByteWidth = g_IndexBufferSize * sizeof(ImDrawIdx);
- desc.BindFlags = D3D10_BIND_INDEX_BUFFER;
- desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
- if (ctx->CreateBuffer(&desc, NULL, &g_pIB) < 0)
- return;
- }
-
- // Copy and convert all vertices into a single contiguous buffer
- ImDrawVert* vtx_dst = NULL;
- ImDrawIdx* idx_dst = NULL;
- g_pVB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&vtx_dst);
- g_pIB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&idx_dst);
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
- memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
- vtx_dst += cmd_list->VtxBuffer.Size;
- idx_dst += cmd_list->IdxBuffer.Size;
- }
- g_pVB->Unmap();
- g_pIB->Unmap();
-
- // Setup orthographic projection matrix into our constant buffer
- // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
- {
- void* mapped_resource;
- if (g_pVertexConstantBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK)
- return;
- VERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource;
- float L = draw_data->DisplayPos.x;
- float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
- float T = draw_data->DisplayPos.y;
- float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
- float mvp[4][4] =
- {
- { 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
- { 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
- { 0.0f, 0.0f, 0.5f, 0.0f },
- { (R+L)/(L-R), (T+B)/(B-T), 0.5f, 1.0f },
- };
- memcpy(&constant_buffer->mvp, mvp, sizeof(mvp));
- g_pVertexConstantBuffer->Unmap();
- }
-
- // Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)
- struct BACKUP_DX10_STATE
- {
- UINT ScissorRectsCount, ViewportsCount;
- D3D10_RECT ScissorRects[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
- D3D10_VIEWPORT Viewports[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
- ID3D10RasterizerState* RS;
- ID3D10BlendState* BlendState;
- FLOAT BlendFactor[4];
- UINT SampleMask;
- UINT StencilRef;
- ID3D10DepthStencilState* DepthStencilState;
- ID3D10ShaderResourceView* PSShaderResource;
- ID3D10SamplerState* PSSampler;
- ID3D10PixelShader* PS;
- ID3D10VertexShader* VS;
- ID3D10GeometryShader* GS;
- D3D10_PRIMITIVE_TOPOLOGY PrimitiveTopology;
- ID3D10Buffer* IndexBuffer, *VertexBuffer, *VSConstantBuffer;
- UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
- DXGI_FORMAT IndexBufferFormat;
- ID3D10InputLayout* InputLayout;
- };
- BACKUP_DX10_STATE old;
- old.ScissorRectsCount = old.ViewportsCount = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
- ctx->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects);
- ctx->RSGetViewports(&old.ViewportsCount, old.Viewports);
- ctx->RSGetState(&old.RS);
- ctx->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);
- ctx->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);
- ctx->PSGetShaderResources(0, 1, &old.PSShaderResource);
- ctx->PSGetSamplers(0, 1, &old.PSSampler);
- ctx->PSGetShader(&old.PS);
- ctx->VSGetShader(&old.VS);
- ctx->VSGetConstantBuffers(0, 1, &old.VSConstantBuffer);
- ctx->GSGetShader(&old.GS);
- ctx->IAGetPrimitiveTopology(&old.PrimitiveTopology);
- ctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);
- ctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);
- ctx->IAGetInputLayout(&old.InputLayout);
-
- // Setup desired DX state
- ImGui_ImplDX10_SetupRenderState(draw_data, ctx);
-
- // Render command lists
- // (Because we merged all buffers into a single one, we maintain our own offset into them)
- int global_vtx_offset = 0;
- int global_idx_offset = 0;
- ImVec2 clip_off = draw_data->DisplayPos;
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback)
- {
- // User callback, registered via ImDrawList::AddCallback()
- // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
- if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
- ImGui_ImplDX10_SetupRenderState(draw_data, ctx);
- else
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- // Apply scissor/clipping rectangle
- const D3D10_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y)};
- ctx->RSSetScissorRects(1, &r);
-
- // Bind texture, Draw
- ID3D10ShaderResourceView* texture_srv = (ID3D10ShaderResourceView*)pcmd->TextureId;
- ctx->PSSetShaderResources(0, 1, &texture_srv);
- ctx->DrawIndexed(pcmd->ElemCount, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset);
- }
- }
- global_idx_offset += cmd_list->IdxBuffer.Size;
- global_vtx_offset += cmd_list->VtxBuffer.Size;
- }
-
- // Restore modified DX state
- ctx->RSSetScissorRects(old.ScissorRectsCount, old.ScissorRects);
- ctx->RSSetViewports(old.ViewportsCount, old.Viewports);
- ctx->RSSetState(old.RS); if (old.RS) old.RS->Release();
- ctx->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();
- ctx->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef); if (old.DepthStencilState) old.DepthStencilState->Release();
- ctx->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();
- ctx->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();
- ctx->PSSetShader(old.PS); if (old.PS) old.PS->Release();
- ctx->VSSetShader(old.VS); if (old.VS) old.VS->Release();
- ctx->GSSetShader(old.GS); if (old.GS) old.GS->Release();
- ctx->VSSetConstantBuffers(0, 1, &old.VSConstantBuffer); if (old.VSConstantBuffer) old.VSConstantBuffer->Release();
- ctx->IASetPrimitiveTopology(old.PrimitiveTopology);
- ctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();
- ctx->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();
- ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
-}
-
-static void ImGui_ImplDX10_CreateFontsTexture()
-{
- // Build texture atlas
- ImGuiIO& io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
-
- // Upload texture to graphics system
- {
- D3D10_TEXTURE2D_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.Width = width;
- desc.Height = height;
- desc.MipLevels = 1;
- desc.ArraySize = 1;
- desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- desc.SampleDesc.Count = 1;
- desc.Usage = D3D10_USAGE_DEFAULT;
- desc.BindFlags = D3D10_BIND_SHADER_RESOURCE;
- desc.CPUAccessFlags = 0;
-
- ID3D10Texture2D *pTexture = NULL;
- D3D10_SUBRESOURCE_DATA subResource;
- subResource.pSysMem = pixels;
- subResource.SysMemPitch = desc.Width * 4;
- subResource.SysMemSlicePitch = 0;
- g_pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);
-
- // Create texture view
- D3D10_SHADER_RESOURCE_VIEW_DESC srv_desc;
- ZeroMemory(&srv_desc, sizeof(srv_desc));
- srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- srv_desc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D;
- srv_desc.Texture2D.MipLevels = desc.MipLevels;
- srv_desc.Texture2D.MostDetailedMip = 0;
- g_pd3dDevice->CreateShaderResourceView(pTexture, &srv_desc, &g_pFontTextureView);
- pTexture->Release();
- }
-
- // Store our identifier
- io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
-
- // Create texture sampler
- {
- D3D10_SAMPLER_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR;
- desc.AddressU = D3D10_TEXTURE_ADDRESS_WRAP;
- desc.AddressV = D3D10_TEXTURE_ADDRESS_WRAP;
- desc.AddressW = D3D10_TEXTURE_ADDRESS_WRAP;
- desc.MipLODBias = 0.f;
- desc.ComparisonFunc = D3D10_COMPARISON_ALWAYS;
- desc.MinLOD = 0.f;
- desc.MaxLOD = 0.f;
- g_pd3dDevice->CreateSamplerState(&desc, &g_pFontSampler);
- }
-}
-
-bool ImGui_ImplDX10_CreateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return false;
- if (g_pFontSampler)
- ImGui_ImplDX10_InvalidateDeviceObjects();
-
- // By using D3DCompile() from / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
- // If you would like to use this DX10 sample code but remove this dependency you can:
- // 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]
- // 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
- // See https://github.com/ocornut/imgui/pull/638 for sources and details.
-
- // Create the vertex shader
- {
- static const char* vertexShader =
- "cbuffer vertexBuffer : register(b0) \
- {\
- float4x4 ProjectionMatrix; \
- };\
- struct VS_INPUT\
- {\
- float2 pos : POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- \
- struct PS_INPUT\
- {\
- float4 pos : SV_POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- \
- PS_INPUT main(VS_INPUT input)\
- {\
- PS_INPUT output;\
- output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
- output.col = input.col;\
- output.uv = input.uv;\
- return output;\
- }";
-
- ID3DBlob* vertexShaderBlob;
- if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), NULL, NULL, NULL, "main", "vs_4_0", 0, 0, &vertexShaderBlob, NULL)))
- return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
- if (g_pd3dDevice->CreateVertexShader(vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_pVertexShader) != S_OK)
- {
- vertexShaderBlob->Release();
- return false;
- }
-
- // Create the input layout
- D3D10_INPUT_ELEMENT_DESC local_layout[] =
- {
- { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D10_INPUT_PER_VERTEX_DATA, 0 },
- { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, uv), D3D10_INPUT_PER_VERTEX_DATA, 0 },
- { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D10_INPUT_PER_VERTEX_DATA, 0 },
- };
- if (g_pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK)
- {
- vertexShaderBlob->Release();
- return false;
- }
- vertexShaderBlob->Release();
-
- // Create the constant buffer
- {
- D3D10_BUFFER_DESC desc;
- desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER);
- desc.Usage = D3D10_USAGE_DYNAMIC;
- desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER;
- desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
- desc.MiscFlags = 0;
- g_pd3dDevice->CreateBuffer(&desc, NULL, &g_pVertexConstantBuffer);
- }
- }
-
- // Create the pixel shader
- {
- static const char* pixelShader =
- "struct PS_INPUT\
- {\
- float4 pos : SV_POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- sampler sampler0;\
- Texture2D texture0;\
- \
- float4 main(PS_INPUT input) : SV_Target\
- {\
- float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \
- return out_col; \
- }";
-
- ID3DBlob* pixelShaderBlob;
- if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), NULL, NULL, NULL, "main", "ps_4_0", 0, 0, &pixelShaderBlob, NULL)))
- return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
- if (g_pd3dDevice->CreatePixelShader(pixelShaderBlob->GetBufferPointer(), pixelShaderBlob->GetBufferSize(), &g_pPixelShader) != S_OK)
- {
- pixelShaderBlob->Release();
- return false;
- }
- pixelShaderBlob->Release();
- }
-
- // Create the blending setup
- {
- D3D10_BLEND_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.AlphaToCoverageEnable = false;
- desc.BlendEnable[0] = true;
- desc.SrcBlend = D3D10_BLEND_SRC_ALPHA;
- desc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA;
- desc.BlendOp = D3D10_BLEND_OP_ADD;
- desc.SrcBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA;
- desc.DestBlendAlpha = D3D10_BLEND_ZERO;
- desc.BlendOpAlpha = D3D10_BLEND_OP_ADD;
- desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL;
- g_pd3dDevice->CreateBlendState(&desc, &g_pBlendState);
- }
-
- // Create the rasterizer state
- {
- D3D10_RASTERIZER_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.FillMode = D3D10_FILL_SOLID;
- desc.CullMode = D3D10_CULL_NONE;
- desc.ScissorEnable = true;
- desc.DepthClipEnable = true;
- g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
- }
-
- // Create depth-stencil State
- {
- D3D10_DEPTH_STENCIL_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.DepthEnable = false;
- desc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL;
- desc.DepthFunc = D3D10_COMPARISON_ALWAYS;
- desc.StencilEnable = false;
- desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D10_STENCIL_OP_KEEP;
- desc.FrontFace.StencilFunc = D3D10_COMPARISON_ALWAYS;
- desc.BackFace = desc.FrontFace;
- g_pd3dDevice->CreateDepthStencilState(&desc, &g_pDepthStencilState);
- }
-
- ImGui_ImplDX10_CreateFontsTexture();
-
- return true;
-}
-
-void ImGui_ImplDX10_InvalidateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return;
-
- if (g_pFontSampler) { g_pFontSampler->Release(); g_pFontSampler = NULL; }
- if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
- if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
- if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
-
- if (g_pBlendState) { g_pBlendState->Release(); g_pBlendState = NULL; }
- if (g_pDepthStencilState) { g_pDepthStencilState->Release(); g_pDepthStencilState = NULL; }
- if (g_pRasterizerState) { g_pRasterizerState->Release(); g_pRasterizerState = NULL; }
- if (g_pPixelShader) { g_pPixelShader->Release(); g_pPixelShader = NULL; }
- if (g_pVertexConstantBuffer) { g_pVertexConstantBuffer->Release(); g_pVertexConstantBuffer = NULL; }
- if (g_pInputLayout) { g_pInputLayout->Release(); g_pInputLayout = NULL; }
- if (g_pVertexShader) { g_pVertexShader->Release(); g_pVertexShader = NULL; }
-}
-
-bool ImGui_ImplDX10_Init(ID3D10Device* device)
-{
- // Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
- io.BackendRendererName = "imgui_impl_dx10";
- io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
-
- // Get factory from device
- IDXGIDevice* pDXGIDevice = NULL;
- IDXGIAdapter* pDXGIAdapter = NULL;
- IDXGIFactory* pFactory = NULL;
-
- if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) == S_OK)
- if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) == S_OK)
- if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) == S_OK)
- {
- g_pd3dDevice = device;
- g_pFactory = pFactory;
- }
- if (pDXGIDevice) pDXGIDevice->Release();
- if (pDXGIAdapter) pDXGIAdapter->Release();
- g_pd3dDevice->AddRef();
-
- return true;
-}
-
-void ImGui_ImplDX10_Shutdown()
-{
- ImGui_ImplDX10_InvalidateDeviceObjects();
- if (g_pFactory) { g_pFactory->Release(); g_pFactory = NULL; }
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
-}
-
-void ImGui_ImplDX10_NewFrame()
-{
- if (!g_pFontSampler)
- ImGui_ImplDX10_CreateDeviceObjects();
-}
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
deleted file mode 100644
index d974ba8e3412..000000000000
--- a/examples/imgui_impl_dx10.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// dear imgui: Renderer for DirectX10
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-struct ID3D10Device;
-
-IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device);
-IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame();
-IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data);
-
-// Use if you want to reset your rendering device without losing Dear ImGui state.
-IMGUI_IMPL_API void ImGui_ImplDX10_InvalidateDeviceObjects();
-IMGUI_IMPL_API bool ImGui_ImplDX10_CreateDeviceObjects();
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
deleted file mode 100644
index 26eb407f3e81..000000000000
--- a/examples/imgui_impl_dx11.cpp
+++ /dev/null
@@ -1,551 +0,0 @@
-// dear imgui: Renderer for DirectX11
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-08-01: DirectX11: Fixed code querying the Geometry Shader state (would generally error with Debug layer enabled).
-// 2019-07-21: DirectX11: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData. Clearing Hull/Domain/Compute shaders without backup/restore.
-// 2019-05-29: DirectX11: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
-// 2019-04-30: DirectX11: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
-// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
-// 2018-08-01: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility.
-// 2018-07-13: DirectX11: Fixed unreleased resources in Init and Shutdown functions.
-// 2018-06-08: Misc: Extracted imgui_impl_dx11.cpp/.h away from the old combined DX11+Win32 example.
-// 2018-06-08: DirectX11: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
-// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX11_RenderDrawData() in the .h file so you can call it yourself.
-// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
-// 2016-05-07: DirectX11: Disabling depth-write.
-
-#include "imgui.h"
-#include "imgui_impl_dx11.h"
-
-// DirectX
-#include
-#include
-#include
-#ifdef _MSC_VER
-#pragma comment(lib, "d3dcompiler") // Automatically link with d3dcompiler.lib as we are using D3DCompile() below.
-#endif
-
-// DirectX data
-static ID3D11Device* g_pd3dDevice = NULL;
-static ID3D11DeviceContext* g_pd3dDeviceContext = NULL;
-static IDXGIFactory* g_pFactory = NULL;
-static ID3D11Buffer* g_pVB = NULL;
-static ID3D11Buffer* g_pIB = NULL;
-static ID3D11VertexShader* g_pVertexShader = NULL;
-static ID3D11InputLayout* g_pInputLayout = NULL;
-static ID3D11Buffer* g_pVertexConstantBuffer = NULL;
-static ID3D11PixelShader* g_pPixelShader = NULL;
-static ID3D11SamplerState* g_pFontSampler = NULL;
-static ID3D11ShaderResourceView*g_pFontTextureView = NULL;
-static ID3D11RasterizerState* g_pRasterizerState = NULL;
-static ID3D11BlendState* g_pBlendState = NULL;
-static ID3D11DepthStencilState* g_pDepthStencilState = NULL;
-static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
-
-struct VERTEX_CONSTANT_BUFFER
-{
- float mvp[4][4];
-};
-
-static void ImGui_ImplDX11_SetupRenderState(ImDrawData* draw_data, ID3D11DeviceContext* ctx)
-{
- // Setup viewport
- D3D11_VIEWPORT vp;
- memset(&vp, 0, sizeof(D3D11_VIEWPORT));
- vp.Width = draw_data->DisplaySize.x;
- vp.Height = draw_data->DisplaySize.y;
- vp.MinDepth = 0.0f;
- vp.MaxDepth = 1.0f;
- vp.TopLeftX = vp.TopLeftY = 0;
- ctx->RSSetViewports(1, &vp);
-
- // Setup shader and vertex buffers
- unsigned int stride = sizeof(ImDrawVert);
- unsigned int offset = 0;
- ctx->IASetInputLayout(g_pInputLayout);
- ctx->IASetVertexBuffers(0, 1, &g_pVB, &stride, &offset);
- ctx->IASetIndexBuffer(g_pIB, sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);
- ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
- ctx->VSSetShader(g_pVertexShader, NULL, 0);
- ctx->VSSetConstantBuffers(0, 1, &g_pVertexConstantBuffer);
- ctx->PSSetShader(g_pPixelShader, NULL, 0);
- ctx->PSSetSamplers(0, 1, &g_pFontSampler);
- ctx->GSSetShader(NULL, NULL, 0);
- ctx->HSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
- ctx->DSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
- ctx->CSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
-
- // Setup blend state
- const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
- ctx->OMSetBlendState(g_pBlendState, blend_factor, 0xffffffff);
- ctx->OMSetDepthStencilState(g_pDepthStencilState, 0);
- ctx->RSSetState(g_pRasterizerState);
-}
-
-// Render function
-// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
-void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
-{
- // Avoid rendering when minimized
- if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
- return;
-
- ID3D11DeviceContext* ctx = g_pd3dDeviceContext;
-
- // Create and grow vertex/index buffers if needed
- if (!g_pVB || g_VertexBufferSize < draw_data->TotalVtxCount)
- {
- if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
- g_VertexBufferSize = draw_data->TotalVtxCount + 5000;
- D3D11_BUFFER_DESC desc;
- memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));
- desc.Usage = D3D11_USAGE_DYNAMIC;
- desc.ByteWidth = g_VertexBufferSize * sizeof(ImDrawVert);
- desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- desc.MiscFlags = 0;
- if (g_pd3dDevice->CreateBuffer(&desc, NULL, &g_pVB) < 0)
- return;
- }
- if (!g_pIB || g_IndexBufferSize < draw_data->TotalIdxCount)
- {
- if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
- g_IndexBufferSize = draw_data->TotalIdxCount + 10000;
- D3D11_BUFFER_DESC desc;
- memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));
- desc.Usage = D3D11_USAGE_DYNAMIC;
- desc.ByteWidth = g_IndexBufferSize * sizeof(ImDrawIdx);
- desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
- desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- if (g_pd3dDevice->CreateBuffer(&desc, NULL, &g_pIB) < 0)
- return;
- }
-
- // Upload vertex/index data into a single contiguous GPU buffer
- D3D11_MAPPED_SUBRESOURCE vtx_resource, idx_resource;
- if (ctx->Map(g_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &vtx_resource) != S_OK)
- return;
- if (ctx->Map(g_pIB, 0, D3D11_MAP_WRITE_DISCARD, 0, &idx_resource) != S_OK)
- return;
- ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource.pData;
- ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource.pData;
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
- memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
- vtx_dst += cmd_list->VtxBuffer.Size;
- idx_dst += cmd_list->IdxBuffer.Size;
- }
- ctx->Unmap(g_pVB, 0);
- ctx->Unmap(g_pIB, 0);
-
- // Setup orthographic projection matrix into our constant buffer
- // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
- {
- D3D11_MAPPED_SUBRESOURCE mapped_resource;
- if (ctx->Map(g_pVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK)
- return;
- VERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource.pData;
- float L = draw_data->DisplayPos.x;
- float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
- float T = draw_data->DisplayPos.y;
- float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
- float mvp[4][4] =
- {
- { 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
- { 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
- { 0.0f, 0.0f, 0.5f, 0.0f },
- { (R+L)/(L-R), (T+B)/(B-T), 0.5f, 1.0f },
- };
- memcpy(&constant_buffer->mvp, mvp, sizeof(mvp));
- ctx->Unmap(g_pVertexConstantBuffer, 0);
- }
-
- // Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)
- struct BACKUP_DX11_STATE
- {
- UINT ScissorRectsCount, ViewportsCount;
- D3D11_RECT ScissorRects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
- D3D11_VIEWPORT Viewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
- ID3D11RasterizerState* RS;
- ID3D11BlendState* BlendState;
- FLOAT BlendFactor[4];
- UINT SampleMask;
- UINT StencilRef;
- ID3D11DepthStencilState* DepthStencilState;
- ID3D11ShaderResourceView* PSShaderResource;
- ID3D11SamplerState* PSSampler;
- ID3D11PixelShader* PS;
- ID3D11VertexShader* VS;
- ID3D11GeometryShader* GS;
- UINT PSInstancesCount, VSInstancesCount, GSInstancesCount;
- ID3D11ClassInstance *PSInstances[256], *VSInstances[256], *GSInstances[256]; // 256 is max according to PSSetShader documentation
- D3D11_PRIMITIVE_TOPOLOGY PrimitiveTopology;
- ID3D11Buffer* IndexBuffer, *VertexBuffer, *VSConstantBuffer;
- UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
- DXGI_FORMAT IndexBufferFormat;
- ID3D11InputLayout* InputLayout;
- };
- BACKUP_DX11_STATE old;
- old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
- ctx->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects);
- ctx->RSGetViewports(&old.ViewportsCount, old.Viewports);
- ctx->RSGetState(&old.RS);
- ctx->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);
- ctx->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);
- ctx->PSGetShaderResources(0, 1, &old.PSShaderResource);
- ctx->PSGetSamplers(0, 1, &old.PSSampler);
- old.PSInstancesCount = old.VSInstancesCount = old.GSInstancesCount = 256;
- ctx->PSGetShader(&old.PS, old.PSInstances, &old.PSInstancesCount);
- ctx->VSGetShader(&old.VS, old.VSInstances, &old.VSInstancesCount);
- ctx->VSGetConstantBuffers(0, 1, &old.VSConstantBuffer);
- ctx->GSGetShader(&old.GS, old.GSInstances, &old.GSInstancesCount);
-
- ctx->IAGetPrimitiveTopology(&old.PrimitiveTopology);
- ctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);
- ctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);
- ctx->IAGetInputLayout(&old.InputLayout);
-
- // Setup desired DX state
- ImGui_ImplDX11_SetupRenderState(draw_data, ctx);
-
- // Render command lists
- // (Because we merged all buffers into a single one, we maintain our own offset into them)
- int global_idx_offset = 0;
- int global_vtx_offset = 0;
- ImVec2 clip_off = draw_data->DisplayPos;
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback != NULL)
- {
- // User callback, registered via ImDrawList::AddCallback()
- // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
- if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
- ImGui_ImplDX11_SetupRenderState(draw_data, ctx);
- else
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- // Apply scissor/clipping rectangle
- const D3D11_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
- ctx->RSSetScissorRects(1, &r);
-
- // Bind texture, Draw
- ID3D11ShaderResourceView* texture_srv = (ID3D11ShaderResourceView*)pcmd->TextureId;
- ctx->PSSetShaderResources(0, 1, &texture_srv);
- ctx->DrawIndexed(pcmd->ElemCount, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset);
- }
- }
- global_idx_offset += cmd_list->IdxBuffer.Size;
- global_vtx_offset += cmd_list->VtxBuffer.Size;
- }
-
- // Restore modified DX state
- ctx->RSSetScissorRects(old.ScissorRectsCount, old.ScissorRects);
- ctx->RSSetViewports(old.ViewportsCount, old.Viewports);
- ctx->RSSetState(old.RS); if (old.RS) old.RS->Release();
- ctx->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();
- ctx->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef); if (old.DepthStencilState) old.DepthStencilState->Release();
- ctx->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();
- ctx->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();
- ctx->PSSetShader(old.PS, old.PSInstances, old.PSInstancesCount); if (old.PS) old.PS->Release();
- for (UINT i = 0; i < old.PSInstancesCount; i++) if (old.PSInstances[i]) old.PSInstances[i]->Release();
- ctx->VSSetShader(old.VS, old.VSInstances, old.VSInstancesCount); if (old.VS) old.VS->Release();
- ctx->VSSetConstantBuffers(0, 1, &old.VSConstantBuffer); if (old.VSConstantBuffer) old.VSConstantBuffer->Release();
- ctx->GSSetShader(old.GS, old.GSInstances, old.GSInstancesCount); if (old.GS) old.GS->Release();
- for (UINT i = 0; i < old.VSInstancesCount; i++) if (old.VSInstances[i]) old.VSInstances[i]->Release();
- ctx->IASetPrimitiveTopology(old.PrimitiveTopology);
- ctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();
- ctx->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();
- ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
-}
-
-static void ImGui_ImplDX11_CreateFontsTexture()
-{
- // Build texture atlas
- ImGuiIO& io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
-
- // Upload texture to graphics system
- {
- D3D11_TEXTURE2D_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.Width = width;
- desc.Height = height;
- desc.MipLevels = 1;
- desc.ArraySize = 1;
- desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- desc.SampleDesc.Count = 1;
- desc.Usage = D3D11_USAGE_DEFAULT;
- desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
- desc.CPUAccessFlags = 0;
-
- ID3D11Texture2D *pTexture = NULL;
- D3D11_SUBRESOURCE_DATA subResource;
- subResource.pSysMem = pixels;
- subResource.SysMemPitch = desc.Width * 4;
- subResource.SysMemSlicePitch = 0;
- g_pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);
-
- // Create texture view
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- ZeroMemory(&srvDesc, sizeof(srvDesc));
- srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MipLevels = desc.MipLevels;
- srvDesc.Texture2D.MostDetailedMip = 0;
- g_pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &g_pFontTextureView);
- pTexture->Release();
- }
-
- // Store our identifier
- io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
-
- // Create texture sampler
- {
- D3D11_SAMPLER_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
- desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
- desc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
- desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
- desc.MipLODBias = 0.f;
- desc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
- desc.MinLOD = 0.f;
- desc.MaxLOD = 0.f;
- g_pd3dDevice->CreateSamplerState(&desc, &g_pFontSampler);
- }
-}
-
-bool ImGui_ImplDX11_CreateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return false;
- if (g_pFontSampler)
- ImGui_ImplDX11_InvalidateDeviceObjects();
-
- // By using D3DCompile() from / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
- // If you would like to use this DX11 sample code but remove this dependency you can:
- // 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]
- // 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
- // See https://github.com/ocornut/imgui/pull/638 for sources and details.
-
- // Create the vertex shader
- {
- static const char* vertexShader =
- "cbuffer vertexBuffer : register(b0) \
- {\
- float4x4 ProjectionMatrix; \
- };\
- struct VS_INPUT\
- {\
- float2 pos : POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- \
- struct PS_INPUT\
- {\
- float4 pos : SV_POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- \
- PS_INPUT main(VS_INPUT input)\
- {\
- PS_INPUT output;\
- output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
- output.col = input.col;\
- output.uv = input.uv;\
- return output;\
- }";
-
- ID3DBlob* vertexShaderBlob;
- if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), NULL, NULL, NULL, "main", "vs_4_0", 0, 0, &vertexShaderBlob, NULL)))
- return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
- if (g_pd3dDevice->CreateVertexShader(vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), NULL, &g_pVertexShader) != S_OK)
- {
- vertexShaderBlob->Release();
- return false;
- }
-
- // Create the input layout
- D3D11_INPUT_ELEMENT_DESC local_layout[] =
- {
- { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
- { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
- { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
- };
- if (g_pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK)
- {
- vertexShaderBlob->Release();
- return false;
- }
- vertexShaderBlob->Release();
-
- // Create the constant buffer
- {
- D3D11_BUFFER_DESC desc;
- desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER);
- desc.Usage = D3D11_USAGE_DYNAMIC;
- desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
- desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- desc.MiscFlags = 0;
- g_pd3dDevice->CreateBuffer(&desc, NULL, &g_pVertexConstantBuffer);
- }
- }
-
- // Create the pixel shader
- {
- static const char* pixelShader =
- "struct PS_INPUT\
- {\
- float4 pos : SV_POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- sampler sampler0;\
- Texture2D texture0;\
- \
- float4 main(PS_INPUT input) : SV_Target\
- {\
- float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \
- return out_col; \
- }";
-
- ID3DBlob* pixelShaderBlob;
- if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), NULL, NULL, NULL, "main", "ps_4_0", 0, 0, &pixelShaderBlob, NULL)))
- return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
- if (g_pd3dDevice->CreatePixelShader(pixelShaderBlob->GetBufferPointer(), pixelShaderBlob->GetBufferSize(), NULL, &g_pPixelShader) != S_OK)
- {
- pixelShaderBlob->Release();
- return false;
- }
- pixelShaderBlob->Release();
- }
-
- // Create the blending setup
- {
- D3D11_BLEND_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.AlphaToCoverageEnable = false;
- desc.RenderTarget[0].BlendEnable = true;
- desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
- desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
- desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
- desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
- desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
- desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
- desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
- g_pd3dDevice->CreateBlendState(&desc, &g_pBlendState);
- }
-
- // Create the rasterizer state
- {
- D3D11_RASTERIZER_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.FillMode = D3D11_FILL_SOLID;
- desc.CullMode = D3D11_CULL_NONE;
- desc.ScissorEnable = true;
- desc.DepthClipEnable = true;
- g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
- }
-
- // Create depth-stencil State
- {
- D3D11_DEPTH_STENCIL_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.DepthEnable = false;
- desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
- desc.DepthFunc = D3D11_COMPARISON_ALWAYS;
- desc.StencilEnable = false;
- desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
- desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
- desc.BackFace = desc.FrontFace;
- g_pd3dDevice->CreateDepthStencilState(&desc, &g_pDepthStencilState);
- }
-
- ImGui_ImplDX11_CreateFontsTexture();
-
- return true;
-}
-
-void ImGui_ImplDX11_InvalidateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return;
-
- if (g_pFontSampler) { g_pFontSampler->Release(); g_pFontSampler = NULL; }
- if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
- if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
- if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
-
- if (g_pBlendState) { g_pBlendState->Release(); g_pBlendState = NULL; }
- if (g_pDepthStencilState) { g_pDepthStencilState->Release(); g_pDepthStencilState = NULL; }
- if (g_pRasterizerState) { g_pRasterizerState->Release(); g_pRasterizerState = NULL; }
- if (g_pPixelShader) { g_pPixelShader->Release(); g_pPixelShader = NULL; }
- if (g_pVertexConstantBuffer) { g_pVertexConstantBuffer->Release(); g_pVertexConstantBuffer = NULL; }
- if (g_pInputLayout) { g_pInputLayout->Release(); g_pInputLayout = NULL; }
- if (g_pVertexShader) { g_pVertexShader->Release(); g_pVertexShader = NULL; }
-}
-
-bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context)
-{
- // Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
- io.BackendRendererName = "imgui_impl_dx11";
- io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
-
- // Get factory from device
- IDXGIDevice* pDXGIDevice = NULL;
- IDXGIAdapter* pDXGIAdapter = NULL;
- IDXGIFactory* pFactory = NULL;
-
- if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) == S_OK)
- if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) == S_OK)
- if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) == S_OK)
- {
- g_pd3dDevice = device;
- g_pd3dDeviceContext = device_context;
- g_pFactory = pFactory;
- }
- if (pDXGIDevice) pDXGIDevice->Release();
- if (pDXGIAdapter) pDXGIAdapter->Release();
- g_pd3dDevice->AddRef();
- g_pd3dDeviceContext->AddRef();
-
- return true;
-}
-
-void ImGui_ImplDX11_Shutdown()
-{
- ImGui_ImplDX11_InvalidateDeviceObjects();
- if (g_pFactory) { g_pFactory->Release(); g_pFactory = NULL; }
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
- if (g_pd3dDeviceContext) { g_pd3dDeviceContext->Release(); g_pd3dDeviceContext = NULL; }
-}
-
-void ImGui_ImplDX11_NewFrame()
-{
- if (!g_pFontSampler)
- ImGui_ImplDX11_CreateDeviceObjects();
-}
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
deleted file mode 100644
index cccadcd2c700..000000000000
--- a/examples/imgui_impl_dx11.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// dear imgui: Renderer for DirectX11
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-struct ID3D11Device;
-struct ID3D11DeviceContext;
-
-IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context);
-IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame();
-IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data);
-
-// Use if you want to reset your rendering device without losing Dear ImGui state.
-IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects();
-IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects();
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
deleted file mode 100644
index 167a189b09c5..000000000000
--- a/examples/imgui_impl_dx12.cpp
+++ /dev/null
@@ -1,665 +0,0 @@
-// dear imgui: Renderer for DirectX12
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-// Issues:
-// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-10-18: DirectX12: *BREAKING CHANGE* Added extra ID3D12DescriptorHeap parameter to ImGui_ImplDX12_Init() function.
-// 2019-05-29: DirectX12: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
-// 2019-04-30: DirectX12: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2019-03-29: Misc: Various minor tidying up.
-// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
-// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
-// 2018-06-12: DirectX12: Moved the ID3D12GraphicsCommandList* parameter from NewFrame() to RenderDrawData().
-// 2018-06-08: Misc: Extracted imgui_impl_dx12.cpp/.h away from the old combined DX12+Win32 example.
-// 2018-06-08: DirectX12: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle (to ease support for future multi-viewport).
-// 2018-02-22: Merged into master with all Win32 code synchronized to other examples.
-
-#include "imgui.h"
-#include "imgui_impl_dx12.h"
-
-// DirectX
-#include
-#include
-#include
-#ifdef _MSC_VER
-#pragma comment(lib, "d3dcompiler") // Automatically link with d3dcompiler.lib as we are using D3DCompile() below.
-#endif
-
-// DirectX data
-static ID3D12Device* g_pd3dDevice = NULL;
-static ID3D12RootSignature* g_pRootSignature = NULL;
-static ID3D12PipelineState* g_pPipelineState = NULL;
-static DXGI_FORMAT g_RTVFormat = DXGI_FORMAT_UNKNOWN;
-static ID3D12Resource* g_pFontTextureResource = NULL;
-static D3D12_CPU_DESCRIPTOR_HANDLE g_hFontSrvCpuDescHandle = {};
-static D3D12_GPU_DESCRIPTOR_HANDLE g_hFontSrvGpuDescHandle = {};
-
-struct FrameResources
-{
- ID3D12Resource* IndexBuffer;
- ID3D12Resource* VertexBuffer;
- int IndexBufferSize;
- int VertexBufferSize;
-};
-static FrameResources* g_pFrameResources = NULL;
-static UINT g_numFramesInFlight = 0;
-static UINT g_frameIndex = UINT_MAX;
-
-template
-static void SafeRelease(T*& res)
-{
- if (res)
- res->Release();
- res = NULL;
-}
-
-struct VERTEX_CONSTANT_BUFFER
-{
- float mvp[4][4];
-};
-
-static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12GraphicsCommandList* ctx, FrameResources* fr)
-{
- // Setup orthographic projection matrix into our constant buffer
- // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right).
- VERTEX_CONSTANT_BUFFER vertex_constant_buffer;
- {
- float L = draw_data->DisplayPos.x;
- float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
- float T = draw_data->DisplayPos.y;
- float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
- float mvp[4][4] =
- {
- { 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
- { 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
- { 0.0f, 0.0f, 0.5f, 0.0f },
- { (R+L)/(L-R), (T+B)/(B-T), 0.5f, 1.0f },
- };
- memcpy(&vertex_constant_buffer.mvp, mvp, sizeof(mvp));
- }
-
- // Setup viewport
- D3D12_VIEWPORT vp;
- memset(&vp, 0, sizeof(D3D12_VIEWPORT));
- vp.Width = draw_data->DisplaySize.x;
- vp.Height = draw_data->DisplaySize.y;
- vp.MinDepth = 0.0f;
- vp.MaxDepth = 1.0f;
- vp.TopLeftX = vp.TopLeftY = 0.0f;
- ctx->RSSetViewports(1, &vp);
-
- // Bind shader and vertex buffers
- unsigned int stride = sizeof(ImDrawVert);
- unsigned int offset = 0;
- D3D12_VERTEX_BUFFER_VIEW vbv;
- memset(&vbv, 0, sizeof(D3D12_VERTEX_BUFFER_VIEW));
- vbv.BufferLocation = fr->VertexBuffer->GetGPUVirtualAddress() + offset;
- vbv.SizeInBytes = fr->VertexBufferSize * stride;
- vbv.StrideInBytes = stride;
- ctx->IASetVertexBuffers(0, 1, &vbv);
- D3D12_INDEX_BUFFER_VIEW ibv;
- memset(&ibv, 0, sizeof(D3D12_INDEX_BUFFER_VIEW));
- ibv.BufferLocation = fr->IndexBuffer->GetGPUVirtualAddress();
- ibv.SizeInBytes = fr->IndexBufferSize * sizeof(ImDrawIdx);
- ibv.Format = sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT;
- ctx->IASetIndexBuffer(&ibv);
- ctx->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
- ctx->SetPipelineState(g_pPipelineState);
- ctx->SetGraphicsRootSignature(g_pRootSignature);
- ctx->SetGraphicsRoot32BitConstants(0, 16, &vertex_constant_buffer, 0);
-
- // Setup blend factor
- const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
- ctx->OMSetBlendFactor(blend_factor);
-}
-
-// Render function
-// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
-void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* ctx)
-{
- // Avoid rendering when minimized
- if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
- return;
-
- // FIXME: I'm assuming that this only gets called once per frame!
- // If not, we can't just re-allocate the IB or VB, we'll have to do a proper allocator.
- g_frameIndex = g_frameIndex + 1;
- FrameResources* fr = &g_pFrameResources[g_frameIndex % g_numFramesInFlight];
-
- // Create and grow vertex/index buffers if needed
- if (fr->VertexBuffer == NULL || fr->VertexBufferSize < draw_data->TotalVtxCount)
- {
- SafeRelease(fr->VertexBuffer);
- fr->VertexBufferSize = draw_data->TotalVtxCount + 5000;
- D3D12_HEAP_PROPERTIES props;
- memset(&props, 0, sizeof(D3D12_HEAP_PROPERTIES));
- props.Type = D3D12_HEAP_TYPE_UPLOAD;
- props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
- props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
- D3D12_RESOURCE_DESC desc;
- memset(&desc, 0, sizeof(D3D12_RESOURCE_DESC));
- desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- desc.Width = fr->VertexBufferSize * sizeof(ImDrawVert);
- desc.Height = 1;
- desc.DepthOrArraySize = 1;
- desc.MipLevels = 1;
- desc.Format = DXGI_FORMAT_UNKNOWN;
- desc.SampleDesc.Count = 1;
- desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
- desc.Flags = D3D12_RESOURCE_FLAG_NONE;
- if (g_pd3dDevice->CreateCommittedResource(&props, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL, IID_PPV_ARGS(&fr->VertexBuffer)) < 0)
- return;
- }
- if (fr->IndexBuffer == NULL || fr->IndexBufferSize < draw_data->TotalIdxCount)
- {
- SafeRelease(fr->IndexBuffer);
- fr->IndexBufferSize = draw_data->TotalIdxCount + 10000;
- D3D12_HEAP_PROPERTIES props;
- memset(&props, 0, sizeof(D3D12_HEAP_PROPERTIES));
- props.Type = D3D12_HEAP_TYPE_UPLOAD;
- props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
- props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
- D3D12_RESOURCE_DESC desc;
- memset(&desc, 0, sizeof(D3D12_RESOURCE_DESC));
- desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- desc.Width = fr->IndexBufferSize * sizeof(ImDrawIdx);
- desc.Height = 1;
- desc.DepthOrArraySize = 1;
- desc.MipLevels = 1;
- desc.Format = DXGI_FORMAT_UNKNOWN;
- desc.SampleDesc.Count = 1;
- desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
- desc.Flags = D3D12_RESOURCE_FLAG_NONE;
- if (g_pd3dDevice->CreateCommittedResource(&props, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL, IID_PPV_ARGS(&fr->IndexBuffer)) < 0)
- return;
- }
-
- // Upload vertex/index data into a single contiguous GPU buffer
- void* vtx_resource, *idx_resource;
- D3D12_RANGE range;
- memset(&range, 0, sizeof(D3D12_RANGE));
- if (fr->VertexBuffer->Map(0, &range, &vtx_resource) != S_OK)
- return;
- if (fr->IndexBuffer->Map(0, &range, &idx_resource) != S_OK)
- return;
- ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource;
- ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource;
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
- memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
- vtx_dst += cmd_list->VtxBuffer.Size;
- idx_dst += cmd_list->IdxBuffer.Size;
- }
- fr->VertexBuffer->Unmap(0, &range);
- fr->IndexBuffer->Unmap(0, &range);
-
- // Setup desired DX state
- ImGui_ImplDX12_SetupRenderState(draw_data, ctx, fr);
-
- // Render command lists
- // (Because we merged all buffers into a single one, we maintain our own offset into them)
- int global_vtx_offset = 0;
- int global_idx_offset = 0;
- ImVec2 clip_off = draw_data->DisplayPos;
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback != NULL)
- {
- // User callback, registered via ImDrawList::AddCallback()
- // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
- if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
- ImGui_ImplDX12_SetupRenderState(draw_data, ctx, fr);
- else
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- // Apply Scissor, Bind texture, Draw
- const D3D12_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
- ctx->SetGraphicsRootDescriptorTable(1, *(D3D12_GPU_DESCRIPTOR_HANDLE*)&pcmd->TextureId);
- ctx->RSSetScissorRects(1, &r);
- ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
- }
- }
- global_idx_offset += cmd_list->IdxBuffer.Size;
- global_vtx_offset += cmd_list->VtxBuffer.Size;
- }
-}
-
-static void ImGui_ImplDX12_CreateFontsTexture()
-{
- // Build texture atlas
- ImGuiIO& io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
-
- // Upload texture to graphics system
- {
- D3D12_HEAP_PROPERTIES props;
- memset(&props, 0, sizeof(D3D12_HEAP_PROPERTIES));
- props.Type = D3D12_HEAP_TYPE_DEFAULT;
- props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
- props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
-
- D3D12_RESOURCE_DESC desc;
- ZeroMemory(&desc, sizeof(desc));
- desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
- desc.Alignment = 0;
- desc.Width = width;
- desc.Height = height;
- desc.DepthOrArraySize = 1;
- desc.MipLevels = 1;
- desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- desc.SampleDesc.Count = 1;
- desc.SampleDesc.Quality = 0;
- desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
- desc.Flags = D3D12_RESOURCE_FLAG_NONE;
-
- ID3D12Resource* pTexture = NULL;
- g_pd3dDevice->CreateCommittedResource(&props, D3D12_HEAP_FLAG_NONE, &desc,
- D3D12_RESOURCE_STATE_COPY_DEST, NULL, IID_PPV_ARGS(&pTexture));
-
- UINT uploadPitch = (width * 4 + D3D12_TEXTURE_DATA_PITCH_ALIGNMENT - 1u) & ~(D3D12_TEXTURE_DATA_PITCH_ALIGNMENT - 1u);
- UINT uploadSize = height * uploadPitch;
- desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- desc.Alignment = 0;
- desc.Width = uploadSize;
- desc.Height = 1;
- desc.DepthOrArraySize = 1;
- desc.MipLevels = 1;
- desc.Format = DXGI_FORMAT_UNKNOWN;
- desc.SampleDesc.Count = 1;
- desc.SampleDesc.Quality = 0;
- desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
- desc.Flags = D3D12_RESOURCE_FLAG_NONE;
-
- props.Type = D3D12_HEAP_TYPE_UPLOAD;
- props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
- props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
-
- ID3D12Resource* uploadBuffer = NULL;
- HRESULT hr = g_pd3dDevice->CreateCommittedResource(&props, D3D12_HEAP_FLAG_NONE, &desc,
- D3D12_RESOURCE_STATE_GENERIC_READ, NULL, IID_PPV_ARGS(&uploadBuffer));
- IM_ASSERT(SUCCEEDED(hr));
-
- void* mapped = NULL;
- D3D12_RANGE range = { 0, uploadSize };
- hr = uploadBuffer->Map(0, &range, &mapped);
- IM_ASSERT(SUCCEEDED(hr));
- for (int y = 0; y < height; y++)
- memcpy((void*) ((uintptr_t) mapped + y * uploadPitch), pixels + y * width * 4, width * 4);
- uploadBuffer->Unmap(0, &range);
-
- D3D12_TEXTURE_COPY_LOCATION srcLocation = {};
- srcLocation.pResource = uploadBuffer;
- srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
- srcLocation.PlacedFootprint.Footprint.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- srcLocation.PlacedFootprint.Footprint.Width = width;
- srcLocation.PlacedFootprint.Footprint.Height = height;
- srcLocation.PlacedFootprint.Footprint.Depth = 1;
- srcLocation.PlacedFootprint.Footprint.RowPitch = uploadPitch;
-
- D3D12_TEXTURE_COPY_LOCATION dstLocation = {};
- dstLocation.pResource = pTexture;
- dstLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
- dstLocation.SubresourceIndex = 0;
-
- D3D12_RESOURCE_BARRIER barrier = {};
- barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
- barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
- barrier.Transition.pResource = pTexture;
- barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
- barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_DEST;
- barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
-
- ID3D12Fence* fence = NULL;
- hr = g_pd3dDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence));
- IM_ASSERT(SUCCEEDED(hr));
-
- HANDLE event = CreateEvent(0, 0, 0, 0);
- IM_ASSERT(event != NULL);
-
- D3D12_COMMAND_QUEUE_DESC queueDesc = {};
- queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
- queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
- queueDesc.NodeMask = 1;
-
- ID3D12CommandQueue* cmdQueue = NULL;
- hr = g_pd3dDevice->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&cmdQueue));
- IM_ASSERT(SUCCEEDED(hr));
-
- ID3D12CommandAllocator* cmdAlloc = NULL;
- hr = g_pd3dDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&cmdAlloc));
- IM_ASSERT(SUCCEEDED(hr));
-
- ID3D12GraphicsCommandList* cmdList = NULL;
- hr = g_pd3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, cmdAlloc, NULL, IID_PPV_ARGS(&cmdList));
- IM_ASSERT(SUCCEEDED(hr));
-
- cmdList->CopyTextureRegion(&dstLocation, 0, 0, 0, &srcLocation, NULL);
- cmdList->ResourceBarrier(1, &barrier);
-
- hr = cmdList->Close();
- IM_ASSERT(SUCCEEDED(hr));
-
- cmdQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*) &cmdList);
- hr = cmdQueue->Signal(fence, 1);
- IM_ASSERT(SUCCEEDED(hr));
-
- fence->SetEventOnCompletion(1, event);
- WaitForSingleObject(event, INFINITE);
-
- cmdList->Release();
- cmdAlloc->Release();
- cmdQueue->Release();
- CloseHandle(event);
- fence->Release();
- uploadBuffer->Release();
-
- // Create texture view
- D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc;
- ZeroMemory(&srvDesc, sizeof(srvDesc));
- srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MipLevels = desc.MipLevels;
- srvDesc.Texture2D.MostDetailedMip = 0;
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
- g_pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, g_hFontSrvCpuDescHandle);
- SafeRelease(g_pFontTextureResource);
- g_pFontTextureResource = pTexture;
- }
-
- // Store our identifier
- static_assert(sizeof(ImTextureID) >= sizeof(g_hFontSrvGpuDescHandle.ptr), "Can't pack descriptor handle into TexID, 32-bit not supported yet.");
- io.Fonts->TexID = (ImTextureID)g_hFontSrvGpuDescHandle.ptr;
-}
-
-bool ImGui_ImplDX12_CreateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return false;
- if (g_pPipelineState)
- ImGui_ImplDX12_InvalidateDeviceObjects();
-
- // Create the root signature
- {
- D3D12_DESCRIPTOR_RANGE descRange = {};
- descRange.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
- descRange.NumDescriptors = 1;
- descRange.BaseShaderRegister = 0;
- descRange.RegisterSpace = 0;
- descRange.OffsetInDescriptorsFromTableStart = 0;
-
- D3D12_ROOT_PARAMETER param[2] = {};
-
- param[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
- param[0].Constants.ShaderRegister = 0;
- param[0].Constants.RegisterSpace = 0;
- param[0].Constants.Num32BitValues = 16;
- param[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX;
-
- param[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- param[1].DescriptorTable.NumDescriptorRanges = 1;
- param[1].DescriptorTable.pDescriptorRanges = &descRange;
- param[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
-
- D3D12_STATIC_SAMPLER_DESC staticSampler = {};
- staticSampler.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
- staticSampler.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
- staticSampler.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
- staticSampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
- staticSampler.MipLODBias = 0.f;
- staticSampler.MaxAnisotropy = 0;
- staticSampler.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
- staticSampler.BorderColor = D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK;
- staticSampler.MinLOD = 0.f;
- staticSampler.MaxLOD = 0.f;
- staticSampler.ShaderRegister = 0;
- staticSampler.RegisterSpace = 0;
- staticSampler.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
-
- D3D12_ROOT_SIGNATURE_DESC desc = {};
- desc.NumParameters = _countof(param);
- desc.pParameters = param;
- desc.NumStaticSamplers = 1;
- desc.pStaticSamplers = &staticSampler;
- desc.Flags =
- D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |
- D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS |
- D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS |
- D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS;
-
- ID3DBlob* blob = NULL;
- if (D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, NULL) != S_OK)
- return false;
-
- g_pd3dDevice->CreateRootSignature(0, blob->GetBufferPointer(), blob->GetBufferSize(), IID_PPV_ARGS(&g_pRootSignature));
- blob->Release();
- }
-
- // By using D3DCompile() from / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
- // If you would like to use this DX12 sample code but remove this dependency you can:
- // 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]
- // 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
- // See https://github.com/ocornut/imgui/pull/638 for sources and details.
-
- D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc;
- memset(&psoDesc, 0, sizeof(D3D12_GRAPHICS_PIPELINE_STATE_DESC));
- psoDesc.NodeMask = 1;
- psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
- psoDesc.pRootSignature = g_pRootSignature;
- psoDesc.SampleMask = UINT_MAX;
- psoDesc.NumRenderTargets = 1;
- psoDesc.RTVFormats[0] = g_RTVFormat;
- psoDesc.SampleDesc.Count = 1;
- psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
-
- ID3DBlob* vertexShaderBlob;
- ID3DBlob* pixelShaderBlob;
-
- // Create the vertex shader
- {
- static const char* vertexShader =
- "cbuffer vertexBuffer : register(b0) \
- {\
- float4x4 ProjectionMatrix; \
- };\
- struct VS_INPUT\
- {\
- float2 pos : POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- \
- struct PS_INPUT\
- {\
- float4 pos : SV_POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- \
- PS_INPUT main(VS_INPUT input)\
- {\
- PS_INPUT output;\
- output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
- output.col = input.col;\
- output.uv = input.uv;\
- return output;\
- }";
-
- if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), NULL, NULL, NULL, "main", "vs_5_0", 0, 0, &vertexShaderBlob, NULL)))
- return false; // NB: Pass ID3D10Blob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
- psoDesc.VS = { vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize() };
-
- // Create the input layout
- static D3D12_INPUT_ELEMENT_DESC local_layout[] = {
- { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
- { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, uv), D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
- { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
- };
- psoDesc.InputLayout = { local_layout, 3 };
- }
-
- // Create the pixel shader
- {
- static const char* pixelShader =
- "struct PS_INPUT\
- {\
- float4 pos : SV_POSITION;\
- float4 col : COLOR0;\
- float2 uv : TEXCOORD0;\
- };\
- SamplerState sampler0 : register(s0);\
- Texture2D texture0 : register(t0);\
- \
- float4 main(PS_INPUT input) : SV_Target\
- {\
- float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \
- return out_col; \
- }";
-
- if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), NULL, NULL, NULL, "main", "ps_5_0", 0, 0, &pixelShaderBlob, NULL)))
- {
- vertexShaderBlob->Release();
- return false; // NB: Pass ID3D10Blob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
- }
- psoDesc.PS = { pixelShaderBlob->GetBufferPointer(), pixelShaderBlob->GetBufferSize() };
- }
-
- // Create the blending setup
- {
- D3D12_BLEND_DESC& desc = psoDesc.BlendState;
- desc.AlphaToCoverageEnable = false;
- desc.RenderTarget[0].BlendEnable = true;
- desc.RenderTarget[0].SrcBlend = D3D12_BLEND_SRC_ALPHA;
- desc.RenderTarget[0].DestBlend = D3D12_BLEND_INV_SRC_ALPHA;
- desc.RenderTarget[0].BlendOp = D3D12_BLEND_OP_ADD;
- desc.RenderTarget[0].SrcBlendAlpha = D3D12_BLEND_INV_SRC_ALPHA;
- desc.RenderTarget[0].DestBlendAlpha = D3D12_BLEND_ZERO;
- desc.RenderTarget[0].BlendOpAlpha = D3D12_BLEND_OP_ADD;
- desc.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
- }
-
- // Create the rasterizer state
- {
- D3D12_RASTERIZER_DESC& desc = psoDesc.RasterizerState;
- desc.FillMode = D3D12_FILL_MODE_SOLID;
- desc.CullMode = D3D12_CULL_MODE_NONE;
- desc.FrontCounterClockwise = FALSE;
- desc.DepthBias = D3D12_DEFAULT_DEPTH_BIAS;
- desc.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP;
- desc.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
- desc.DepthClipEnable = true;
- desc.MultisampleEnable = FALSE;
- desc.AntialiasedLineEnable = FALSE;
- desc.ForcedSampleCount = 0;
- desc.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF;
- }
-
- // Create depth-stencil State
- {
- D3D12_DEPTH_STENCIL_DESC& desc = psoDesc.DepthStencilState;
- desc.DepthEnable = false;
- desc.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
- desc.DepthFunc = D3D12_COMPARISON_FUNC_ALWAYS;
- desc.StencilEnable = false;
- desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D12_STENCIL_OP_KEEP;
- desc.FrontFace.StencilFunc = D3D12_COMPARISON_FUNC_ALWAYS;
- desc.BackFace = desc.FrontFace;
- }
-
- HRESULT result_pipeline_state = g_pd3dDevice->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&g_pPipelineState));
- vertexShaderBlob->Release();
- pixelShaderBlob->Release();
- if (result_pipeline_state != S_OK)
- return false;
-
- ImGui_ImplDX12_CreateFontsTexture();
-
- return true;
-}
-
-void ImGui_ImplDX12_InvalidateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return;
-
- SafeRelease(g_pRootSignature);
- SafeRelease(g_pPipelineState);
- SafeRelease(g_pFontTextureResource);
-
- ImGuiIO& io = ImGui::GetIO();
- io.Fonts->TexID = NULL; // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
-
- for (UINT i = 0; i < g_numFramesInFlight; i++)
- {
- FrameResources* fr = &g_pFrameResources[i];
- SafeRelease(fr->IndexBuffer);
- SafeRelease(fr->VertexBuffer);
- }
-}
-
-bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* cbv_srv_heap,
- D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle)
-{
- // Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
- io.BackendRendererName = "imgui_impl_dx12";
- io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
-
- g_pd3dDevice = device;
- g_RTVFormat = rtv_format;
- g_hFontSrvCpuDescHandle = font_srv_cpu_desc_handle;
- g_hFontSrvGpuDescHandle = font_srv_gpu_desc_handle;
- g_pFrameResources = new FrameResources[num_frames_in_flight];
- g_numFramesInFlight = num_frames_in_flight;
- g_frameIndex = UINT_MAX;
- IM_UNUSED(cbv_srv_heap); // Unused in master branch (will be used by multi-viewports)
-
- // Create buffers with a default size (they will later be grown as needed)
- for (int i = 0; i < num_frames_in_flight; i++)
- {
- FrameResources* fr = &g_pFrameResources[i];
- fr->IndexBuffer = NULL;
- fr->VertexBuffer = NULL;
- fr->IndexBufferSize = 10000;
- fr->VertexBufferSize = 5000;
- }
-
- return true;
-}
-
-void ImGui_ImplDX12_Shutdown()
-{
- ImGui_ImplDX12_InvalidateDeviceObjects();
- delete[] g_pFrameResources;
- g_pFrameResources = NULL;
- g_pd3dDevice = NULL;
- g_hFontSrvCpuDescHandle.ptr = 0;
- g_hFontSrvGpuDescHandle.ptr = 0;
- g_numFramesInFlight = 0;
- g_frameIndex = UINT_MAX;
-}
-
-void ImGui_ImplDX12_NewFrame()
-{
- if (!g_pPipelineState)
- ImGui_ImplDX12_CreateDeviceObjects();
-}
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
deleted file mode 100644
index 52dab0ba3acb..000000000000
--- a/examples/imgui_impl_dx12.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// dear imgui: Renderer for DirectX12
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-// Issues:
-// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-enum DXGI_FORMAT;
-struct ID3D12Device;
-struct ID3D12DescriptorHeap;
-struct ID3D12GraphicsCommandList;
-struct D3D12_CPU_DESCRIPTOR_HANDLE;
-struct D3D12_GPU_DESCRIPTOR_HANDLE;
-
-// cmd_list is the command list that the implementation will use to render imgui draw lists.
-// Before calling the render function, caller must prepare cmd_list by resetting it and setting the appropriate
-// render target and descriptor heap that contains font_srv_cpu_desc_handle/font_srv_gpu_desc_handle.
-// font_srv_cpu_desc_handle and font_srv_gpu_desc_handle are handles to a single SRV descriptor to use for the internal font texture.
-IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* cbv_srv_heap,
- D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle);
-IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame();
-IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list);
-
-// Use if you want to reset your rendering device without losing Dear ImGui state.
-IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects();
-IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects();
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
deleted file mode 100644
index 03114aa82fa9..000000000000
--- a/examples/imgui_impl_dx9.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-// dear imgui: Renderer for DirectX9
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-05-29: DirectX9: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
-// 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects().
-// 2019-01-16: Misc: Disabled fog before drawing UI's. Fixes issue #2288.
-// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
-// 2018-06-08: Misc: Extracted imgui_impl_dx9.cpp/.h away from the old combined DX9+Win32 example.
-// 2018-06-08: DirectX9: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
-// 2018-05-07: Render: Saving/restoring Transform because they don't seem to be included in the StateBlock. Setting shading mode to Gouraud.
-// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX9_RenderDrawData() in the .h file so you can call it yourself.
-// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
-
-#include "imgui.h"
-#include "imgui_impl_dx9.h"
-
-// DirectX
-#include
-#define DIRECTINPUT_VERSION 0x0800
-#include
-
-// DirectX data
-static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
-static LPDIRECT3DVERTEXBUFFER9 g_pVB = NULL;
-static LPDIRECT3DINDEXBUFFER9 g_pIB = NULL;
-static LPDIRECT3DTEXTURE9 g_FontTexture = NULL;
-static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
-
-struct CUSTOMVERTEX
-{
- float pos[3];
- D3DCOLOR col;
- float uv[2];
-};
-#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1)
-
-static void ImGui_ImplDX9_SetupRenderState(ImDrawData* draw_data)
-{
- // Setup viewport
- D3DVIEWPORT9 vp;
- vp.X = vp.Y = 0;
- vp.Width = (DWORD)draw_data->DisplaySize.x;
- vp.Height = (DWORD)draw_data->DisplaySize.y;
- vp.MinZ = 0.0f;
- vp.MaxZ = 1.0f;
- g_pd3dDevice->SetViewport(&vp);
-
- // Setup render state: fixed-pipeline, alpha-blending, no face culling, no depth testing, shade mode (for gradient)
- g_pd3dDevice->SetPixelShader(NULL);
- g_pd3dDevice->SetVertexShader(NULL);
- g_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- g_pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
- g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
- g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
- g_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
- g_pd3dDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
- g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
- g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
- g_pd3dDevice->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
- g_pd3dDevice->SetRenderState(D3DRS_FOGENABLE, FALSE);
- g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
- g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- g_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
- g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
- g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- g_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
- g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
- g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
-
- // Setup orthographic projection matrix
- // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
- // Being agnostic of whether or can be used, we aren't relying on D3DXMatrixIdentity()/D3DXMatrixOrthoOffCenterLH() or DirectX::XMMatrixIdentity()/DirectX::XMMatrixOrthographicOffCenterLH()
- {
- float L = draw_data->DisplayPos.x + 0.5f;
- float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x + 0.5f;
- float T = draw_data->DisplayPos.y + 0.5f;
- float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y + 0.5f;
- D3DMATRIX mat_identity = { { { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } } };
- D3DMATRIX mat_projection =
- { { {
- 2.0f/(R-L), 0.0f, 0.0f, 0.0f,
- 0.0f, 2.0f/(T-B), 0.0f, 0.0f,
- 0.0f, 0.0f, 0.5f, 0.0f,
- (L+R)/(L-R), (T+B)/(B-T), 0.5f, 1.0f
- } } };
- g_pd3dDevice->SetTransform(D3DTS_WORLD, &mat_identity);
- g_pd3dDevice->SetTransform(D3DTS_VIEW, &mat_identity);
- g_pd3dDevice->SetTransform(D3DTS_PROJECTION, &mat_projection);
- }
-}
-
-// Render function.
-// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
-void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
-{
- // Avoid rendering when minimized
- if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
- return;
-
- // Create and grow buffers if needed
- if (!g_pVB || g_VertexBufferSize < draw_data->TotalVtxCount)
- {
- if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
- g_VertexBufferSize = draw_data->TotalVtxCount + 5000;
- if (g_pd3dDevice->CreateVertexBuffer(g_VertexBufferSize * sizeof(CUSTOMVERTEX), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL) < 0)
- return;
- }
- if (!g_pIB || g_IndexBufferSize < draw_data->TotalIdxCount)
- {
- if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
- g_IndexBufferSize = draw_data->TotalIdxCount + 10000;
- if (g_pd3dDevice->CreateIndexBuffer(g_IndexBufferSize * sizeof(ImDrawIdx), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, sizeof(ImDrawIdx) == 2 ? D3DFMT_INDEX16 : D3DFMT_INDEX32, D3DPOOL_DEFAULT, &g_pIB, NULL) < 0)
- return;
- }
-
- // Backup the DX9 state
- IDirect3DStateBlock9* d3d9_state_block = NULL;
- if (g_pd3dDevice->CreateStateBlock(D3DSBT_ALL, &d3d9_state_block) < 0)
- return;
-
- // Backup the DX9 transform (DX9 documentation suggests that it is included in the StateBlock but it doesn't appear to)
- D3DMATRIX last_world, last_view, last_projection;
- g_pd3dDevice->GetTransform(D3DTS_WORLD, &last_world);
- g_pd3dDevice->GetTransform(D3DTS_VIEW, &last_view);
- g_pd3dDevice->GetTransform(D3DTS_PROJECTION, &last_projection);
-
- // Copy and convert all vertices into a single contiguous buffer, convert colors to DX9 default format.
- // FIXME-OPT: This is a waste of resource, the ideal is to use imconfig.h and
- // 1) to avoid repacking colors: #define IMGUI_USE_BGRA_PACKED_COLOR
- // 2) to avoid repacking vertices: #define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; }
- CUSTOMVERTEX* vtx_dst;
- ImDrawIdx* idx_dst;
- if (g_pVB->Lock(0, (UINT)(draw_data->TotalVtxCount * sizeof(CUSTOMVERTEX)), (void**)&vtx_dst, D3DLOCK_DISCARD) < 0)
- return;
- if (g_pIB->Lock(0, (UINT)(draw_data->TotalIdxCount * sizeof(ImDrawIdx)), (void**)&idx_dst, D3DLOCK_DISCARD) < 0)
- return;
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- const ImDrawVert* vtx_src = cmd_list->VtxBuffer.Data;
- for (int i = 0; i < cmd_list->VtxBuffer.Size; i++)
- {
- vtx_dst->pos[0] = vtx_src->pos.x;
- vtx_dst->pos[1] = vtx_src->pos.y;
- vtx_dst->pos[2] = 0.0f;
- vtx_dst->col = (vtx_src->col & 0xFF00FF00) | ((vtx_src->col & 0xFF0000) >> 16) | ((vtx_src->col & 0xFF) << 16); // RGBA --> ARGB for DirectX9
- vtx_dst->uv[0] = vtx_src->uv.x;
- vtx_dst->uv[1] = vtx_src->uv.y;
- vtx_dst++;
- vtx_src++;
- }
- memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
- idx_dst += cmd_list->IdxBuffer.Size;
- }
- g_pVB->Unlock();
- g_pIB->Unlock();
- g_pd3dDevice->SetStreamSource(0, g_pVB, 0, sizeof(CUSTOMVERTEX));
- g_pd3dDevice->SetIndices(g_pIB);
- g_pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX);
-
- // Setup desired DX state
- ImGui_ImplDX9_SetupRenderState(draw_data);
-
- // Render command lists
- // (Because we merged all buffers into a single one, we maintain our own offset into them)
- int global_vtx_offset = 0;
- int global_idx_offset = 0;
- ImVec2 clip_off = draw_data->DisplayPos;
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback != NULL)
- {
- // User callback, registered via ImDrawList::AddCallback()
- // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
- if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
- ImGui_ImplDX9_SetupRenderState(draw_data);
- else
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- const RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
- const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->TextureId;
- g_pd3dDevice->SetTexture(0, texture);
- g_pd3dDevice->SetScissorRect(&r);
- g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, pcmd->VtxOffset + global_vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, pcmd->IdxOffset + global_idx_offset, pcmd->ElemCount/3);
- }
- }
- global_idx_offset += cmd_list->IdxBuffer.Size;
- global_vtx_offset += cmd_list->VtxBuffer.Size;
- }
-
- // Restore the DX9 transform
- g_pd3dDevice->SetTransform(D3DTS_WORLD, &last_world);
- g_pd3dDevice->SetTransform(D3DTS_VIEW, &last_view);
- g_pd3dDevice->SetTransform(D3DTS_PROJECTION, &last_projection);
-
- // Restore the DX9 state
- d3d9_state_block->Apply();
- d3d9_state_block->Release();
-}
-
-bool ImGui_ImplDX9_Init(IDirect3DDevice9* device)
-{
- // Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
- io.BackendRendererName = "imgui_impl_dx9";
- io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
-
- g_pd3dDevice = device;
- g_pd3dDevice->AddRef();
- return true;
-}
-
-void ImGui_ImplDX9_Shutdown()
-{
- ImGui_ImplDX9_InvalidateDeviceObjects();
- if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
-}
-
-static bool ImGui_ImplDX9_CreateFontsTexture()
-{
- // Build texture atlas
- ImGuiIO& io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height, bytes_per_pixel;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height, &bytes_per_pixel);
-
- // Upload texture to graphics system
- g_FontTexture = NULL;
- if (g_pd3dDevice->CreateTexture(width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_FontTexture, NULL) < 0)
- return false;
- D3DLOCKED_RECT tex_locked_rect;
- if (g_FontTexture->LockRect(0, &tex_locked_rect, NULL, 0) != D3D_OK)
- return false;
- for (int y = 0; y < height; y++)
- memcpy((unsigned char *)tex_locked_rect.pBits + tex_locked_rect.Pitch * y, pixels + (width * bytes_per_pixel) * y, (width * bytes_per_pixel));
- g_FontTexture->UnlockRect(0);
-
- // Store our identifier
- io.Fonts->TexID = (ImTextureID)g_FontTexture;
-
- return true;
-}
-
-bool ImGui_ImplDX9_CreateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return false;
- if (!ImGui_ImplDX9_CreateFontsTexture())
- return false;
- return true;
-}
-
-void ImGui_ImplDX9_InvalidateDeviceObjects()
-{
- if (!g_pd3dDevice)
- return;
- if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
- if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
- if (g_FontTexture) { g_FontTexture->Release(); g_FontTexture = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
-}
-
-void ImGui_ImplDX9_NewFrame()
-{
- if (!g_FontTexture)
- ImGui_ImplDX9_CreateDeviceObjects();
-}
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
deleted file mode 100644
index b93c89f7d4b5..000000000000
--- a/examples/imgui_impl_dx9.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// dear imgui: Renderer for DirectX9
-// This needs to be used along with a Platform Binding (e.g. Win32)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-struct IDirect3DDevice9;
-
-IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device);
-IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame();
-IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data);
-
-// Use if you want to reset your rendering device without losing Dear ImGui state.
-IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects();
-IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects();
diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp
deleted file mode 100644
index ef63c81f9744..000000000000
--- a/examples/imgui_impl_glfw.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-// dear imgui: Platform Binding for GLFW
-// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
-// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
-// (Requires: GLFW 3.1+)
-
-// Implemented features:
-// [X] Platform: Clipboard support.
-// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
-// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2020-01-17: Inputs: Disable error callback while assigning mouse cursors because some X11 setup don't have them and it generates errors.
-// 2019-12-05: Inputs: Added support for new mouse cursors added in GLFW 3.4+ (resizing cursors, not allowed cursor).
-// 2019-10-18: Misc: Previously installed user callbacks are now restored on shutdown.
-// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
-// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
-// 2019-03-12: Misc: Preserve DisplayFramebufferScale when main window is minimized.
-// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
-// 2018-11-07: Inputs: When installing our GLFW callbacks, we save user's previously installed ones - if any - and chain call them.
-// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
-// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
-// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
-// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
-// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
-// 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.
-// 2018-01-25: Inputs: Added gamepad support if ImGuiConfigFlags_NavEnableGamepad is set.
-// 2018-01-25: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).
-// 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
-// 2018-01-18: Inputs: Added mapping for ImGuiKey_Insert.
-// 2017-08-25: Inputs: MousePos set to -FLT_MAX,-FLT_MAX when mouse is unavailable/missing (instead of -1,-1).
-// 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
-
-#include "imgui.h"
-#include "imgui_impl_glfw.h"
-
-// GLFW
-#include
-#ifdef _WIN32
-#undef APIENTRY
-#define GLFW_EXPOSE_NATIVE_WIN32
-#include // for glfwGetWin32Window
-#endif
-#define GLFW_HAS_WINDOW_TOPMOST (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ GLFW_FLOATING
-#define GLFW_HAS_WINDOW_HOVERED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ GLFW_HOVERED
-#define GLFW_HAS_WINDOW_ALPHA (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwSetWindowOpacity
-#define GLFW_HAS_PER_MONITOR_DPI (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorContentScale
-#define GLFW_HAS_VULKAN (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwCreateWindowSurface
-#ifdef GLFW_RESIZE_NESW_CURSOR // let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
-#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
-#else
-#define GLFW_HAS_NEW_CURSORS (0)
-#endif
-
-// Data
-enum GlfwClientApi
-{
- GlfwClientApi_Unknown,
- GlfwClientApi_OpenGL,
- GlfwClientApi_Vulkan
-};
-static GLFWwindow* g_Window = NULL; // Main window
-static GlfwClientApi g_ClientApi = GlfwClientApi_Unknown;
-static double g_Time = 0.0;
-static bool g_MouseJustPressed[ImGuiMouseButton_COUNT] = {};
-static GLFWcursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {};
-static bool g_InstalledCallbacks = false;
-
-// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
-static GLFWmousebuttonfun g_PrevUserCallbackMousebutton = NULL;
-static GLFWscrollfun g_PrevUserCallbackScroll = NULL;
-static GLFWkeyfun g_PrevUserCallbackKey = NULL;
-static GLFWcharfun g_PrevUserCallbackChar = NULL;
-
-static const char* ImGui_ImplGlfw_GetClipboardText(void* user_data)
-{
- return glfwGetClipboardString((GLFWwindow*)user_data);
-}
-
-static void ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)
-{
- glfwSetClipboardString((GLFWwindow*)user_data, text);
-}
-
-void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
-{
- if (g_PrevUserCallbackMousebutton != NULL)
- g_PrevUserCallbackMousebutton(window, button, action, mods);
-
- if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
- g_MouseJustPressed[button] = true;
-}
-
-void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
-{
- if (g_PrevUserCallbackScroll != NULL)
- g_PrevUserCallbackScroll(window, xoffset, yoffset);
-
- ImGuiIO& io = ImGui::GetIO();
- io.MouseWheelH += (float)xoffset;
- io.MouseWheel += (float)yoffset;
-}
-
-void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
-{
- if (g_PrevUserCallbackKey != NULL)
- g_PrevUserCallbackKey(window, key, scancode, action, mods);
-
- ImGuiIO& io = ImGui::GetIO();
- if (action == GLFW_PRESS)
- io.KeysDown[key] = true;
- if (action == GLFW_RELEASE)
- io.KeysDown[key] = false;
-
- // Modifiers are not reliable across systems
- io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
- io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
- io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
-#ifdef _WIN32
- io.KeySuper = false;
-#else
- io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
-#endif
-}
-
-void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c)
-{
- if (g_PrevUserCallbackChar != NULL)
- g_PrevUserCallbackChar(window, c);
-
- ImGuiIO& io = ImGui::GetIO();
- io.AddInputCharacter(c);
-}
-
-static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
-{
- g_Window = window;
- g_Time = 0.0;
-
- // Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
- io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
- io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
- io.BackendPlatformName = "imgui_impl_glfw";
-
- // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
- io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
- io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
- io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
- io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP;
- io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN;
- io.KeyMap[ImGuiKey_PageUp] = GLFW_KEY_PAGE_UP;
- io.KeyMap[ImGuiKey_PageDown] = GLFW_KEY_PAGE_DOWN;
- io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME;
- io.KeyMap[ImGuiKey_End] = GLFW_KEY_END;
- io.KeyMap[ImGuiKey_Insert] = GLFW_KEY_INSERT;
- io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE;
- io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE;
- io.KeyMap[ImGuiKey_Space] = GLFW_KEY_SPACE;
- io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER;
- io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE;
- io.KeyMap[ImGuiKey_KeyPadEnter] = GLFW_KEY_KP_ENTER;
- io.KeyMap[ImGuiKey_A] = GLFW_KEY_A;
- io.KeyMap[ImGuiKey_C] = GLFW_KEY_C;
- io.KeyMap[ImGuiKey_V] = GLFW_KEY_V;
- io.KeyMap[ImGuiKey_X] = GLFW_KEY_X;
- io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y;
- io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z;
-
- io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText;
- io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText;
- io.ClipboardUserData = g_Window;
-#if defined(_WIN32)
- io.ImeWindowHandle = (void*)glfwGetWin32Window(g_Window);
-#endif
-
- // Create mouse cursors
- // (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
- // GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
- // Missing cursors will return NULL and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
- GLFWerrorfun prev_error_callback = glfwSetErrorCallback(NULL);
- g_MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_Hand] = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
-#if GLFW_HAS_NEW_CURSORS
- g_MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_RESIZE_ALL_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_RESIZE_NESW_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_RESIZE_NWSE_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_NOT_ALLOWED_CURSOR);
-#else
- g_MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
- g_MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
-#endif
- glfwSetErrorCallback(prev_error_callback);
-
- // Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
- g_PrevUserCallbackMousebutton = NULL;
- g_PrevUserCallbackScroll = NULL;
- g_PrevUserCallbackKey = NULL;
- g_PrevUserCallbackChar = NULL;
- if (install_callbacks)
- {
- g_InstalledCallbacks = true;
- g_PrevUserCallbackMousebutton = glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
- g_PrevUserCallbackScroll = glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
- g_PrevUserCallbackKey = glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
- g_PrevUserCallbackChar = glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback);
- }
-
- g_ClientApi = client_api;
- return true;
-}
-
-bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks)
-{
- return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_OpenGL);
-}
-
-bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks)
-{
- return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Vulkan);
-}
-
-void ImGui_ImplGlfw_Shutdown()
-{
- if (g_InstalledCallbacks)
- {
- glfwSetMouseButtonCallback(g_Window, g_PrevUserCallbackMousebutton);
- glfwSetScrollCallback(g_Window, g_PrevUserCallbackScroll);
- glfwSetKeyCallback(g_Window, g_PrevUserCallbackKey);
- glfwSetCharCallback(g_Window, g_PrevUserCallbackChar);
- g_InstalledCallbacks = false;
- }
-
- for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
- {
- glfwDestroyCursor(g_MouseCursors[cursor_n]);
- g_MouseCursors[cursor_n] = NULL;
- }
- g_ClientApi = GlfwClientApi_Unknown;
-}
-
-static void ImGui_ImplGlfw_UpdateMousePosAndButtons()
-{
- // Update buttons
- ImGuiIO& io = ImGui::GetIO();
- for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++)
- {
- // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
- io.MouseDown[i] = g_MouseJustPressed[i] || glfwGetMouseButton(g_Window, i) != 0;
- g_MouseJustPressed[i] = false;
- }
-
- // Update mouse position
- const ImVec2 mouse_pos_backup = io.MousePos;
- io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
-#ifdef __EMSCRIPTEN__
- const bool focused = true; // Emscripten
-#else
- const bool focused = glfwGetWindowAttrib(g_Window, GLFW_FOCUSED) != 0;
-#endif
- if (focused)
- {
- if (io.WantSetMousePos)
- {
- glfwSetCursorPos(g_Window, (double)mouse_pos_backup.x, (double)mouse_pos_backup.y);
- }
- else
- {
- double mouse_x, mouse_y;
- glfwGetCursorPos(g_Window, &mouse_x, &mouse_y);
- io.MousePos = ImVec2((float)mouse_x, (float)mouse_y);
- }
- }
-}
-
-static void ImGui_ImplGlfw_UpdateMouseCursor()
-{
- ImGuiIO& io = ImGui::GetIO();
- if ((io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) || glfwGetInputMode(g_Window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
- return;
-
- ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
- if (imgui_cursor == ImGuiMouseCursor_None || io.MouseDrawCursor)
- {
- // Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
- glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
- }
- else
- {
- // Show OS mouse cursor
- // FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
- glfwSetCursor(g_Window, g_MouseCursors[imgui_cursor] ? g_MouseCursors[imgui_cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
- glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
- }
-}
-
-static void ImGui_ImplGlfw_UpdateGamepads()
-{
- ImGuiIO& io = ImGui::GetIO();
- memset(io.NavInputs, 0, sizeof(io.NavInputs));
- if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
- return;
-
- // Update gamepad inputs
- #define MAP_BUTTON(NAV_NO, BUTTON_NO) { if (buttons_count > BUTTON_NO && buttons[BUTTON_NO] == GLFW_PRESS) io.NavInputs[NAV_NO] = 1.0f; }
- #define MAP_ANALOG(NAV_NO, AXIS_NO, V0, V1) { float v = (axes_count > AXIS_NO) ? axes[AXIS_NO] : V0; v = (v - V0) / (V1 - V0); if (v > 1.0f) v = 1.0f; if (io.NavInputs[NAV_NO] < v) io.NavInputs[NAV_NO] = v; }
- int axes_count = 0, buttons_count = 0;
- const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axes_count);
- const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttons_count);
- MAP_BUTTON(ImGuiNavInput_Activate, 0); // Cross / A
- MAP_BUTTON(ImGuiNavInput_Cancel, 1); // Circle / B
- MAP_BUTTON(ImGuiNavInput_Menu, 2); // Square / X
- MAP_BUTTON(ImGuiNavInput_Input, 3); // Triangle / Y
- MAP_BUTTON(ImGuiNavInput_DpadLeft, 13); // D-Pad Left
- MAP_BUTTON(ImGuiNavInput_DpadRight, 11); // D-Pad Right
- MAP_BUTTON(ImGuiNavInput_DpadUp, 10); // D-Pad Up
- MAP_BUTTON(ImGuiNavInput_DpadDown, 12); // D-Pad Down
- MAP_BUTTON(ImGuiNavInput_FocusPrev, 4); // L1 / LB
- MAP_BUTTON(ImGuiNavInput_FocusNext, 5); // R1 / RB
- MAP_BUTTON(ImGuiNavInput_TweakSlow, 4); // L1 / LB
- MAP_BUTTON(ImGuiNavInput_TweakFast, 5); // R1 / RB
- MAP_ANALOG(ImGuiNavInput_LStickLeft, 0, -0.3f, -0.9f);
- MAP_ANALOG(ImGuiNavInput_LStickRight,0, +0.3f, +0.9f);
- MAP_ANALOG(ImGuiNavInput_LStickUp, 1, +0.3f, +0.9f);
- MAP_ANALOG(ImGuiNavInput_LStickDown, 1, -0.3f, -0.9f);
- #undef MAP_BUTTON
- #undef MAP_ANALOG
- if (axes_count > 0 && buttons_count > 0)
- io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
- else
- io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
-}
-
-void ImGui_ImplGlfw_NewFrame()
-{
- ImGuiIO& io = ImGui::GetIO();
- IM_ASSERT(io.Fonts->IsBuilt() && "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame().");
-
- // Setup display size (every frame to accommodate for window resizing)
- int w, h;
- int display_w, display_h;
- glfwGetWindowSize(g_Window, &w, &h);
- glfwGetFramebufferSize(g_Window, &display_w, &display_h);
- io.DisplaySize = ImVec2((float)w, (float)h);
- if (w > 0 && h > 0)
- io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
-
- // Setup time step
- double current_time = glfwGetTime();
- io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f);
- g_Time = current_time;
-
- ImGui_ImplGlfw_UpdateMousePosAndButtons();
- ImGui_ImplGlfw_UpdateMouseCursor();
-
- // Update game controllers (if enabled and available)
- ImGui_ImplGlfw_UpdateGamepads();
-}
diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h
deleted file mode 100644
index f62f44f31b42..000000000000
--- a/examples/imgui_impl_glfw.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// dear imgui: Platform Binding for GLFW
-// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
-// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
-
-// Implemented features:
-// [X] Platform: Clipboard support.
-// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
-// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// About GLSL version:
-// The 'glsl_version' initialization parameter defaults to "#version 150" if NULL.
-// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-struct GLFWwindow;
-
-IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
-IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks);
-IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
-
-// GLFW callbacks
-// - When calling Init with 'install_callbacks=true': GLFW callbacks will be installed for you. They will call user's previously installed callbacks, if any.
-// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call those function yourself from your own GLFW callbacks.
-IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
-IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
-IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
-IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
diff --git a/examples/imgui_impl_glut.cpp b/examples/imgui_impl_glut.cpp
deleted file mode 100644
index 3c17bbfc1d0d..000000000000
--- a/examples/imgui_impl_glut.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-// dear imgui: Platform Binding for GLUT/FreeGLUT
-// This needs to be used along with a Renderer (e.g. OpenGL2)
-
-// !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!!
-// !!! If someone or something is teaching you GLUT in 2020, you are being abused. Please show some resistance. !!!
-// !!! Nowadays, prefer using GLFW or SDL instead!
-
-// Issues:
-// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
-// [ ] Platform: Missing mouse cursor shape/visibility support.
-// [ ] Platform: Missing clipboard support (not supported by Glut).
-// [ ] Platform: Missing gamepad support.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-04-03: Misc: Renamed imgui_impl_freeglut.cpp/.h to imgui_impl_glut.cpp/.h.
-// 2019-03-25: Misc: Made io.DeltaTime always above zero.
-// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
-// 2018-03-22: Added GLUT Platform binding.
-
-#include "imgui.h"
-#include "imgui_impl_glut.h"
-#ifdef __APPLE__
- #include
-#else
- #include
-#endif
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
-#endif
-
-static int g_Time = 0; // Current time, in milliseconds
-
-bool ImGui_ImplGLUT_Init()
-{
- ImGuiIO& io = ImGui::GetIO();
-
-#ifdef FREEGLUT
- io.BackendPlatformName ="imgui_impl_glut (freeglut)";
-#else
- io.BackendPlatformName ="imgui_impl_glut";
-#endif
-
- g_Time = 0;
-
- // Glut has 1 function for characters and one for "special keys". We map the characters in the 0..255 range and the keys above.
- io.KeyMap[ImGuiKey_Tab] = '\t'; // == 9 == CTRL+I
- io.KeyMap[ImGuiKey_LeftArrow] = 256 + GLUT_KEY_LEFT;
- io.KeyMap[ImGuiKey_RightArrow] = 256 + GLUT_KEY_RIGHT;
- io.KeyMap[ImGuiKey_UpArrow] = 256 + GLUT_KEY_UP;
- io.KeyMap[ImGuiKey_DownArrow] = 256 + GLUT_KEY_DOWN;
- io.KeyMap[ImGuiKey_PageUp] = 256 + GLUT_KEY_PAGE_UP;
- io.KeyMap[ImGuiKey_PageDown] = 256 + GLUT_KEY_PAGE_DOWN;
- io.KeyMap[ImGuiKey_Home] = 256 + GLUT_KEY_HOME;
- io.KeyMap[ImGuiKey_End] = 256 + GLUT_KEY_END;
- io.KeyMap[ImGuiKey_Insert] = 256 + GLUT_KEY_INSERT;
- io.KeyMap[ImGuiKey_Delete] = 127;
- io.KeyMap[ImGuiKey_Backspace] = 8; // == CTRL+H
- io.KeyMap[ImGuiKey_Space] = ' ';
- io.KeyMap[ImGuiKey_Enter] = 13; // == CTRL+M
- io.KeyMap[ImGuiKey_Escape] = 27;
- io.KeyMap[ImGuiKey_KeyPadEnter] = 13; // == CTRL+M
- io.KeyMap[ImGuiKey_A] = 'A';
- io.KeyMap[ImGuiKey_C] = 'C';
- io.KeyMap[ImGuiKey_V] = 'V';
- io.KeyMap[ImGuiKey_X] = 'X';
- io.KeyMap[ImGuiKey_Y] = 'Y';
- io.KeyMap[ImGuiKey_Z] = 'Z';
-
- return true;
-}
-
-void ImGui_ImplGLUT_InstallFuncs()
-{
- glutReshapeFunc(ImGui_ImplGLUT_ReshapeFunc);
- glutMotionFunc(ImGui_ImplGLUT_MotionFunc);
- glutPassiveMotionFunc(ImGui_ImplGLUT_MotionFunc);
- glutMouseFunc(ImGui_ImplGLUT_MouseFunc);
-#ifdef __FREEGLUT_EXT_H__
- glutMouseWheelFunc(ImGui_ImplGLUT_MouseWheelFunc);
-#endif
- glutKeyboardFunc(ImGui_ImplGLUT_KeyboardFunc);
- glutKeyboardUpFunc(ImGui_ImplGLUT_KeyboardUpFunc);
- glutSpecialFunc(ImGui_ImplGLUT_SpecialFunc);
- glutSpecialUpFunc(ImGui_ImplGLUT_SpecialUpFunc);
-}
-
-void ImGui_ImplGLUT_Shutdown()
-{
-}
-
-void ImGui_ImplGLUT_NewFrame()
-{
- // Setup time step
- ImGuiIO& io = ImGui::GetIO();
- int current_time = glutGet(GLUT_ELAPSED_TIME);
- int delta_time_ms = (current_time - g_Time);
- if (delta_time_ms <= 0)
- delta_time_ms = 1;
- io.DeltaTime = delta_time_ms / 1000.0f;
- g_Time = current_time;
-
- // Start the frame
- ImGui::NewFrame();
-}
-
-static void ImGui_ImplGLUT_UpdateKeyboardMods()
-{
- ImGuiIO& io = ImGui::GetIO();
- int mods = glutGetModifiers();
- io.KeyCtrl = (mods & GLUT_ACTIVE_CTRL) != 0;
- io.KeyShift = (mods & GLUT_ACTIVE_SHIFT) != 0;
- io.KeyAlt = (mods & GLUT_ACTIVE_ALT) != 0;
-}
-
-void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y)
-{
- // Send character to imgui
- //printf("char_down_func %d '%c'\n", c, c);
- ImGuiIO& io = ImGui::GetIO();
- if (c >= 32)
- io.AddInputCharacter((unsigned int)c);
-
- // Store letters in KeysDown[] array as both uppercase and lowercase + Handle GLUT translating CTRL+A..CTRL+Z as 1..26.
- // This is a hacky mess but GLUT is unable to distinguish e.g. a TAB key from CTRL+I so this is probably the best we can do here.
- if (c >= 1 && c <= 26)
- io.KeysDown[c] = io.KeysDown[c - 1 + 'a'] = io.KeysDown[c - 1 + 'A'] = true;
- else if (c >= 'a' && c <= 'z')
- io.KeysDown[c] = io.KeysDown[c - 'a' + 'A'] = true;
- else if (c >= 'A' && c <= 'Z')
- io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = true;
- else
- io.KeysDown[c] = true;
- ImGui_ImplGLUT_UpdateKeyboardMods();
- (void)x; (void)y; // Unused
-}
-
-void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y)
-{
- //printf("char_up_func %d '%c'\n", c, c);
- ImGuiIO& io = ImGui::GetIO();
- if (c >= 1 && c <= 26)
- io.KeysDown[c] = io.KeysDown[c - 1 + 'a'] = io.KeysDown[c - 1 + 'A'] = false;
- else if (c >= 'a' && c <= 'z')
- io.KeysDown[c] = io.KeysDown[c - 'a' + 'A'] = false;
- else if (c >= 'A' && c <= 'Z')
- io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = false;
- else
- io.KeysDown[c] = false;
- ImGui_ImplGLUT_UpdateKeyboardMods();
- (void)x; (void)y; // Unused
-}
-
-void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y)
-{
- //printf("key_down_func %d\n", key);
- ImGuiIO& io = ImGui::GetIO();
- if (key + 256 < IM_ARRAYSIZE(io.KeysDown))
- io.KeysDown[key + 256] = true;
- ImGui_ImplGLUT_UpdateKeyboardMods();
- (void)x; (void)y; // Unused
-}
-
-void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y)
-{
- //printf("key_up_func %d\n", key);
- ImGuiIO& io = ImGui::GetIO();
- if (key + 256 < IM_ARRAYSIZE(io.KeysDown))
- io.KeysDown[key + 256] = false;
- ImGui_ImplGLUT_UpdateKeyboardMods();
- (void)x; (void)y; // Unused
-}
-
-void ImGui_ImplGLUT_MouseFunc(int glut_button, int state, int x, int y)
-{
- ImGuiIO& io = ImGui::GetIO();
- io.MousePos = ImVec2((float)x, (float)y);
- int button = -1;
- if (glut_button == GLUT_LEFT_BUTTON) button = 0;
- if (glut_button == GLUT_RIGHT_BUTTON) button = 1;
- if (glut_button == GLUT_MIDDLE_BUTTON) button = 2;
- if (button != -1 && state == GLUT_DOWN)
- io.MouseDown[button] = true;
- if (button != -1 && state == GLUT_UP)
- io.MouseDown[button] = false;
-}
-
-#ifdef __FREEGLUT_EXT_H__
-void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y)
-{
- ImGuiIO& io = ImGui::GetIO();
- io.MousePos = ImVec2((float)x, (float)y);
- if (dir > 0)
- io.MouseWheel += 1.0;
- else if (dir < 0)
- io.MouseWheel -= 1.0;
- (void)button; // Unused
-}
-#endif
-
-void ImGui_ImplGLUT_ReshapeFunc(int w, int h)
-{
- ImGuiIO& io = ImGui::GetIO();
- io.DisplaySize = ImVec2((float)w, (float)h);
-}
-
-void ImGui_ImplGLUT_MotionFunc(int x, int y)
-{
- ImGuiIO& io = ImGui::GetIO();
- io.MousePos = ImVec2((float)x, (float)y);
-}
diff --git a/examples/imgui_impl_glut.h b/examples/imgui_impl_glut.h
deleted file mode 100644
index 9acb77fb4dc4..000000000000
--- a/examples/imgui_impl_glut.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// dear imgui: Platform Binding for GLUT/FreeGLUT
-// This needs to be used along with a Renderer (e.g. OpenGL2)
-
-// !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!!
-// !!! If someone or something is teaching you GLUT in 2020, you are being abused. Please show some resistance. !!!
-// !!! Nowadays, prefer using GLFW or SDL instead!
-
-// Issues:
-// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
-// [ ] Platform: Missing mouse cursor shape/visibility support.
-// [ ] Platform: Missing clipboard support (not supported by Glut).
-// [ ] Platform: Missing gamepad support.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-IMGUI_IMPL_API bool ImGui_ImplGLUT_Init();
-IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs();
-IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplGLUT_NewFrame();
-
-// You can call ImGui_ImplGLUT_InstallFuncs() to get all those functions installed automatically,
-// or call them yourself from your own GLUT handlers. We are using the same weird names as GLUT for consistency..
-//---------------------------------------- GLUT name --------------------------------------------- Decent Name ---------
-IMGUI_IMPL_API void ImGui_ImplGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc
-IMGUI_IMPL_API void ImGui_ImplGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc
-IMGUI_IMPL_API void ImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc
-IMGUI_IMPL_API void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc
-IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc
-IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc
-IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc
-IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc
diff --git a/examples/imgui_impl_marmalade.cpp b/examples/imgui_impl_marmalade.cpp
deleted file mode 100644
index 0675c6b4f038..000000000000
--- a/examples/imgui_impl_marmalade.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-// dear imgui: Renderer + Platform Binding for Marmalade + IwGx
-// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID!
-// Missing features:
-// [ ] Renderer: Clipping rectangles are not honored.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
-// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
-// 2018-11-30: Misc: Setting up io.BackendPlatformName/io.BackendRendererName so they can be displayed in the About Window.
-// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_Marmalade_RenderDrawData() in the .h file so you can call it yourself.
-// 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 "imgui.h"
-#include "imgui_impl_marmalade.h"
-
-#include
-#include
-#include
-#include
-#include
-
-// Data
-static double g_Time = 0.0f;
-static bool g_MousePressed[3] = { false, false, false };
-static CIwTexture* g_FontTexture = NULL;
-static char* g_ClipboardText = NULL;
-static bool g_osdKeyboardEnabled = false;
-
-// use this setting to scale the interface - e.g. on device you could use 2 or 3 scale factor
-static ImVec2 g_RenderScale = ImVec2(1.0f,1.0f);
-
-// Render function.
-// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
-void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data)
-{
- // Avoid rendering when minimized
- if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
- return;
-
- // Render command lists
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
- const int nVert = cmd_list->VtxBuffer.Size;
- CIwFVec2* pVertStream = IW_GX_ALLOC(CIwFVec2, nVert);
- CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2, nVert);
- CIwColour* pColStream = IW_GX_ALLOC(CIwColour, nVert);
-
- for (int i = 0; i < nVert; i++)
- {
- // FIXME-OPT: optimize multiplication on GPU using vertex shader/projection matrix.
- pVertStream[i].x = cmd_list->VtxBuffer[i].pos.x * g_RenderScale.x;
- pVertStream[i].y = cmd_list->VtxBuffer[i].pos.y * g_RenderScale.y;
- pUVStream[i].x = cmd_list->VtxBuffer[i].uv.x;
- pUVStream[i].y = cmd_list->VtxBuffer[i].uv.y;
- pColStream[i] = cmd_list->VtxBuffer[i].col;
- }
-
- IwGxSetVertStreamScreenSpace(pVertStream, nVert);
- IwGxSetUVStream(pUVStream);
- IwGxSetColStream(pColStream, nVert);
- IwGxSetNormStream(0);
-
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback)
- {
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- // FIXME: Not honoring ClipRect fields.
- CIwMaterial* pCurrentMaterial = IW_GX_ALLOC_MATERIAL();
- pCurrentMaterial->SetShadeMode(CIwMaterial::SHADE_FLAT);
- pCurrentMaterial->SetCullMode(CIwMaterial::CULL_NONE);
- pCurrentMaterial->SetFiltering(false);
- pCurrentMaterial->SetAlphaMode(CIwMaterial::ALPHA_BLEND);
- pCurrentMaterial->SetDepthWriteMode(CIwMaterial::DEPTH_WRITE_NORMAL);
- pCurrentMaterial->SetAlphaTestMode(CIwMaterial::ALPHATEST_DISABLED);
- pCurrentMaterial->SetTexture((CIwTexture*)pcmd->TextureId);
- IwGxSetMaterial(pCurrentMaterial);
- IwGxDrawPrims(IW_GX_TRI_LIST, (uint16*)idx_buffer, pcmd->ElemCount);
- }
- idx_buffer += pcmd->ElemCount;
- }
- IwGxFlush();
- }
-
- // TODO: restore modified state (i.e. mvp matrix)
-}
-
-static const char* ImGui_Marmalade_GetClipboardText(void* /*user_data*/)
-{
- if (!s3eClipboardAvailable())
- return NULL;
-
- if (int size = s3eClipboardGetText(NULL, 0))
- {
- if (g_ClipboardText)
- delete[] g_ClipboardText;
- g_ClipboardText = new char[size];
- g_ClipboardText[0] = '\0';
- s3eClipboardGetText(g_ClipboardText, size);
- }
-
- return g_ClipboardText;
-}
-
-static void ImGui_Marmalade_SetClipboardText(void* /*user_data*/, const char* text)
-{
- if (s3eClipboardAvailable())
- s3eClipboardSetText(text);
-}
-
-int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data)
-{
- // pEvent->m_Button is of type s3ePointerButton and indicates which mouse
- // button was pressed. For touchscreen this should always have the value
- // S3E_POINTER_BUTTON_SELECT
- s3ePointerEvent* pEvent = (s3ePointerEvent*)system_data;
-
- if (pEvent->m_Pressed == 1)
- {
- if (pEvent->m_Button == S3E_POINTER_BUTTON_LEFTMOUSE)
- g_MousePressed[0] = true;
- if (pEvent->m_Button == S3E_POINTER_BUTTON_RIGHTMOUSE)
- g_MousePressed[1] = true;
- if (pEvent->m_Button == S3E_POINTER_BUTTON_MIDDLEMOUSE)
- g_MousePressed[2] = true;
- if (pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELUP)
- io.MouseWheel += pEvent->m_y;
- if (pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELDOWN)
- io.MouseWheel += pEvent->m_y;
- }
-
- return 0;
-}
-
-int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data)
-{
- ImGuiIO& io = ImGui::GetIO();
- s3eKeyboardEvent* e = (s3eKeyboardEvent*)system_data;
- if (e->m_Pressed == 1)
- io.KeysDown[e->m_Key] = true;
- if (e->m_Pressed == 0)
- io.KeysDown[e->m_Key] = false;
-
- io.KeyCtrl = s3eKeyboardGetState(s3eKeyLeftControl) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightControl) == S3E_KEY_STATE_DOWN;
- io.KeyShift = s3eKeyboardGetState(s3eKeyLeftShift) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightShift) == S3E_KEY_STATE_DOWN;
- io.KeyAlt = s3eKeyboardGetState(s3eKeyLeftAlt) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightAlt) == S3E_KEY_STATE_DOWN;
- io.KeySuper = s3eKeyboardGetState(s3eKeyLeftWindows) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightWindows) == S3E_KEY_STATE_DOWN;
-
- return 0;
-}
-
-int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data)
-{
- ImGuiIO& io = ImGui::GetIO();
- s3eKeyboardCharEvent* e = (s3eKeyboardCharEvent*)system_data;
- io.AddInputCharacter((unsigned int)e->m_Char);
-
- return 0;
-}
-
-bool ImGui_Marmalade_CreateDeviceObjects()
-{
- // Build texture atlas
- ImGuiIO& io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
-
- // Upload texture to graphics system
- g_FontTexture = new CIwTexture();
- g_FontTexture->SetModifiable(true);
- CIwImage& image = g_FontTexture->GetImage();
- image.SetFormat(CIwImage::ARGB_8888);
- image.SetWidth(width);
- image.SetHeight(height);
- image.SetBuffers(); // allocates and own buffers
- image.ReadTexels(pixels);
- g_FontTexture->SetMipMapping(false);
- g_FontTexture->SetFiltering(false);
- g_FontTexture->Upload();
-
- // Store our identifier
- io.Fonts->TexID = (ImTextureID)g_FontTexture;
-
- return true;
-}
-
-void ImGui_Marmalade_InvalidateDeviceObjects()
-{
- if (g_ClipboardText)
- {
- delete[] g_ClipboardText;
- g_ClipboardText = NULL;
- }
-
- if (g_FontTexture)
- {
- delete g_FontTexture;
- ImGui::GetIO().Fonts->TexID = 0;
- g_FontTexture = NULL;
- }
-}
-
-bool ImGui_Marmalade_Init(bool install_callbacks)
-{
- ImGuiIO& io = ImGui::GetIO();
- io.BackendPlatformName = io.BackendRendererName = "imgui_impl_marmalade";
-
- io.KeyMap[ImGuiKey_Tab] = s3eKeyTab; // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
- io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
- io.KeyMap[ImGuiKey_RightArrow] = s3eKeyRight;
- io.KeyMap[ImGuiKey_UpArrow] = s3eKeyUp;
- io.KeyMap[ImGuiKey_DownArrow] = s3eKeyDown;
- io.KeyMap[ImGuiKey_PageUp] = s3eKeyPageUp;
- io.KeyMap[ImGuiKey_PageDown] = s3eKeyPageDown;
- io.KeyMap[ImGuiKey_Home] = s3eKeyHome;
- io.KeyMap[ImGuiKey_End] = s3eKeyEnd;
- io.KeyMap[ImGuiKey_Insert] = s3eKeyInsert;
- io.KeyMap[ImGuiKey_Delete] = s3eKeyDelete;
- io.KeyMap[ImGuiKey_Backspace] = s3eKeyBackspace;
- io.KeyMap[ImGuiKey_Space] = s3eKeySpace;
- io.KeyMap[ImGuiKey_Enter] = s3eKeyEnter;
- io.KeyMap[ImGuiKey_Escape] = s3eKeyEsc;
- io.KeyMap[ImGuiKey_KeyPadEnter] = s3eKeyNumPadEnter;
- io.KeyMap[ImGuiKey_A] = s3eKeyA;
- io.KeyMap[ImGuiKey_C] = s3eKeyC;
- io.KeyMap[ImGuiKey_V] = s3eKeyV;
- io.KeyMap[ImGuiKey_X] = s3eKeyX;
- io.KeyMap[ImGuiKey_Y] = s3eKeyY;
- io.KeyMap[ImGuiKey_Z] = s3eKeyZ;
-
- io.SetClipboardTextFn = ImGui_Marmalade_SetClipboardText;
- io.GetClipboardTextFn = ImGui_Marmalade_GetClipboardText;
-
- if (install_callbacks)
- {
- s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, ImGui_Marmalade_PointerButtonEventCallback, 0);
- s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, ImGui_Marmalade_KeyCallback, 0);
- s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, ImGui_Marmalade_CharCallback, 0);
- }
-
- return true;
-}
-
-void ImGui_Marmalade_Shutdown()
-{
- ImGui_Marmalade_InvalidateDeviceObjects();
-}
-
-void ImGui_Marmalade_NewFrame()
-{
- if (!g_FontTexture)
- ImGui_Marmalade_CreateDeviceObjects();
-
- ImGuiIO& io = ImGui::GetIO();
-
- // Setup display size (every frame to accommodate for window resizing)
- int w = IwGxGetScreenWidth(), h = IwGxGetScreenHeight();
- io.DisplaySize = ImVec2((float)w, (float)h);
- // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
- io.DisplayFramebufferScale = g_scale;
-
- // Setup time step
- double current_time = s3eTimerGetUST() / 1000.0f;
- io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f);
- g_Time = current_time;
-
- double mouse_x, mouse_y;
- mouse_x = s3ePointerGetX();
- mouse_y = s3ePointerGetY();
- io.MousePos = ImVec2((float)mouse_x/g_scale.x, (float)mouse_y/g_scale.y); // Mouse position (set to -FLT_MAX,-FLT_MAX if no mouse / on another screen, etc.)
-
- for (int i = 0; i < 3; i++)
- {
- io.MouseDown[i] = g_MousePressed[i] || s3ePointerGetState((s3ePointerButton)i) != S3E_POINTER_STATE_UP; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
- g_MousePressed[i] = false;
- }
-
- // TODO: Hide OS mouse cursor if ImGui is drawing it
- // s3ePointerSetInt(S3E_POINTER_HIDE_CURSOR,(io.MouseDrawCursor ? 0 : 1));
-
- // Show/hide OSD keyboard
- if (io.WantTextInput)
- {
- // Some text input widget is active?
- if (!g_osdKeyboardEnabled)
- {
- g_osdKeyboardEnabled = true;
- s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 1); // show OSD keyboard
- }
- }
- else
- {
- // No text input widget is active
- if (g_osdKeyboardEnabled)
- {
- g_osdKeyboardEnabled = false;
- s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 0); // hide OSD keyboard
- }
- }
-}
diff --git a/examples/imgui_impl_marmalade.h b/examples/imgui_impl_marmalade.h
deleted file mode 100644
index 9e92d899fb30..000000000000
--- a/examples/imgui_impl_marmalade.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// dear imgui: Renderer + Platform Binding for Marmalade + IwGx
-// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID!
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks);
-IMGUI_IMPL_API void ImGui_Marmalade_Shutdown();
-IMGUI_IMPL_API void ImGui_Marmalade_NewFrame();
-IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data);
-
-// Use if you want to reset your rendering device without losing Dear ImGui state.
-IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects();
-IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects();
-
-// Callbacks (installed by default if you enable 'install_callbacks' during initialization)
-// You can also handle inputs yourself and use those as a reference.
-IMGUI_IMPL_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data);
-IMGUI_IMPL_API int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data);
-IMGUI_IMPL_API int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data);
diff --git a/examples/imgui_impl_metal.h b/examples/imgui_impl_metal.h
deleted file mode 100644
index f6e8fd2bcb5a..000000000000
--- a/examples/imgui_impl_metal.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// dear imgui: Renderer for Metal
-// This needs to be used along with a Platform Binding (e.g. OSX)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-#include "imgui.h" // IMGUI_IMPL_API
-
-@class MTLRenderPassDescriptor;
-@protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder;
-
-IMGUI_IMPL_API bool ImGui_ImplMetal_Init(id device);
-IMGUI_IMPL_API void ImGui_ImplMetal_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor *renderPassDescriptor);
-IMGUI_IMPL_API void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data,
- id commandBuffer,
- id commandEncoder);
-
-// Called by Init/NewFrame/Shutdown
-IMGUI_IMPL_API bool ImGui_ImplMetal_CreateFontsTexture(id device);
-IMGUI_IMPL_API void ImGui_ImplMetal_DestroyFontsTexture();
-IMGUI_IMPL_API bool ImGui_ImplMetal_CreateDeviceObjects(id device);
-IMGUI_IMPL_API void ImGui_ImplMetal_DestroyDeviceObjects();
diff --git a/examples/imgui_impl_metal.mm b/examples/imgui_impl_metal.mm
deleted file mode 100644
index 7cdda733e90a..000000000000
--- a/examples/imgui_impl_metal.mm
+++ /dev/null
@@ -1,550 +0,0 @@
-// dear imgui: Renderer for Metal
-// This needs to be used along with a Platform Binding (e.g. OSX)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID!
-// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2019-05-29: Metal: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
-// 2019-04-30: Metal: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2019-02-11: Metal: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display.
-// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
-// 2018-07-05: Metal: Added new Metal backend implementation.
-
-#include "imgui.h"
-#include "imgui_impl_metal.h"
-
-#import
-// #import // Not supported in XCode 9.2. Maybe a macro to detect the SDK version can be used (something like #if MACOS_SDK >= 10.13 ...)
-#import
-
-#pragma mark - Support classes
-
-// A wrapper around a MTLBuffer object that knows the last time it was reused
-@interface MetalBuffer : NSObject
-@property (nonatomic, strong) id buffer;
-@property (nonatomic, assign) NSTimeInterval lastReuseTime;
-- (instancetype)initWithBuffer:(id)buffer;
-@end
-
-// An object that encapsulates the data necessary to uniquely identify a
-// render pipeline state. These are used as cache keys.
-@interface FramebufferDescriptor : NSObject
-@property (nonatomic, assign) unsigned long sampleCount;
-@property (nonatomic, assign) MTLPixelFormat colorPixelFormat;
-@property (nonatomic, assign) MTLPixelFormat depthPixelFormat;
-@property (nonatomic, assign) MTLPixelFormat stencilPixelFormat;
-- (instancetype)initWithRenderPassDescriptor:(MTLRenderPassDescriptor *)renderPassDescriptor;
-@end
-
-// A singleton that stores long-lived objects that are needed by the Metal
-// renderer backend. Stores the render pipeline state cache and the default
-// font texture, and manages the reusable buffer cache.
-@interface MetalContext : NSObject
-@property (nonatomic, strong) id depthStencilState;
-@property (nonatomic, strong) FramebufferDescriptor *framebufferDescriptor; // framebuffer descriptor for current frame; transient
-@property (nonatomic, strong) NSMutableDictionary *renderPipelineStateCache; // pipeline cache; keyed on framebuffer descriptors
-@property (nonatomic, strong, nullable) id fontTexture;
-@property (nonatomic, strong) NSMutableArray *bufferCache;
-@property (nonatomic, assign) NSTimeInterval lastBufferCachePurge;
-- (void)makeDeviceObjectsWithDevice:(id)device;
-- (void)makeFontTextureWithDevice:(id)device;
-- (MetalBuffer *)dequeueReusableBufferOfLength:(NSUInteger)length device:(id)device;
-- (void)enqueueReusableBuffer:(MetalBuffer *)buffer;
-- (id)renderPipelineStateForFrameAndDevice:(id)device;
-- (void)emptyRenderPipelineStateCache;
-- (void)setupRenderState:(ImDrawData *)drawData
- commandBuffer:(id)commandBuffer
- commandEncoder:(id)commandEncoder
- renderPipelineState:(id)renderPipelineState
- vertexBuffer:(MetalBuffer *)vertexBuffer
- vertexBufferOffset:(size_t)vertexBufferOffset;
-- (void)renderDrawData:(ImDrawData *)drawData
- commandBuffer:(id)commandBuffer
- commandEncoder:(id)commandEncoder;
-@end
-
-static MetalContext *g_sharedMetalContext = nil;
-
-#pragma mark - ImGui API implementation
-
-bool ImGui_ImplMetal_Init(id device)
-{
- ImGuiIO& io = ImGui::GetIO();
- io.BackendRendererName = "imgui_impl_metal";
- io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
-
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- g_sharedMetalContext = [[MetalContext alloc] init];
- });
-
- ImGui_ImplMetal_CreateDeviceObjects(device);
-
- return true;
-}
-
-void ImGui_ImplMetal_Shutdown()
-{
- ImGui_ImplMetal_DestroyDeviceObjects();
-}
-
-void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor *renderPassDescriptor)
-{
- IM_ASSERT(g_sharedMetalContext != nil && "No Metal context. Did you call ImGui_ImplMetal_Init() ?");
-
- g_sharedMetalContext.framebufferDescriptor = [[FramebufferDescriptor alloc] initWithRenderPassDescriptor:renderPassDescriptor];
-}
-
-// Metal Render function.
-void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, id commandBuffer, id commandEncoder)
-{
- [g_sharedMetalContext renderDrawData:draw_data commandBuffer:commandBuffer commandEncoder:commandEncoder];
-}
-
-bool ImGui_ImplMetal_CreateFontsTexture(id device)
-{
- [g_sharedMetalContext makeFontTextureWithDevice:device];
-
- ImGuiIO& io = ImGui::GetIO();
- io.Fonts->TexID = (__bridge void *)g_sharedMetalContext.fontTexture; // ImTextureID == void*
-
- return (g_sharedMetalContext.fontTexture != nil);
-}
-
-void ImGui_ImplMetal_DestroyFontsTexture()
-{
- ImGuiIO& io = ImGui::GetIO();
- g_sharedMetalContext.fontTexture = nil;
- io.Fonts->TexID = nullptr;
-}
-
-bool ImGui_ImplMetal_CreateDeviceObjects(id device)
-{
- [g_sharedMetalContext makeDeviceObjectsWithDevice:device];
-
- ImGui_ImplMetal_CreateFontsTexture(device);
-
- return true;
-}
-
-void ImGui_ImplMetal_DestroyDeviceObjects()
-{
- ImGui_ImplMetal_DestroyFontsTexture();
- [g_sharedMetalContext emptyRenderPipelineStateCache];
-}
-
-#pragma mark - MetalBuffer implementation
-
-@implementation MetalBuffer
-- (instancetype)initWithBuffer:(id)buffer
-{
- if ((self = [super init]))
- {
- _buffer = buffer;
- _lastReuseTime = [NSDate date].timeIntervalSince1970;
- }
- return self;
-}
-@end
-
-#pragma mark - FramebufferDescriptor implementation
-
-@implementation FramebufferDescriptor
-- (instancetype)initWithRenderPassDescriptor:(MTLRenderPassDescriptor *)renderPassDescriptor
-{
- if ((self = [super init]))
- {
- _sampleCount = renderPassDescriptor.colorAttachments[0].texture.sampleCount;
- _colorPixelFormat = renderPassDescriptor.colorAttachments[0].texture.pixelFormat;
- _depthPixelFormat = renderPassDescriptor.depthAttachment.texture.pixelFormat;
- _stencilPixelFormat = renderPassDescriptor.stencilAttachment.texture.pixelFormat;
- }
- return self;
-}
-
-- (nonnull id)copyWithZone:(nullable NSZone *)zone
-{
- FramebufferDescriptor *copy = [[FramebufferDescriptor allocWithZone:zone] init];
- copy.sampleCount = self.sampleCount;
- copy.colorPixelFormat = self.colorPixelFormat;
- copy.depthPixelFormat = self.depthPixelFormat;
- copy.stencilPixelFormat = self.stencilPixelFormat;
- return copy;
-}
-
-- (NSUInteger)hash
-{
- NSUInteger sc = _sampleCount & 0x3;
- NSUInteger cf = _colorPixelFormat & 0x3FF;
- NSUInteger df = _depthPixelFormat & 0x3FF;
- NSUInteger sf = _stencilPixelFormat & 0x3FF;
- NSUInteger hash = (sf << 22) | (df << 12) | (cf << 2) | sc;
- return hash;
-}
-
-- (BOOL)isEqual:(id)object
-{
- FramebufferDescriptor *other = object;
- if (![other isKindOfClass:[FramebufferDescriptor class]])
- return NO;
- return other.sampleCount == self.sampleCount &&
- other.colorPixelFormat == self.colorPixelFormat &&
- other.depthPixelFormat == self.depthPixelFormat &&
- other.stencilPixelFormat == self.stencilPixelFormat;
-}
-
-@end
-
-#pragma mark - MetalContext implementation
-
-@implementation MetalContext
-- (instancetype)init {
- if ((self = [super init]))
- {
- _renderPipelineStateCache = [NSMutableDictionary dictionary];
- _bufferCache = [NSMutableArray array];
- _lastBufferCachePurge = [NSDate date].timeIntervalSince1970;
- }
- return self;
-}
-
-- (void)makeDeviceObjectsWithDevice:(id)device
-{
- MTLDepthStencilDescriptor *depthStencilDescriptor = [[MTLDepthStencilDescriptor alloc] init];
- depthStencilDescriptor.depthWriteEnabled = NO;
- depthStencilDescriptor.depthCompareFunction = MTLCompareFunctionAlways;
- self.depthStencilState = [device newDepthStencilStateWithDescriptor:depthStencilDescriptor];
-}
-
-// We are retrieving and uploading the font atlas as a 4-channels RGBA texture here.
-// In theory we could call GetTexDataAsAlpha8() and upload a 1-channel texture to save on memory access bandwidth.
-// However, using a shader designed for 1-channel texture would make it less obvious to use the ImTextureID facility to render users own textures.
-// You can make that change in your implementation.
-- (void)makeFontTextureWithDevice:(id)device
-{
- ImGuiIO &io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
- MTLTextureDescriptor *textureDescriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA8Unorm
- width:width
- height:height
- mipmapped:NO];
- textureDescriptor.usage = MTLTextureUsageShaderRead;
-#if TARGET_OS_OSX
- textureDescriptor.storageMode = MTLStorageModeManaged;
-#else
- textureDescriptor.storageMode = MTLStorageModeShared;
-#endif
- id texture = [device newTextureWithDescriptor:textureDescriptor];
- [texture replaceRegion:MTLRegionMake2D(0, 0, width, height) mipmapLevel:0 withBytes:pixels bytesPerRow:width * 4];
- self.fontTexture = texture;
-}
-
-- (MetalBuffer *)dequeueReusableBufferOfLength:(NSUInteger)length device:(id)device
-{
- NSTimeInterval now = [NSDate date].timeIntervalSince1970;
-
- // Purge old buffers that haven't been useful for a while
- if (now - self.lastBufferCachePurge > 1.0)
- {
- NSMutableArray *survivors = [NSMutableArray array];
- for (MetalBuffer *candidate in self.bufferCache)
- {
- if (candidate.lastReuseTime > self.lastBufferCachePurge)
- {
- [survivors addObject:candidate];
- }
- }
- self.bufferCache = [survivors mutableCopy];
- self.lastBufferCachePurge = now;
- }
-
- // See if we have a buffer we can reuse
- MetalBuffer *bestCandidate = nil;
- for (MetalBuffer *candidate in self.bufferCache)
- if (candidate.buffer.length >= length && (bestCandidate == nil || bestCandidate.lastReuseTime > candidate.lastReuseTime))
- bestCandidate = candidate;
-
- if (bestCandidate != nil)
- {
- [self.bufferCache removeObject:bestCandidate];
- bestCandidate.lastReuseTime = now;
- return bestCandidate;
- }
-
- // No luck; make a new buffer
- id backing = [device newBufferWithLength:length options:MTLResourceStorageModeShared];
- return [[MetalBuffer alloc] initWithBuffer:backing];
-}
-
-- (void)enqueueReusableBuffer:(MetalBuffer *)buffer
-{
- [self.bufferCache addObject:buffer];
-}
-
-- (_Nullable id)renderPipelineStateForFrameAndDevice:(id)device
-{
- // Try to retrieve a render pipeline state that is compatible with the framebuffer config for this frame
- // The hit rate for this cache should be very near 100%.
- id renderPipelineState = self.renderPipelineStateCache[self.framebufferDescriptor];
-
- if (renderPipelineState == nil)
- {
- // No luck; make a new render pipeline state
- renderPipelineState = [self _renderPipelineStateForFramebufferDescriptor:self.framebufferDescriptor device:device];
- // Cache render pipeline state for later reuse
- self.renderPipelineStateCache[self.framebufferDescriptor] = renderPipelineState;
- }
-
- return renderPipelineState;
-}
-
-- (id)_renderPipelineStateForFramebufferDescriptor:(FramebufferDescriptor *)descriptor device:(id)device
-{
- NSError *error = nil;
-
- NSString *shaderSource = @""
- "#include \n"
- "using namespace metal;\n"
- "\n"
- "struct Uniforms {\n"
- " float4x4 projectionMatrix;\n"
- "};\n"
- "\n"
- "struct VertexIn {\n"
- " float2 position [[attribute(0)]];\n"
- " float2 texCoords [[attribute(1)]];\n"
- " uchar4 color [[attribute(2)]];\n"
- "};\n"
- "\n"
- "struct VertexOut {\n"
- " float4 position [[position]];\n"
- " float2 texCoords;\n"
- " float4 color;\n"
- "};\n"
- "\n"
- "vertex VertexOut vertex_main(VertexIn in [[stage_in]],\n"
- " constant Uniforms &uniforms [[buffer(1)]]) {\n"
- " VertexOut out;\n"
- " out.position = uniforms.projectionMatrix * float4(in.position, 0, 1);\n"
- " out.texCoords = in.texCoords;\n"
- " out.color = float4(in.color) / float4(255.0);\n"
- " return out;\n"
- "}\n"
- "\n"
- "fragment half4 fragment_main(VertexOut in [[stage_in]],\n"
- " texture2d texture [[texture(0)]]) {\n"
- " constexpr sampler linearSampler(coord::normalized, min_filter::linear, mag_filter::linear, mip_filter::linear);\n"
- " half4 texColor = texture.sample(linearSampler, in.texCoords);\n"
- " return half4(in.color) * texColor;\n"
- "}\n";
-
- id library = [device newLibraryWithSource:shaderSource options:nil error:&error];
- if (library == nil)
- {
- NSLog(@"Error: failed to create Metal library: %@", error);
- return nil;
- }
-
- id vertexFunction = [library newFunctionWithName:@"vertex_main"];
- id fragmentFunction = [library newFunctionWithName:@"fragment_main"];
-
- if (vertexFunction == nil || fragmentFunction == nil)
- {
- NSLog(@"Error: failed to find Metal shader functions in library: %@", error);
- return nil;
- }
-
- MTLVertexDescriptor *vertexDescriptor = [MTLVertexDescriptor vertexDescriptor];
- vertexDescriptor.attributes[0].offset = IM_OFFSETOF(ImDrawVert, pos);
- vertexDescriptor.attributes[0].format = MTLVertexFormatFloat2; // position
- vertexDescriptor.attributes[0].bufferIndex = 0;
- vertexDescriptor.attributes[1].offset = IM_OFFSETOF(ImDrawVert, uv);
- vertexDescriptor.attributes[1].format = MTLVertexFormatFloat2; // texCoords
- vertexDescriptor.attributes[1].bufferIndex = 0;
- vertexDescriptor.attributes[2].offset = IM_OFFSETOF(ImDrawVert, col);
- vertexDescriptor.attributes[2].format = MTLVertexFormatUChar4; // color
- vertexDescriptor.attributes[2].bufferIndex = 0;
- vertexDescriptor.layouts[0].stepRate = 1;
- vertexDescriptor.layouts[0].stepFunction = MTLVertexStepFunctionPerVertex;
- vertexDescriptor.layouts[0].stride = sizeof(ImDrawVert);
-
- MTLRenderPipelineDescriptor *pipelineDescriptor = [[MTLRenderPipelineDescriptor alloc] init];
- pipelineDescriptor.vertexFunction = vertexFunction;
- pipelineDescriptor.fragmentFunction = fragmentFunction;
- pipelineDescriptor.vertexDescriptor = vertexDescriptor;
- pipelineDescriptor.sampleCount = self.framebufferDescriptor.sampleCount;
- pipelineDescriptor.colorAttachments[0].pixelFormat = self.framebufferDescriptor.colorPixelFormat;
- pipelineDescriptor.colorAttachments[0].blendingEnabled = YES;
- pipelineDescriptor.colorAttachments[0].rgbBlendOperation = MTLBlendOperationAdd;
- pipelineDescriptor.colorAttachments[0].alphaBlendOperation = MTLBlendOperationAdd;
- pipelineDescriptor.colorAttachments[0].sourceRGBBlendFactor = MTLBlendFactorSourceAlpha;
- pipelineDescriptor.colorAttachments[0].sourceAlphaBlendFactor = MTLBlendFactorSourceAlpha;
- pipelineDescriptor.colorAttachments[0].destinationRGBBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
- pipelineDescriptor.colorAttachments[0].destinationAlphaBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
- pipelineDescriptor.depthAttachmentPixelFormat = self.framebufferDescriptor.depthPixelFormat;
- pipelineDescriptor.stencilAttachmentPixelFormat = self.framebufferDescriptor.stencilPixelFormat;
-
- id renderPipelineState = [device newRenderPipelineStateWithDescriptor:pipelineDescriptor error:&error];
- if (error != nil)
- {
- NSLog(@"Error: failed to create Metal pipeline state: %@", error);
- }
-
- return renderPipelineState;
-}
-
-- (void)emptyRenderPipelineStateCache
-{
- [self.renderPipelineStateCache removeAllObjects];
-}
-
-- (void)setupRenderState:(ImDrawData *)drawData
- commandBuffer:(id)commandBuffer
- commandEncoder:(id)commandEncoder
- renderPipelineState:(id)renderPipelineState
- vertexBuffer:(MetalBuffer *)vertexBuffer
- vertexBufferOffset:(size_t)vertexBufferOffset
-{
- [commandEncoder setCullMode:MTLCullModeNone];
- [commandEncoder setDepthStencilState:g_sharedMetalContext.depthStencilState];
-
- // Setup viewport, orthographic projection matrix
- // Our visible imgui space lies from draw_data->DisplayPos (top left) to
- // draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
- MTLViewport viewport =
- {
- .originX = 0.0,
- .originY = 0.0,
- .width = (double)(drawData->DisplaySize.x * drawData->FramebufferScale.x),
- .height = (double)(drawData->DisplaySize.y * drawData->FramebufferScale.y),
- .znear = 0.0,
- .zfar = 1.0
- };
- [commandEncoder setViewport:viewport];
-
- float L = drawData->DisplayPos.x;
- float R = drawData->DisplayPos.x + drawData->DisplaySize.x;
- float T = drawData->DisplayPos.y;
- float B = drawData->DisplayPos.y + drawData->DisplaySize.y;
- float N = viewport.znear;
- float F = viewport.zfar;
- const float ortho_projection[4][4] =
- {
- { 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
- { 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
- { 0.0f, 0.0f, 1/(F-N), 0.0f },
- { (R+L)/(L-R), (T+B)/(B-T), N/(F-N), 1.0f },
- };
- [commandEncoder setVertexBytes:&ortho_projection length:sizeof(ortho_projection) atIndex:1];
-
- [commandEncoder setRenderPipelineState:renderPipelineState];
-
- [commandEncoder setVertexBuffer:vertexBuffer.buffer offset:0 atIndex:0];
- [commandEncoder setVertexBufferOffset:vertexBufferOffset atIndex:0];
-}
-
-- (void)renderDrawData:(ImDrawData *)drawData
- commandBuffer:(id)commandBuffer
- commandEncoder:(id)commandEncoder
-{
- // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
- int fb_width = (int)(drawData->DisplaySize.x * drawData->FramebufferScale.x);
- int fb_height = (int)(drawData->DisplaySize.y * drawData->FramebufferScale.y);
- if (fb_width <= 0 || fb_height <= 0 || drawData->CmdListsCount == 0)
- return;
-
- id renderPipelineState = [self renderPipelineStateForFrameAndDevice:commandBuffer.device];
-
- size_t vertexBufferLength = drawData->TotalVtxCount * sizeof(ImDrawVert);
- size_t indexBufferLength = drawData->TotalIdxCount * sizeof(ImDrawIdx);
- MetalBuffer* vertexBuffer = [self dequeueReusableBufferOfLength:vertexBufferLength device:commandBuffer.device];
- MetalBuffer* indexBuffer = [self dequeueReusableBufferOfLength:indexBufferLength device:commandBuffer.device];
-
- [self setupRenderState:drawData commandBuffer:commandBuffer commandEncoder:commandEncoder renderPipelineState:renderPipelineState vertexBuffer:vertexBuffer vertexBufferOffset:0];
-
- // Will project scissor/clipping rectangles into framebuffer space
- ImVec2 clip_off = drawData->DisplayPos; // (0,0) unless using multi-viewports
- ImVec2 clip_scale = drawData->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
-
- // Render command lists
- size_t vertexBufferOffset = 0;
- size_t indexBufferOffset = 0;
- for (int n = 0; n < drawData->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = drawData->CmdLists[n];
-
- memcpy((char *)vertexBuffer.buffer.contents + vertexBufferOffset, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
- memcpy((char *)indexBuffer.buffer.contents + indexBufferOffset, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
-
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback)
- {
- // User callback, registered via ImDrawList::AddCallback()
- // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
- if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
- [self setupRenderState:drawData commandBuffer:commandBuffer commandEncoder:commandEncoder renderPipelineState:renderPipelineState vertexBuffer:vertexBuffer vertexBufferOffset:vertexBufferOffset];
- else
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- // Project scissor/clipping rectangles into framebuffer space
- ImVec4 clip_rect;
- clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
- clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
- clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
- clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
-
- if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
- {
- // Apply scissor/clipping rectangle
- MTLScissorRect scissorRect =
- {
- .x = NSUInteger(clip_rect.x),
- .y = NSUInteger(clip_rect.y),
- .width = NSUInteger(clip_rect.z - clip_rect.x),
- .height = NSUInteger(clip_rect.w - clip_rect.y)
- };
- [commandEncoder setScissorRect:scissorRect];
-
-
- // Bind texture, Draw
- if (pcmd->TextureId != NULL)
- [commandEncoder setFragmentTexture:(__bridge id)(pcmd->TextureId) atIndex:0];
-
- [commandEncoder setVertexBufferOffset:(vertexBufferOffset + pcmd->VtxOffset * sizeof(ImDrawVert)) atIndex:0];
- [commandEncoder drawIndexedPrimitives:MTLPrimitiveTypeTriangle
- indexCount:pcmd->ElemCount
- indexType:sizeof(ImDrawIdx) == 2 ? MTLIndexTypeUInt16 : MTLIndexTypeUInt32
- indexBuffer:indexBuffer.buffer
- indexBufferOffset:indexBufferOffset + pcmd->IdxOffset * sizeof(ImDrawIdx)];
- }
- }
- }
-
- vertexBufferOffset += cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
- indexBufferOffset += cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx);
- }
-
- __weak id weakSelf = self;
- [commandBuffer addCompletedHandler:^(id)
- {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf enqueueReusableBuffer:vertexBuffer];
- [weakSelf enqueueReusableBuffer:indexBuffer];
- });
- }];
-}
-
-@end
diff --git a/examples/imgui_impl_opengl2.cpp b/examples/imgui_impl_opengl2.cpp
deleted file mode 100644
index b062697bcfa1..000000000000
--- a/examples/imgui_impl_opengl2.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-// dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline)
-// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
-// **Prefer using the code in imgui_impl_opengl3.cpp**
-// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
-// If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more
-// complicated, will require your code to reset every single OpenGL attributes to their initial state, and might
-// confuse your GPU driver.
-// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2020-01-23: OpenGL: Explicitly backup, setup and restore GL_TEXTURE_ENV to increase compatibility with legacy OpenGL applications.
-// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display.
-// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
-// 2018-08-03: OpenGL: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications.
-// 2018-06-08: Misc: Extracted imgui_impl_opengl2.cpp/.h away from the old combined GLFW/SDL+OpenGL2 examples.
-// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
-// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplOpenGL2_RenderDrawData() in the .h file so you can call it yourself.
-// 2017-09-01: OpenGL: Save and restore current polygon mode.
-// 2016-09-10: OpenGL: Uploading font texture as RGBA32 to increase compatibility with users shaders (not ideal).
-// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
-
-#include "imgui.h"
-#include "imgui_impl_opengl2.h"
-#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
-#include // intptr_t
-#else
-#include // intptr_t
-#endif
-
-// Include OpenGL header (without an OpenGL loader) requires a bit of fiddling
-#if defined(_WIN32) && !defined(APIENTRY)
-#define APIENTRY __stdcall // It is customary to use APIENTRY for OpenGL function pointer declarations on all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
-#endif
-#if defined(_WIN32) && !defined(WINGDIAPI)
-#define WINGDIAPI __declspec(dllimport) // Some Windows OpenGL headers need this
-#endif
-#if defined(__APPLE__)
-#define GL_SILENCE_DEPRECATION
-#include
-#else
-#include
-#endif
-
-// OpenGL Data
-static GLuint g_FontTexture = 0;
-
-// Functions
-bool ImGui_ImplOpenGL2_Init()
-{
- // Setup back-end capabilities flags
- ImGuiIO& io = ImGui::GetIO();
- io.BackendRendererName = "imgui_impl_opengl2";
- return true;
-}
-
-void ImGui_ImplOpenGL2_Shutdown()
-{
- ImGui_ImplOpenGL2_DestroyDeviceObjects();
-}
-
-void ImGui_ImplOpenGL2_NewFrame()
-{
- if (!g_FontTexture)
- ImGui_ImplOpenGL2_CreateDeviceObjects();
-}
-
-static void ImGui_ImplOpenGL2_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height)
-{
- // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers, polygon fill.
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glDisable(GL_CULL_FACE);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
- glEnable(GL_SCISSOR_TEST);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- glEnable(GL_TEXTURE_2D);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- // If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
- // you may need to backup/reset/restore current shader using the lines below. DO NOT MODIFY THIS FILE! Add the code in your calling function:
- // GLint last_program;
- // glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
- // glUseProgram(0);
- // ImGui_ImplOpenGL2_RenderDrawData(...);
- // glUseProgram(last_program)
-
- // Setup viewport, orthographic projection matrix
- // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
- glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(draw_data->DisplayPos.x, draw_data->DisplayPos.x + draw_data->DisplaySize.x, draw_data->DisplayPos.y + draw_data->DisplaySize.y, draw_data->DisplayPos.y, -1.0f, +1.0f);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-}
-
-// OpenGL2 Render function.
-// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
-// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly, in order to be able to run within any OpenGL engine that doesn't do so.
-void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
-{
- // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
- int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x);
- int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y);
- if (fb_width == 0 || fb_height == 0)
- return;
-
- // Backup GL state
- GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
- GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
- GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
- GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
- GLint last_tex_env_mode; glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &last_tex_env_mode);
- glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
-
- // Setup desired GL state
- ImGui_ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height);
-
- // Will project scissor/clipping rectangles into framebuffer space
- ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
- ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
-
- // Render command lists
- for (int n = 0; n < draw_data->CmdListsCount; n++)
- {
- const ImDrawList* cmd_list = draw_data->CmdLists[n];
- const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
- const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
- glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)));
- glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
- glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));
-
- for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
- {
- const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
- if (pcmd->UserCallback)
- {
- // User callback, registered via ImDrawList::AddCallback()
- // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
- if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
- ImGui_ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height);
- else
- pcmd->UserCallback(cmd_list, pcmd);
- }
- else
- {
- // Project scissor/clipping rectangles into framebuffer space
- ImVec4 clip_rect;
- clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
- clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
- clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
- clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
-
- if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
- {
- // Apply scissor/clipping rectangle
- glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
-
- // Bind texture, Draw
- glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
- glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer);
- }
- }
- idx_buffer += pcmd->ElemCount;
- }
- }
-
- // Restore modified GL state
- glDisableClientState(GL_COLOR_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
- glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture);
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glPopAttrib();
- glPolygonMode(GL_FRONT, (GLenum)last_polygon_mode[0]); glPolygonMode(GL_BACK, (GLenum)last_polygon_mode[1]);
- glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
- glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, last_tex_env_mode);
-}
-
-bool ImGui_ImplOpenGL2_CreateFontsTexture()
-{
- // Build texture atlas
- ImGuiIO& io = ImGui::GetIO();
- unsigned char* pixels;
- int width, height;
- io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
-
- // Upload texture to graphics system
- GLint last_texture;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
- glGenTextures(1, &g_FontTexture);
- glBindTexture(GL_TEXTURE_2D, g_FontTexture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
-
- // Store our identifier
- io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
-
- // Restore state
- glBindTexture(GL_TEXTURE_2D, last_texture);
-
- return true;
-}
-
-void ImGui_ImplOpenGL2_DestroyFontsTexture()
-{
- if (g_FontTexture)
- {
- ImGuiIO& io = ImGui::GetIO();
- glDeleteTextures(1, &g_FontTexture);
- io.Fonts->TexID = 0;
- g_FontTexture = 0;
- }
-}
-
-bool ImGui_ImplOpenGL2_CreateDeviceObjects()
-{
- return ImGui_ImplOpenGL2_CreateFontsTexture();
-}
-
-void ImGui_ImplOpenGL2_DestroyDeviceObjects()
-{
- ImGui_ImplOpenGL2_DestroyFontsTexture();
-}
diff --git a/examples/imgui_impl_opengl2.h b/examples/imgui_impl_opengl2.h
deleted file mode 100644
index 9b72cbba33d9..000000000000
--- a/examples/imgui_impl_opengl2.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline)
-// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
-// **Prefer using the code in imgui_impl_opengl3.cpp**
-// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
-// If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more
-// complicated, will require your code to reset every single OpenGL attributes to their initial state, and might
-// confuse your GPU driver.
-// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
-
-#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-
-IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
-IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
-IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame();
-IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data);
-
-// Called by Init/NewFrame/Shutdown
-IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateFontsTexture();
-IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyFontsTexture();
-IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects();
-IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects();
diff --git a/examples/imgui_impl_opengl3.cpp b/examples/imgui_impl_opengl3.cpp
deleted file mode 100644
index 028a704bff85..000000000000
--- a/examples/imgui_impl_opengl3.cpp
+++ /dev/null
@@ -1,677 +0,0 @@
-// dear imgui: Renderer for modern OpenGL with shaders / programmatic pipeline
-// - Desktop GL: 2.x 3.x 4.x
-// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
-// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
-
-// Implemented features:
-// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
-// [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices.
-
-// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
-// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
-// https://github.com/ocornut/imgui
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2020-05-08: OpenGL: Made default GLSL version 150 (instead of 130) on OSX.
-// 2020-04-21: OpenGL: Fixed handling of glClipControl(GL_UPPER_LEFT) by inverting projection matrix.
-// 2020-04-12: OpenGL: Fixed context version check mistakenly testing for 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset.
-// 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader.
-// 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader.
-// 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders.
-// 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility.
-// 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call.
-// 2019-05-29: OpenGL: Desktop GL only: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
-// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
-// 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop.
-// 2019-03-15: OpenGL: Added a dummy GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early.
-// 2019-03-03: OpenGL: Fix support for ES 2.0 (WebGL 1.0).
-// 2019-02-20: OpenGL: Fix for OSX not supporting OpenGL 4.5, we don't try to read GL_CLIP_ORIGIN even if defined by the headers/loader.
-// 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display.
-// 2019-02-01: OpenGL: Using GLSL 410 shaders for any version over 410 (e.g. 430, 450).
-// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
-// 2018-11-13: OpenGL: Support for GL 4.5's glClipControl(GL_UPPER_LEFT) / GL_CLIP_ORIGIN.
-// 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used.
-// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
-// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
-// 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
-// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
-// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
-// 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state.
-// 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a NULL pointer.
-// 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150".
-// 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
-// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself.
-// 2018-01-07: OpenGL: Changed GLSL shader version from 330 to 150.
-// 2017-09-01: OpenGL: Save and restore current bound sampler. Save and restore current polygon mode.
-// 2017-05-01: OpenGL: Fixed save and restore of current blend func state.
-// 2017-05-01: OpenGL: Fixed save and restore of current GL_ACTIVE_TEXTURE.
-// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
-// 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
-
-//----------------------------------------
-// OpenGL GLSL GLSL
-// version version string
-//----------------------------------------
-// 2.0 110 "#version 110"
-// 2.1 120 "#version 120"
-// 3.0 130 "#version 130"
-// 3.1 140 "#version 140"
-// 3.2 150 "#version 150"
-// 3.3 330 "#version 330 core"
-// 4.0 400 "#version 400 core"
-// 4.1 410 "#version 410 core"
-// 4.2 420 "#version 410 core"
-// 4.3 430 "#version 430 core"
-// ES 2.0 100 "#version 100" = WebGL 1.0
-// ES 3.0 300 "#version 300 es" = WebGL 2.0
-//----------------------------------------
-
-#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
-#include "imgui.h"
-#include "imgui_impl_opengl3.h"
-#include
-#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
-#include // intptr_t
-#else
-#include // intptr_t
-#endif
-
-
-// GL includes
-#if defined(IMGUI_IMPL_OPENGL_ES2)
-#include
-#elif defined(IMGUI_IMPL_OPENGL_ES3)
-#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
-#include // Use GL ES 3
-#else
-#include // Use GL ES 3
-#endif
-#else
-// About Desktop OpenGL function loaders:
-// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
-// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
-// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
-#if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W)
-#include