diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 20fd45675..1141daebc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -39,19 +39,30 @@ Breaking Changes: The only difference is if you were using TreeNodeEx() manually with ImGuiTreeNodeFlags_CollapsingHeader and without ImGuiTreeNodeFlags_NoTreePushOnOpen. In which case you can remove the ImGuiTreeNodeFlags_NoTreePushOnOpen flag from your call (ImGuiTreeNodeFlags_CollapsingHeader & ~ImGuiTreeNodeFlags_NoTreePushOnOpen). (#1864) - ImFontAtlas: Renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set. (#1859) - - Examples Bindings have been refactored to separate them into "Platform" and "Renderer" components that are more easy to combine. - - The "Platform" bindings are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, etc. - Examples: Windows (imgui_impl_win32.cpp), GLFW (imgui_impl_glfw.cpp), SDL2 (imgui_impl_sdl2.cpp). - - The "Renderer" bindings are in charge of: creating the main font texture, rendering imgui draw data. - Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp) - - This is not strictly a breaking change if you keep your old bindings, but _WHEN_ you'll want to fully update your bindings, - expect to have to reshuffle a few things. This refactor will greatly facilitate maintenance and re-usability, and was designed - to get us closer to the upcoming "multi-viewport" feature branch. - - Please read examples/README.txt for details. - + This also apply if you were using internal's TreeNodeBehavior() with the ImGuiTreeNodeFlags_CollapsingHeader flag directly. Other Changes: + - Examples back-ends have been refactored to separate the platform code (e.g. Win32, Glfw, SDL2) from the renderer code (e.g. DirectX11, OpenGL3, Vulkan). + The "Platform" bindings are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, etc. + The "Renderer" bindings are in charge of: creating the main font texture, rendering imgui draw data. + before: imgui_impl_dx11.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx11.cpp + before: imgui_impl_dx12.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx12.cpp + before: imgui_impl_glfw_gl3.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp + before: imgui_impl_glfw_vulkan.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp + before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp + before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp etc. + - The idea is what we can now easily combine and maintain back-ends and reduce code redundancy. Individual files are smaller and more reusable. + Integration of imgui into a new/custom engine may also be easier as there is less overlap between "windowing / inputs" and "rendering" code, + so you may study or grab one half of the code and not the other. + - This change was motivated by the fact that adding support for the upcoming multi-viewport feature requires more work from the Platform and Renderer + back-ends, and the amount of redundancy across files was becoming too difficult to maintain. If you use default back-ends, you'll benefit from an + easy update path to support multi-viewports later. + - This is not strictly a breaking change if you keep your old bindings, but when you'll want to fully update your bindings, + expect to have to reshuffle a few things. + - Each example still has its own main.cpp which you may refer you to understand how to initialize and glue everything together. + - Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well. + - Please read examples/README.txt for details. - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787) - Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787) - TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless. @@ -63,6 +74,7 @@ Other Changes: - InputTextMultiline(): Fixed double navigation highlight when scrollbar is active. (#787) - InputText(): Fixed Undo after pasting large amount of text (Redo will still fail when undo buffers are exhausted, but text won't be corrupted). - SliderFloat(): When using keyboard/gamepad and a zero precision format string (e.g. "%.0f"), always step in integer units. (#1866) + - ImFontConfig: Added GlyphMinAdvanceX/GlyphMaxAdvanceX settings useful to make a font appears monospaced, particularly useful for icon fonts. (#1869) - ImFontAtlas: Added GetGlyphRangesChineseSimplifiedCommon() helper that returns a list of ~2500 most common Simplified Chinese characters. (#1859) [@JX-Master, @ocornut] - Examples: GLFW: Made it possible to Shutdown/Init the backend again (by reseting the time storage properly). (#1827) [@ice1000] - Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches. diff --git a/examples/.gitignore b/examples/.gitignore index ff44bccb7..db2859e1d 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -16,10 +16,10 @@ build/* *.VC.VC.opendb ## Unix executables -opengl2_example/opengl2_example -opengl3_example/opengl3_example -sdl_opengl2_example/sdl_opengl2_example -sdl_opengl3_example/sdl_opengl3_example +example_glfw_opengl2/example_glfw_opengl2 +example_glfw_opengl3/example_glfw_opengl3 +example_sdl_opengl2/example_sdl_opengl2 +example_sdl_opengl3/example_sdl_opengl3 ## Dear ImGui Ini files imgui.ini diff --git a/examples/README.txt b/examples/README.txt index 960c17d7c..e672a7238 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -66,7 +66,7 @@ You can find binaries of some of those example applications at: Most the example bindings are split in 2 parts: - The "Platform" bindings, in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, windowing. - Examples: Windows (imgui_impl_win32.cpp), GLFW (imgui_impl_glfw.cpp), SDL2 (imgui_impl_sdl2.cpp) + Examples: Windows (imgui_impl_win32.cpp), GLFW (imgui_impl_glfw.cpp), SDL2 (imgui_impl_sdl.cpp) - The "Renderer" bindings, in charge of: creating the main font texture, rendering imgui draw data. Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp) @@ -110,7 +110,7 @@ Most the example bindings are split in 2 parts: List of officially maintained Platforms Bindings: imgui_impl_glfw.cpp - imgui_impl_sdl2.cpp + imgui_impl_sdl.cpp imgui_impl_win32.cpp List of officially maintained Renderer Bindings: @@ -154,76 +154,76 @@ Building: directly with a command-line compiler. -directx9_example/ +example_win32_directx9/ DirectX9 example, Windows only. = main.cpp + imgui_impl_win32.cpp + imgui_impl_dx9.cpp -directx10_example/ +example_win32_directx10/ DirectX10 example, Windows only. = main.cpp + imgui_impl_win32.cpp + imgui_impl_dx10.cpp -directx11_example/ +example_win32_directx11/ DirectX11 example, Windows only. = main.cpp + imgui_impl_win32.cpp + imgui_impl_dx11.cpp -directx12_example/ +example_win32_directx12/ DirectX12 example, Windows only. This is quite long and tedious, because: DirectX12. = main.cpp + imgui_impl_win32.cpp + imgui_impl_dx12.cpp -opengl2_example/ - **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** - **Prefer using the code in the opengl3_example/ folder** - GLFW + OpenGL example (legacy, fixed pipeline). +example_glfw_opengl2/ + **DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** + **Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)** + GLFW + OpenGL2 example (legacy, fixed pipeline). This code is mostly provided as a reference to learn about ImGui integration, because it is shorter. If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to make things more complicated, will require your code to reset many OpenGL attributes to their initial state, and might confuse your GPU driver. One star, not recommended. = main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp -opengl3_example/ - GLFW (Win32, Mac, Linux) + OpenGL example (programmable pipeline, binding modern functions with GL3W). +example_glfw_opengl3/ + GLFW (Win32, Mac, Linux) + OpenGL3+ example (programmable pipeline, binding modern functions with GL3W). This uses more modern OpenGL calls and custom shaders. Prefer using that if you are using modern OpenGL in your application (anything with shaders). = main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp -vulkan_example/ - Vulkan example. +example_glfw_vulkan/ + GLFW (Win32, Mac, Linux) + Vulkan example. This is quite long and tedious, because: Vulkan. = main.cpp + imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp -sdl_opengl2_example/ - **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** - **Prefer using the code in the sdl_opengl3_example/ folder** +example_sdl_opengl2/ + **DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** + **Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)** SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline). This code is mostly provided as a reference to learn about ImGui integration, because it is shorter. If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to make things more complicated, will require your code to reset many OpenGL attributes to their initial state, and might confuse your GPU driver. One star, not recommended. - = main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp + = main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp -sdl_opengl3_example/ - SDL2 (Win32, Mac, Linux, etc.) + OpenGL3 example. +example_sdl_opengl3/ + SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+ example. This uses more modern OpenGL calls and custom shaders. Prefer using that if you are using modern OpenGL in your application (anything with shaders). - = main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp + = main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp -sdl_vulkan_example/ +example_sdl_vulkan/ SDL2 (Win32, Mac, Linux, etc.) + Vulkan example. This is quite long and tedious, because: Vulkan. - = main.cpp + imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp + = main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp -apple_example/ +example_apple/ OSX & iOS example + OpenGL2. THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER. Consider using the opengl3_example/ instead. On iOS, Using Synergy to access keyboard/mouse data from server computer. Synergy keyboard integration is rather hacky. -allegro5_example/ +example_allegro5/ Allegro 5 example. = main.cpp + imgui_impl_allegro5.cpp -marmalade_example/ - Marmalade example using IwGx +example_marmalade/ + Marmalade example using IwGx. = main.cpp + imgui_impl_marmalade.cpp diff --git a/examples/allegro5_example/README.md b/examples/example_allegro5/README.md similarity index 89% rename from examples/allegro5_example/README.md rename to examples/example_allegro5/README.md index f15b5fda9..783839db3 100644 --- a/examples/allegro5_example/README.md +++ b/examples/example_allegro5/README.md @@ -12,12 +12,12 @@ Note that the back-end supports _BOTH_ 16-bit and 32-bit indices, but 32-bit ind - On Ubuntu 14.04+ ```bash -g++ -DIMGUI_USER_CONFIG=\"examples/allegro5_example/imconfig_allegro5.h\" -I .. -I ../.. main.cpp imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_primitives -o allegro5_example +g++ -DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" -I .. -I ../.. main.cpp imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_primitives -o allegro5_example ``` - On Windows with Visual Studio's CLI ``` set ALLEGRODIR=path_to_your_allegro5_folder -cl /Zi /MD /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG=\"examples/allegro5_example/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 +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/allegro5_example/imconfig_allegro5.h b/examples/example_allegro5/imconfig_allegro5.h similarity index 100% rename from examples/allegro5_example/imconfig_allegro5.h rename to examples/example_allegro5/imconfig_allegro5.h diff --git a/examples/allegro5_example/main.cpp b/examples/example_allegro5/main.cpp similarity index 100% rename from examples/allegro5_example/main.cpp rename to examples/example_allegro5/main.cpp diff --git a/examples/apple_example/.gitignore b/examples/example_apple/.gitignore similarity index 100% rename from examples/apple_example/.gitignore rename to examples/example_apple/.gitignore diff --git a/examples/apple_example/README.md b/examples/example_apple/README.md similarity index 96% rename from examples/apple_example/README.md rename to examples/example_apple/README.md index 339f6bf85..d414d1333 100644 --- a/examples/apple_example/README.md +++ b/examples/example_apple/README.md @@ -2,6 +2,8 @@ ## Introduction +THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER. + This example is the default XCode "OpenGL" example code, modified to support ImGui and [Synergy](http://synergy-project.org/) to share mouse/keyboard on an iOS device. It is a rather complex and messy example because of all of the faff required to get an XCode/iOS application running. Refer to the regular OpenGL examples if you want to learn about integrating ImGui. **The opengl3_example/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy. diff --git a/examples/apple_example/imguiex-ios/AppDelegate.h b/examples/example_apple/imguiex-ios/AppDelegate.h similarity index 100% rename from examples/apple_example/imguiex-ios/AppDelegate.h rename to examples/example_apple/imguiex-ios/AppDelegate.h diff --git a/examples/apple_example/imguiex-ios/AppDelegate.m b/examples/example_apple/imguiex-ios/AppDelegate.m similarity index 100% rename from examples/apple_example/imguiex-ios/AppDelegate.m rename to examples/example_apple/imguiex-ios/AppDelegate.m diff --git a/examples/apple_example/imguiex-ios/Base.lproj/LaunchScreen.xib b/examples/example_apple/imguiex-ios/Base.lproj/LaunchScreen.xib similarity index 100% rename from examples/apple_example/imguiex-ios/Base.lproj/LaunchScreen.xib rename to examples/example_apple/imguiex-ios/Base.lproj/LaunchScreen.xib diff --git a/examples/apple_example/imguiex-ios/Base.lproj/Main.storyboard b/examples/example_apple/imguiex-ios/Base.lproj/Main.storyboard similarity index 100% rename from examples/apple_example/imguiex-ios/Base.lproj/Main.storyboard rename to examples/example_apple/imguiex-ios/Base.lproj/Main.storyboard diff --git a/examples/apple_example/imguiex-ios/GameViewController.h b/examples/example_apple/imguiex-ios/GameViewController.h similarity index 100% rename from examples/apple_example/imguiex-ios/GameViewController.h rename to examples/example_apple/imguiex-ios/GameViewController.h diff --git a/examples/apple_example/imguiex-ios/GameViewController.m b/examples/example_apple/imguiex-ios/GameViewController.m similarity index 100% rename from examples/apple_example/imguiex-ios/GameViewController.m rename to examples/example_apple/imguiex-ios/GameViewController.m diff --git a/examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/Contents.json rename to examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@2x~iphone.png b/examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@2x~iphone.png similarity index 100% rename from examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@2x~iphone.png rename to examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@2x~iphone.png diff --git a/examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@3x~iphone.png b/examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@3x~iphone.png similarity index 100% rename from examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@3x~iphone.png rename to examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_60@3x~iphone.png diff --git a/examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76@2x~ipad.png b/examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76@2x~ipad.png similarity index 100% rename from examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76@2x~ipad.png rename to examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76@2x~ipad.png diff --git a/examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76~ipad.png b/examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76~ipad.png similarity index 100% rename from examples/apple_example/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76~ipad.png rename to examples/example_apple/imguiex-ios/Images.xcassets/AppIcon.appiconset/icon_imgui_76~ipad.png diff --git a/examples/apple_example/imguiex-ios/Info.plist b/examples/example_apple/imguiex-ios/Info.plist similarity index 100% rename from examples/apple_example/imguiex-ios/Info.plist rename to examples/example_apple/imguiex-ios/Info.plist diff --git a/examples/apple_example/imguiex-ios/Shaders/Shader.fsh b/examples/example_apple/imguiex-ios/Shaders/Shader.fsh similarity index 100% rename from examples/apple_example/imguiex-ios/Shaders/Shader.fsh rename to examples/example_apple/imguiex-ios/Shaders/Shader.fsh diff --git a/examples/apple_example/imguiex-ios/Shaders/Shader.vsh b/examples/example_apple/imguiex-ios/Shaders/Shader.vsh similarity index 100% rename from examples/apple_example/imguiex-ios/Shaders/Shader.vsh rename to examples/example_apple/imguiex-ios/Shaders/Shader.vsh diff --git a/examples/apple_example/imguiex-ios/debug_hud.cpp b/examples/example_apple/imguiex-ios/debug_hud.cpp similarity index 100% rename from examples/apple_example/imguiex-ios/debug_hud.cpp rename to examples/example_apple/imguiex-ios/debug_hud.cpp diff --git a/examples/apple_example/imguiex-ios/debug_hud.h b/examples/example_apple/imguiex-ios/debug_hud.h similarity index 100% rename from examples/apple_example/imguiex-ios/debug_hud.h rename to examples/example_apple/imguiex-ios/debug_hud.h diff --git a/examples/apple_example/imguiex-ios/imgui_ex_icon.png b/examples/example_apple/imguiex-ios/imgui_ex_icon.png similarity index 100% rename from examples/apple_example/imguiex-ios/imgui_ex_icon.png rename to examples/example_apple/imguiex-ios/imgui_ex_icon.png diff --git a/examples/apple_example/imguiex-ios/imgui_impl_ios.h b/examples/example_apple/imguiex-ios/imgui_impl_ios.h similarity index 100% rename from examples/apple_example/imguiex-ios/imgui_impl_ios.h rename to examples/example_apple/imguiex-ios/imgui_impl_ios.h diff --git a/examples/apple_example/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm similarity index 100% rename from examples/apple_example/imguiex-ios/imgui_impl_ios.mm rename to examples/example_apple/imguiex-ios/imgui_impl_ios.mm diff --git a/examples/apple_example/imguiex-ios/main.m b/examples/example_apple/imguiex-ios/main.m similarity index 100% rename from examples/apple_example/imguiex-ios/main.m rename to examples/example_apple/imguiex-ios/main.m diff --git a/examples/apple_example/imguiex-osx/AppDelegate.h b/examples/example_apple/imguiex-osx/AppDelegate.h similarity index 100% rename from examples/apple_example/imguiex-osx/AppDelegate.h rename to examples/example_apple/imguiex-osx/AppDelegate.h diff --git a/examples/apple_example/imguiex-osx/AppDelegate.m b/examples/example_apple/imguiex-osx/AppDelegate.m similarity index 100% rename from examples/apple_example/imguiex-osx/AppDelegate.m rename to examples/example_apple/imguiex-osx/AppDelegate.m diff --git a/examples/apple_example/imguiex-osx/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/example_apple/imguiex-osx/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from examples/apple_example/imguiex-osx/Assets.xcassets/AppIcon.appiconset/Contents.json rename to examples/example_apple/imguiex-osx/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/examples/apple_example/imguiex-osx/Assets.xcassets/AppIcon.appiconset/icon_imgui_180x180.png b/examples/example_apple/imguiex-osx/Assets.xcassets/AppIcon.appiconset/icon_imgui_180x180.png similarity index 100% rename from examples/apple_example/imguiex-osx/Assets.xcassets/AppIcon.appiconset/icon_imgui_180x180.png rename to examples/example_apple/imguiex-osx/Assets.xcassets/AppIcon.appiconset/icon_imgui_180x180.png diff --git a/examples/apple_example/imguiex-osx/Assets.xcassets/Contents.json b/examples/example_apple/imguiex-osx/Assets.xcassets/Contents.json similarity index 100% rename from examples/apple_example/imguiex-osx/Assets.xcassets/Contents.json rename to examples/example_apple/imguiex-osx/Assets.xcassets/Contents.json diff --git a/examples/apple_example/imguiex-osx/Info.plist b/examples/example_apple/imguiex-osx/Info.plist similarity index 100% rename from examples/apple_example/imguiex-osx/Info.plist rename to examples/example_apple/imguiex-osx/Info.plist diff --git a/examples/apple_example/imguiex-osx/main.m b/examples/example_apple/imguiex-osx/main.m similarity index 100% rename from examples/apple_example/imguiex-osx/main.m rename to examples/example_apple/imguiex-osx/main.m diff --git a/examples/apple_example/imguiex.xcodeproj/project.pbxproj b/examples/example_apple/imguiex.xcodeproj/project.pbxproj similarity index 100% rename from examples/apple_example/imguiex.xcodeproj/project.pbxproj rename to examples/example_apple/imguiex.xcodeproj/project.pbxproj diff --git a/examples/opengl2_example/Makefile b/examples/example_glfw_opengl2/Makefile similarity index 98% rename from examples/opengl2_example/Makefile rename to examples/example_glfw_opengl2/Makefile index 36f8baa59..7ec7eeee0 100644 --- a/examples/opengl2_example/Makefile +++ b/examples/example_glfw_opengl2/Makefile @@ -14,7 +14,7 @@ #CXX = g++ #CXX = clang++ -EXE = opengl2_example +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 diff --git a/examples/opengl2_example/build_win32.bat b/examples/example_glfw_opengl2/build_win32.bat similarity index 65% rename from examples/opengl2_example/build_win32.bat rename to examples/example_glfw_opengl2/build_win32.bat index c7a8073a8..538d9a52b 100644 --- a/examples/opengl2_example/build_win32.bat +++ b/examples/example_glfw_opengl2/build_win32.bat @@ -1,3 +1,3 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. mkdir Debug -cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/opengl2_example.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib +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/opengl2_example/opengl2_example.vcxproj b/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj similarity index 99% rename from examples/opengl2_example/opengl2_example.vcxproj rename to examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj index 927ddfa54..acec434b7 100644 --- a/examples/opengl2_example/opengl2_example.vcxproj +++ b/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj @@ -20,7 +20,7 @@ {9CDA7840-B7A5-496D-A527-E95571496D18} - opengl2_example + example_glfw_opengl2 diff --git a/examples/opengl2_example/opengl2_example.vcxproj.filters b/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters similarity index 100% rename from examples/opengl2_example/opengl2_example.vcxproj.filters rename to examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters diff --git a/examples/opengl2_example/main.cpp b/examples/example_glfw_opengl2/main.cpp similarity index 100% rename from examples/opengl2_example/main.cpp rename to examples/example_glfw_opengl2/main.cpp diff --git a/examples/opengl3_example/Makefile b/examples/example_glfw_opengl3/Makefile similarity index 98% rename from examples/opengl3_example/Makefile rename to examples/example_glfw_opengl3/Makefile index c6ce9a488..8cfc9f302 100644 --- a/examples/opengl3_example/Makefile +++ b/examples/example_glfw_opengl3/Makefile @@ -14,7 +14,7 @@ #CXX = g++ #CXX = clang++ -EXE = opengl3_example +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 diff --git a/examples/opengl3_example/build_win32.bat b/examples/example_glfw_opengl3/build_win32.bat similarity index 60% rename from examples/opengl3_example/build_win32.bat rename to examples/example_glfw_opengl3/build_win32.bat index f6f021689..8b54affda 100644 --- a/examples/opengl3_example/build_win32.bat +++ b/examples/example_glfw_opengl3/build_win32.bat @@ -1,3 +1,3 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. mkdir Debug -cl /nologo /Zi /MD /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/opengl_example3.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib +cl /nologo /Zi /MD /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/opengl3_example/opengl3_example.vcxproj b/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj similarity index 99% rename from examples/opengl3_example/opengl3_example.vcxproj rename to examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj index 34bae2511..07f28e303 100644 --- a/examples/opengl3_example/opengl3_example.vcxproj +++ b/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj @@ -20,7 +20,7 @@ {4a1fb5ea-22f5-42a8-ab92-1d2df5d47fb9} - opengl3_example + example_glfw_opengl3 diff --git a/examples/opengl3_example/opengl3_example.vcxproj.filters b/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters similarity index 100% rename from examples/opengl3_example/opengl3_example.vcxproj.filters rename to examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters diff --git a/examples/opengl3_example/main.cpp b/examples/example_glfw_opengl3/main.cpp similarity index 100% rename from examples/opengl3_example/main.cpp rename to examples/example_glfw_opengl3/main.cpp diff --git a/examples/vulkan_example/CMakeLists.txt b/examples/example_glfw_vulkan/CMakeLists.txt similarity index 76% rename from examples/vulkan_example/CMakeLists.txt rename to examples/example_glfw_vulkan/CMakeLists.txt index d05b45163..f9adc77e0 100644 --- a/examples/vulkan_example/CMakeLists.txt +++ b/examples/example_glfw_vulkan/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8) -project(ImGuiGLFWVulkanExample C CXX) +project(imgui_example_glfw_vulkan C CXX) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE) @@ -32,5 +32,5 @@ include_directories(${GLFW_DIR}/deps) file(GLOB sources *.cpp) -add_executable(vulkan_example ${sources} ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp) -target_link_libraries(vulkan_example ${LIBRARIES}) +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) +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 new file mode 100644 index 000000000..0d991b9d2 --- /dev/null +++ b/examples/example_glfw_vulkan/build_win32.bat @@ -0,0 +1,7 @@ +@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 new file mode 100644 index 000000000..ddedf597c --- /dev/null +++ b/examples/example_glfw_vulkan/build_win64.bat @@ -0,0 +1,7 @@ +@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/vulkan_example/vulkan_example.vcxproj b/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj similarity index 99% rename from examples/vulkan_example/vulkan_example.vcxproj rename to examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj index 3a0a99471..04b550822 100644 --- a/examples/vulkan_example/vulkan_example.vcxproj +++ b/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj @@ -20,7 +20,7 @@ {57E2DF5A-6FC8-45BB-99DD-91A18C646E80} - vulkan_example + example_glfw_vulkan diff --git a/examples/vulkan_example/vulkan_example.vcxproj.filters b/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters similarity index 100% rename from examples/vulkan_example/vulkan_example.vcxproj.filters rename to examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters diff --git a/examples/vulkan_example/gen_spv.sh b/examples/example_glfw_vulkan/gen_spv.sh similarity index 100% rename from examples/vulkan_example/gen_spv.sh rename to examples/example_glfw_vulkan/gen_spv.sh diff --git a/examples/vulkan_example/glsl_shader.frag b/examples/example_glfw_vulkan/glsl_shader.frag similarity index 100% rename from examples/vulkan_example/glsl_shader.frag rename to examples/example_glfw_vulkan/glsl_shader.frag diff --git a/examples/vulkan_example/glsl_shader.vert b/examples/example_glfw_vulkan/glsl_shader.vert similarity index 100% rename from examples/vulkan_example/glsl_shader.vert rename to examples/example_glfw_vulkan/glsl_shader.vert diff --git a/examples/vulkan_example/main.cpp b/examples/example_glfw_vulkan/main.cpp similarity index 100% rename from examples/vulkan_example/main.cpp rename to examples/example_glfw_vulkan/main.cpp diff --git a/examples/marmalade_example/data/app.icf b/examples/example_marmalade/data/app.icf similarity index 100% rename from examples/marmalade_example/data/app.icf rename to examples/example_marmalade/data/app.icf diff --git a/examples/marmalade_example/main.cpp b/examples/example_marmalade/main.cpp similarity index 100% rename from examples/marmalade_example/main.cpp rename to examples/example_marmalade/main.cpp diff --git a/examples/marmalade_example/marmalade_example.mkb b/examples/example_marmalade/marmalade_example.mkb similarity index 100% rename from examples/marmalade_example/marmalade_example.mkb rename to examples/example_marmalade/marmalade_example.mkb diff --git a/examples/null_example/build_win32.bat b/examples/example_null/build_win32.bat similarity index 54% rename from examples/null_example/build_win32.bat rename to examples/example_null/build_win32.bat index 7bb78232a..12cb70ab4 100644 --- a/examples/null_example/build_win32.bat +++ b/examples/example_null/build_win32.bat @@ -1,3 +1,3 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. mkdir Debug -cl /nologo /Zi /MD /I ..\.. *.cpp ..\..\*.cpp /FeDebug/null_example.exe /FoDebug/ /link gdi32.lib shell32.lib +cl /nologo /Zi /MD /I ..\.. *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib diff --git a/examples/null_example/main.cpp b/examples/example_null/main.cpp similarity index 100% rename from examples/null_example/main.cpp rename to examples/example_null/main.cpp diff --git a/examples/sdl_opengl2_example/Makefile b/examples/example_sdl_opengl2/Makefile similarity index 93% rename from examples/sdl_opengl2_example/Makefile rename to examples/example_sdl_opengl2/Makefile index 1fa4a91d7..a295ac228 100644 --- a/examples/sdl_opengl2_example/Makefile +++ b/examples/example_sdl_opengl2/Makefile @@ -14,8 +14,8 @@ #CXX = g++ #CXX = clang++ -EXE = sdl_opengl2_example -SOURCES = main.cpp ../imgui_impl_sdl2.cpp ../imgui_impl_opengl2.cpp +EXE = example_sdl_opengl2 +SOURCES = main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) diff --git a/examples/example_sdl_opengl2/README.md b/examples/example_sdl_opengl2/README.md new file mode 100644 index 000000000..a8bfc8803 --- /dev/null +++ b/examples/example_sdl_opengl2/README.md @@ -0,0 +1,22 @@ + +# How to Build + +- On Windows with Visual Studio's CLI + +``` +set SDL2DIR=path_to_your_sdl2_folder +cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console +``` + +- On Linux and similar Unixes + +``` +c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL +``` + +- On Mac OS X + +``` +brew install sdl2 +c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl +``` diff --git a/examples/example_sdl_opengl2/build_win32.bat b/examples/example_sdl_opengl2/build_win32.bat new file mode 100644 index 000000000..bc2eb3b2d --- /dev/null +++ b/examples/example_sdl_opengl2/build_win32.bat @@ -0,0 +1,3 @@ +@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\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_sdl.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console diff --git a/examples/sdl_opengl2_example/sdl_opengl2_example.vcxproj b/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj similarity index 98% rename from examples/sdl_opengl2_example/sdl_opengl2_example.vcxproj rename to examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj index 6bc24caa8..bdec85b39 100644 --- a/examples/sdl_opengl2_example/sdl_opengl2_example.vcxproj +++ b/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj @@ -20,7 +20,7 @@ {2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741} - opengl3_example + example_sdl_opengl2 @@ -154,7 +154,7 @@ - + @@ -162,7 +162,7 @@ - + diff --git a/examples/sdl_opengl2_example/sdl_opengl2_example.vcxproj.filters b/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters similarity index 93% rename from examples/sdl_opengl2_example/sdl_opengl2_example.vcxproj.filters rename to examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters index f129cc255..602fa0b0a 100644 --- a/examples/sdl_opengl2_example/sdl_opengl2_example.vcxproj.filters +++ b/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters @@ -22,7 +22,7 @@ sources - + sources @@ -42,7 +42,7 @@ sources - + sources diff --git a/examples/sdl_opengl2_example/main.cpp b/examples/example_sdl_opengl2/main.cpp similarity index 99% rename from examples/sdl_opengl2_example/main.cpp rename to examples/example_sdl_opengl2/main.cpp index 10e9d3196..5a4dbd4e7 100644 --- a/examples/sdl_opengl2_example/main.cpp +++ b/examples/example_sdl_opengl2/main.cpp @@ -7,7 +7,7 @@ // See imgui_impl_sdl.cpp for details. #include "imgui.h" -#include "imgui_impl_sdl2.h" +#include "imgui_impl_sdl.h" #include "imgui_impl_opengl2.h" #include #include diff --git a/examples/sdl_opengl3_example/Makefile b/examples/example_sdl_opengl3/Makefile similarity index 94% rename from examples/sdl_opengl3_example/Makefile rename to examples/example_sdl_opengl3/Makefile index 3870ec86c..fb826cbca 100644 --- a/examples/sdl_opengl3_example/Makefile +++ b/examples/example_sdl_opengl3/Makefile @@ -14,9 +14,9 @@ #CXX = g++ #CXX = clang++ -EXE = sdl_opengl3_example +EXE = example_sdl_opengl3 SOURCES = main.cpp -SOURCES += ../imgui_impl_sdl2.cpp ../imgui_impl_opengl3.cpp +SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp SOURCES += ../libs/gl3w/GL/gl3w.c OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) diff --git a/examples/example_sdl_opengl3/README.md b/examples/example_sdl_opengl3/README.md new file mode 100644 index 000000000..3de6666a3 --- /dev/null +++ b/examples/example_sdl_opengl3/README.md @@ -0,0 +1,22 @@ + +# How to Build + +- On Windows with Visual Studio's CLI + +``` +set SDL2DIR=path_to_your_sdl2_folder +cl /Zi /MD /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console +``` + +- On Linux and similar Unixes + +``` +c++ `sdl2-config --cflags` -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 ../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 new file mode 100644 index 000000000..d2cfa67fa --- /dev/null +++ b/examples/example_sdl_opengl3/build_win32.bat @@ -0,0 +1,3 @@ +@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\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl3.cpp ..\imgui_impl_sdl.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 diff --git a/examples/sdl_opengl3_example/sdl_opengl3_example.vcxproj b/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj similarity index 98% rename from examples/sdl_opengl3_example/sdl_opengl3_example.vcxproj rename to examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj index c8ebb094a..b194e6207 100644 --- a/examples/sdl_opengl3_example/sdl_opengl3_example.vcxproj +++ b/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj @@ -20,7 +20,7 @@ {BBAEB705-1669-40F3-8567-04CF6A991F4C} - opengl3_example + example_sdl_opengl3 @@ -154,7 +154,7 @@ - + @@ -163,7 +163,7 @@ - + diff --git a/examples/sdl_opengl3_example/sdl_opengl3_example.vcxproj.filters b/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters similarity index 95% rename from examples/sdl_opengl3_example/sdl_opengl3_example.vcxproj.filters rename to examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters index 93d321a2a..87ae4313d 100644 --- a/examples/sdl_opengl3_example/sdl_opengl3_example.vcxproj.filters +++ b/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters @@ -31,7 +31,7 @@ sources - + sources @@ -54,7 +54,7 @@ sources - + sources diff --git a/examples/sdl_opengl3_example/main.cpp b/examples/example_sdl_opengl3/main.cpp similarity index 99% rename from examples/sdl_opengl3_example/main.cpp rename to examples/example_sdl_opengl3/main.cpp index c9d5ec881..cdb7fce2d 100644 --- a/examples/sdl_opengl3_example/main.cpp +++ b/examples/example_sdl_opengl3/main.cpp @@ -4,7 +4,7 @@ // (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_sdl2.h" +#include "imgui_impl_sdl.h" #include "imgui_impl_opengl3.h" #include #include // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you. diff --git a/examples/sdl_vulkan_example/sdl_vulkan_example.vcxproj b/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj similarity index 98% rename from examples/sdl_vulkan_example/sdl_vulkan_example.vcxproj rename to examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj index 8b4d648c8..3d2a424a5 100644 --- a/examples/sdl_vulkan_example/sdl_vulkan_example.vcxproj +++ b/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj @@ -20,7 +20,7 @@ {BAE3D0B5-9695-4EB1-AD0F-75890EB4A3B3} - sdl_vulkan_example + example_sdl_vulkan @@ -153,7 +153,7 @@ - + @@ -161,7 +161,7 @@ - + diff --git a/examples/sdl_vulkan_example/sdl_vulkan_example.vcxproj.filters b/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters similarity index 93% rename from examples/sdl_vulkan_example/sdl_vulkan_example.vcxproj.filters rename to examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters index 35e8aa1f2..4f7c79281 100644 --- a/examples/sdl_vulkan_example/sdl_vulkan_example.vcxproj.filters +++ b/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters @@ -19,7 +19,7 @@ imgui - + sources @@ -39,7 +39,7 @@ imgui - + sources diff --git a/examples/sdl_vulkan_example/main.cpp b/examples/example_sdl_vulkan/main.cpp similarity index 99% rename from examples/sdl_vulkan_example/main.cpp rename to examples/example_sdl_vulkan/main.cpp index 64850d923..d0f6f2954 100644 --- a/examples/sdl_vulkan_example/main.cpp +++ b/examples/example_sdl_vulkan/main.cpp @@ -2,7 +2,7 @@ // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. #include "imgui.h" -#include "imgui_impl_sdl2.h" +#include "imgui_impl_sdl.h" #include "imgui_impl_vulkan.h" #include // printf, fprintf #include // abort diff --git a/examples/directx10_example/build_win32.bat b/examples/example_win32_directx10/build_win32.bat similarity index 70% rename from examples/directx10_example/build_win32.bat rename to examples/example_win32_directx10/build_win32.bat index 9d806ab74..d79cb8f7b 100644 --- a/examples/directx10_example/build_win32.bat +++ b/examples/example_win32_directx10/build_win32.bat @@ -1,4 +1,4 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 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/directx10_example.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib +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/directx10_example/directx10_example.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj similarity index 100% rename from examples/directx10_example/directx10_example.vcxproj rename to examples/example_win32_directx10/example_win32_directx10.vcxproj diff --git a/examples/directx10_example/directx10_example.vcxproj.filters b/examples/example_win32_directx10/example_win32_directx10.vcxproj.filters similarity index 100% rename from examples/directx10_example/directx10_example.vcxproj.filters rename to examples/example_win32_directx10/example_win32_directx10.vcxproj.filters diff --git a/examples/directx10_example/main.cpp b/examples/example_win32_directx10/main.cpp similarity index 100% rename from examples/directx10_example/main.cpp rename to examples/example_win32_directx10/main.cpp diff --git a/examples/directx11_example/build_win32.bat b/examples/example_win32_directx11/build_win32.bat similarity index 70% rename from examples/directx11_example/build_win32.bat rename to examples/example_win32_directx11/build_win32.bat index eefeed985..05e6a6f6c 100644 --- a/examples/directx11_example/build_win32.bat +++ b/examples/example_win32_directx11/build_win32.bat @@ -1,4 +1,4 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 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/directx11_example.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib +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/directx11_example/directx11_example.vcxproj b/examples/example_win32_directx11/example_win32_directx11.vcxproj similarity index 99% rename from examples/directx11_example/directx11_example.vcxproj rename to examples/example_win32_directx11/example_win32_directx11.vcxproj index 77f56fead..9aa098658 100644 --- a/examples/directx11_example/directx11_example.vcxproj +++ b/examples/example_win32_directx11/example_win32_directx11.vcxproj @@ -20,7 +20,7 @@ {9F316E83-5AE5-4939-A723-305A94F48005} - directx11_example + example_win32_directx11 diff --git a/examples/directx11_example/directx11_example.vcxproj.filters b/examples/example_win32_directx11/example_win32_directx11.vcxproj.filters similarity index 100% rename from examples/directx11_example/directx11_example.vcxproj.filters rename to examples/example_win32_directx11/example_win32_directx11.vcxproj.filters diff --git a/examples/directx11_example/main.cpp b/examples/example_win32_directx11/main.cpp similarity index 100% rename from examples/directx11_example/main.cpp rename to examples/example_win32_directx11/main.cpp diff --git a/examples/directx12_example/build_win32.bat b/examples/example_win32_directx12/build_win32.bat similarity index 78% rename from examples/directx12_example/build_win32.bat rename to examples/example_win32_directx12/build_win32.bat index 066e37cbf..2cd7fcdff 100644 --- a/examples/directx12_example/build_win32.bat +++ b/examples/example_win32_directx12/build_win32.bat @@ -1,4 +1,4 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 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/directx12_example.exe /FoDebug/ /link d3d12.lib d3dcompiler.lib dxgi.lib +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/directx12_example/directx12_example.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj similarity index 100% rename from examples/directx12_example/directx12_example.vcxproj rename to examples/example_win32_directx12/example_win32_directx12.vcxproj diff --git a/examples/directx12_example/directx12_example.vcxproj.filters b/examples/example_win32_directx12/example_win32_directx12.vcxproj.filters similarity index 100% rename from examples/directx12_example/directx12_example.vcxproj.filters rename to examples/example_win32_directx12/example_win32_directx12.vcxproj.filters diff --git a/examples/directx12_example/main.cpp b/examples/example_win32_directx12/main.cpp similarity index 100% rename from examples/directx12_example/main.cpp rename to examples/example_win32_directx12/main.cpp diff --git a/examples/directx9_example/build_win32.bat b/examples/example_win32_directx9/build_win32.bat similarity index 69% rename from examples/directx9_example/build_win32.bat rename to examples/example_win32_directx9/build_win32.bat index 767438650..4db27653e 100644 --- a/examples/directx9_example/build_win32.bat +++ b/examples/example_win32_directx9/build_win32.bat @@ -1,3 +1,3 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 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/directx9_example.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib +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/directx9_example/directx9_example.vcxproj b/examples/example_win32_directx9/example_win32_directx9.vcxproj similarity index 99% rename from examples/directx9_example/directx9_example.vcxproj rename to examples/example_win32_directx9/example_win32_directx9.vcxproj index 83d06f603..ebc8a921b 100644 --- a/examples/directx9_example/directx9_example.vcxproj +++ b/examples/example_win32_directx9/example_win32_directx9.vcxproj @@ -20,7 +20,7 @@ {4165A294-21F2-44CA-9B38-E3F935ABADF5} - directx9_example + example_win32_directx9 diff --git a/examples/directx9_example/directx9_example.vcxproj.filters b/examples/example_win32_directx9/example_win32_directx9.vcxproj.filters similarity index 100% rename from examples/directx9_example/directx9_example.vcxproj.filters rename to examples/example_win32_directx9/example_win32_directx9.vcxproj.filters diff --git a/examples/directx9_example/main.cpp b/examples/example_win32_directx9/main.cpp similarity index 100% rename from examples/directx9_example/main.cpp rename to examples/example_win32_directx9/main.cpp diff --git a/examples/imgui_examples.sln b/examples/imgui_examples.sln index 1310b7761..dd27ca131 100644 --- a/examples/imgui_examples.sln +++ b/examples/imgui_examples.sln @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl2_example", "opengl2_example\opengl2_example.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}" +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}") = "directx9_example", "directx9_example\directx9_example.vcxproj", "{4165A294-21F2-44CA-9B38-E3F935ABADF5}" +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}") = "directx11_example", "directx11_example\directx11_example.vcxproj", "{9F316E83-5AE5-4939-A723-305A94F48005}" +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}") = "opengl3_example", "opengl3_example\opengl3_example.vcxproj", "{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}" +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}") = "directx10_example", "directx10_example\directx10_example.vcxproj", "{345A953E-A004-4648-B442-DC5F9F11068C}" +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}") = "sdl_opengl2_example", "sdl_opengl2_example\sdl_opengl2_example.vcxproj", "{2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741}" EndProject diff --git a/examples/imgui_impl_sdl2.cpp b/examples/imgui_impl_sdl.cpp similarity index 98% rename from examples/imgui_impl_sdl2.cpp rename to examples/imgui_impl_sdl.cpp index dcc2e41d1..db4f4d84a 100644 --- a/examples/imgui_impl_sdl2.cpp +++ b/examples/imgui_impl_sdl.cpp @@ -15,8 +15,8 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) // 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface. -// 2018-06-08: Misc: Extracted imgui_impl_sdl2.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples. -// 2018-06-08: Misc: Renamed ImGui_ImplSDL2_Init() to ImGui_ImplSDL2_InitForOpenGL() which now takes the SDL_GLContext parameter. +// 2018-06-08: Misc: Extracted imgui_impl_sdl.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples. +// 2018-06-08: Misc: ImGui_ImplSDL2_InitForOpenGL() now takes a SDL_GLContext parameter. // 2018-05-09: Misc: Fixed clipboard paste memory leak (we didn't call SDL_FreeMemory on the data returned by SDL_GetClipboardText). // 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag. // 2018-02-16: Inputs: Added support for mouse cursors, honoring ImGui::GetMouseCursor() value. @@ -31,7 +31,7 @@ // 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers. #include "imgui.h" -#include "imgui_impl_sdl2.h" +#include "imgui_impl_sdl.h" // SDL // (the multi-viewports feature requires SDL features supported from SDL 2.0.5+) diff --git a/examples/imgui_impl_sdl2.h b/examples/imgui_impl_sdl.h similarity index 100% rename from examples/imgui_impl_sdl2.h rename to examples/imgui_impl_sdl.h diff --git a/examples/sdl_opengl2_example/README.md b/examples/sdl_opengl2_example/README.md deleted file mode 100644 index a1a44a584..000000000 --- a/examples/sdl_opengl2_example/README.md +++ /dev/null @@ -1,22 +0,0 @@ - -# How to Build - -- On Windows with Visual Studio's CLI - -``` -set SDL2DIR=path_to_your_sdl2_folder -cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp imgui_impl_sdl_gl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console -``` - -- On Linux and similar Unixes - -``` -c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl_gl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL -o sdl2example -``` - -- On Mac OS X - -``` -brew install sdl2 -c++ `sdl2-config --cflags` -I ../.. main.cpp imgui_impl_sdl_gl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl -o sdl2example -``` diff --git a/examples/sdl_opengl2_example/build_win32.bat b/examples/sdl_opengl2_example/build_win32.bat deleted file mode 100644 index be0f75a72..000000000 --- a/examples/sdl_opengl2_example/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\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_sdl2.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/sdl_opengl2_example.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console diff --git a/examples/sdl_opengl3_example/README.md b/examples/sdl_opengl3_example/README.md deleted file mode 100644 index a982ff568..000000000 --- a/examples/sdl_opengl3_example/README.md +++ /dev/null @@ -1,22 +0,0 @@ - -# How to Build - -- On Windows with Visual Studio's CLI - -``` -set SDL2DIR=path_to_your_sdl2_folder -cl /Zi /MD /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp imgui_impl_sdl_gl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console -``` - -- On Linux and similar Unixes - -``` -c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp imgui_impl_sdl_gl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl -o sdl2example -``` - -- On Mac OS X - -``` -brew install sdl2 -c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp imgui_impl_sdl_gl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation -o sdl2example -``` diff --git a/examples/sdl_opengl3_example/build_win32.bat b/examples/sdl_opengl3_example/build_win32.bat deleted file mode 100644 index e933a8622..000000000 --- a/examples/sdl_opengl3_example/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\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl3.cpp ..\imgui_impl_sdl2.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/sdl_opengl3_example.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console diff --git a/examples/vulkan_example/build_win32.bat b/examples/vulkan_example/build_win32.bat deleted file mode 100644 index e57893016..000000000 --- a/examples/vulkan_example/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/vulkan_example.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/vulkan_example.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/vulkan_example/build_win64.bat b/examples/vulkan_example/build_win64.bat deleted file mode 100644 index 871370c5a..000000000 --- a/examples/vulkan_example/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/vulkan_example.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/vulkan_example.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/imgui.h b/imgui.h index fd58e9430..9470648c7 100644 --- a/imgui.h +++ b/imgui.h @@ -1725,13 +1725,15 @@ struct ImFontConfig int FontDataSize; // // TTF/OTF data size bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself). int FontNo; // 0 // Index of font within TTF/OTF file - float SizePixels; // // Size in pixels for rasterizer. + float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height). int OversampleH; // 3 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis. int OversampleV; // 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis. bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now. ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input. const ImWchar* GlyphRanges; // NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + float GlyphMinAdvanceX; // 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font + float GlyphMaxAdvanceX; // FLT_MAX // Maximum AdvanceX for glyphs bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. unsigned int RasterizerFlags; // 0x00 // Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one. float RasterizerMultiply; // 1.0f // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. @@ -1814,7 +1816,7 @@ struct ImFontAtlas void SetBit(int n) { UsedChars[n >> 3] |= 1 << (n & 7); } // Set bit 'c' in the array void AddChar(ImWchar c) { SetBit(c); } // Add character IMGUI_API void AddText(const char* text, const char* text_end = NULL); // Add string (each character of the UTF-8 string are added) - IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault) to force add all of ASCII/Latin+Ext + IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext IMGUI_API void BuildRanges(ImVector* out_ranges); // Output new ranges }; diff --git a/imgui_draw.cpp b/imgui_draw.cpp index dc290a209..093b8da63 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1325,6 +1325,8 @@ ImFontConfig::ImFontConfig() GlyphExtraSpacing = ImVec2(0.0f, 0.0f); GlyphOffset = ImVec2(0.0f, 0.0f); GlyphRanges = NULL; + GlyphMinAdvanceX = 0.0f; + GlyphMaxAdvanceX = FLT_MAX; MergeMode = false; RasterizerFlags = 0x00; RasterizerMultiply = 1.0f; @@ -1867,8 +1869,8 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) const float ascent = ImFloor(unscaled_ascent * font_scale + ((unscaled_ascent > 0.0f) ? +1 : -1)); const float descent = ImFloor(unscaled_descent * font_scale + ((unscaled_descent > 0.0f) ? +1 : -1)); ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent); - const float off_x = cfg.GlyphOffset.x; - const float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f); + const float font_off_x = cfg.GlyphOffset.x; + const float font_off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f); for (int i = 0; i < tmp.RangesCount; i++) { @@ -1883,10 +1885,16 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) if (cfg.MergeMode && dst_font->FindGlyphNoFallback((unsigned short)codepoint)) continue; + float char_advance_x_org = pc.xadvance; + float char_advance_x_mod = ImClamp(char_advance_x_org, cfg.GlyphMinAdvanceX, cfg.GlyphMaxAdvanceX); + float char_off_x = font_off_x; + if (char_advance_x_org != char_advance_x_mod) + char_off_x += cfg.PixelSnapH ? (float)(int)((char_advance_x_mod - char_advance_x_org) * 0.5f) : (char_advance_x_mod - char_advance_x_org) * 0.5f; + stbtt_aligned_quad q; float dummy_x = 0.0f, dummy_y = 0.0f; stbtt_GetPackedQuad(range.chardata_for_range, atlas->TexWidth, atlas->TexHeight, char_idx, &dummy_x, &dummy_y, &q, 0); - dst_font->AddGlyph((ImWchar)codepoint, q.x0 + off_x, q.y0 + off_y, q.x1 + off_x, q.y1 + off_y, q.s0, q.t0, q.s1, q.t1, pc.xadvance); + dst_font->AddGlyph((ImWchar)codepoint, q.x0 + char_off_x, q.y0 + font_off_y, q.x1 + char_off_x, q.y1 + font_off_y, q.s0, q.t0, q.s1, q.t1, char_advance_x_mod); } } } diff --git a/misc/fonts/README.txt b/misc/fonts/README.txt index 6209fd7e6..882dd1a15 100644 --- a/misc/fonts/README.txt +++ b/misc/fonts/README.txt @@ -57,6 +57,7 @@ In this document: ImFontConfig config; config.MergeMode = true; + config.GlyphMinAdvanceX = 13.0f; // Use if you want to make the icon monospaced static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; io.Fonts->AddFontFromFileTTF("fonts/fontawesome-webfont.ttf", 13.0f, &config, icon_ranges); diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index f7233bc3a..846594560 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -9,6 +9,7 @@ // - v0.53: (2017/10/22) minor inconsequential change to match change in master (removed an unnecessary statement) // - v0.54: (2018/01/22) fix for addition of ImFontAtlas::TexUvscale member // - v0.55: (2018/02/04) moved to main imgui repository (away from http://www.github.com/ocornut/imgui_club) +// - v0.56: (2018/06/08) added support for ImFontConfig::GlyphMinAdvanceX, GlyphMaxAdvanceX // Gamma Correct Blending: // FreeType assumes blending in linear space rather than gamma space. @@ -324,8 +325,8 @@ bool ImGuiFreeType::BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags) const float ascent = font_face.Info.Ascender; const float descent = font_face.Info.Descender; ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent); - const float off_x = cfg.GlyphOffset.x; - const float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f); + const float font_off_x = cfg.GlyphOffset.x; + const float font_off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f); bool multiply_enabled = (cfg.RasterizerMultiply != 1.0f); unsigned char multiply_table[256]; @@ -356,17 +357,23 @@ bool ImGuiFreeType::BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags) font_face.BlitGlyph(ft_glyph_bitmap, blit_dst, atlas->TexWidth, multiply_enabled ? multiply_table : NULL); FT_Done_Glyph(ft_glyph); + float char_advance_x_org = glyph_info.AdvanceX; + float char_advance_x_mod = ImClamp(char_advance_x_org, cfg.GlyphMinAdvanceX, cfg.GlyphMaxAdvanceX); + float char_off_x = font_off_x; + if (char_advance_x_org != char_advance_x_mod) + char_off_x += cfg.PixelSnapH ? (float)(int)((char_advance_x_mod - char_advance_x_org) * 0.5f) : (char_advance_x_mod - char_advance_x_org) * 0.5f; + // Register glyph dst_font->AddGlyph((ImWchar)codepoint, - glyph_info.OffsetX + off_x, - glyph_info.OffsetY + off_y, - glyph_info.OffsetX + off_x + glyph_info.Width, - glyph_info.OffsetY + off_y + glyph_info.Height, + glyph_info.OffsetX + char_off_x, + glyph_info.OffsetY + font_off_y, + glyph_info.OffsetX + char_off_x + glyph_info.Width, + glyph_info.OffsetY + font_off_y + glyph_info.Height, rect.x / (float)atlas->TexWidth, rect.y / (float)atlas->TexHeight, (rect.x + glyph_info.Width) / (float)atlas->TexWidth, (rect.y + glyph_info.Height) / (float)atlas->TexHeight, - glyph_info.AdvanceX); + char_advance_x_mod); } } }