diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
index 32e7824..52fcbdc 100644
--- a/examples/imgui_impl_dx9.h
+++ b/examples/imgui_impl_dx9.h
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
index 32e7824..52fcbdc 100644
--- a/examples/imgui_impl_dx9.h
+++ b/examples/imgui_impl_dx9.h
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp
new file mode 100644
index 0000000..3c099ec
--- /dev/null
+++ b/examples/imgui_impl_freeglut.cpp
@@ -0,0 +1,188 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and 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)
+// 2018-03-22: Added FreeGLUT Platform binding.
+
+#include "imgui.h"
+#include "imgui_impl_freeglut.h"
+#include
+
+#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_ImplFreeGLUT_Init()
+{
+ ImGuiIO& io = ImGui::GetIO();
+ 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_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_ImplFreeGLUT_InstallFuncs()
+{
+ glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc);
+ glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc);
+ glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc);
+ glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc);
+ glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc);
+ glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc);
+ glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc);
+}
+
+void ImGui_ImplFreeGLUT_Shutdown()
+{
+}
+
+void ImGui_ImplFreeGLUT_NewFrame()
+{
+ // Setup time step
+ ImGuiIO& io = ImGui::GetIO();
+ int current_time = glutGet(GLUT_ELAPSED_TIME);
+ io.DeltaTime = (current_time - g_Time) / 1000.0f;
+ g_Time = current_time;
+
+ // Start the frame
+ ImGui::NewFrame();
+}
+
+static void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_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(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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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;
+}
+
+void ImGui_ImplFreeGLUT_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
+}
+
+void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.DisplaySize = ImVec2((float)w, (float)h);
+}
+
+void ImGui_ImplFreeGLUT_MotionFunc(int x, int y)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.MousePos = ImVec2((float)x, (float)y);
+}
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
index 32e7824..52fcbdc 100644
--- a/examples/imgui_impl_dx9.h
+++ b/examples/imgui_impl_dx9.h
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp
new file mode 100644
index 0000000..3c099ec
--- /dev/null
+++ b/examples/imgui_impl_freeglut.cpp
@@ -0,0 +1,188 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and 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)
+// 2018-03-22: Added FreeGLUT Platform binding.
+
+#include "imgui.h"
+#include "imgui_impl_freeglut.h"
+#include
+
+#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_ImplFreeGLUT_Init()
+{
+ ImGuiIO& io = ImGui::GetIO();
+ 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_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_ImplFreeGLUT_InstallFuncs()
+{
+ glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc);
+ glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc);
+ glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc);
+ glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc);
+ glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc);
+ glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc);
+ glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc);
+}
+
+void ImGui_ImplFreeGLUT_Shutdown()
+{
+}
+
+void ImGui_ImplFreeGLUT_NewFrame()
+{
+ // Setup time step
+ ImGuiIO& io = ImGui::GetIO();
+ int current_time = glutGet(GLUT_ELAPSED_TIME);
+ io.DeltaTime = (current_time - g_Time) / 1000.0f;
+ g_Time = current_time;
+
+ // Start the frame
+ ImGui::NewFrame();
+}
+
+static void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_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(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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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;
+}
+
+void ImGui_ImplFreeGLUT_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
+}
+
+void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.DisplaySize = ImVec2((float)w, (float)h);
+}
+
+void ImGui_ImplFreeGLUT_MotionFunc(int x, int y)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.MousePos = ImVec2((float)x, (float)y);
+}
diff --git a/examples/imgui_impl_freeglut.h b/examples/imgui_impl_freeglut.h
new file mode 100644
index 0000000..d79cd02
--- /dev/null
+++ b/examples/imgui_impl_freeglut.h
@@ -0,0 +1,27 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// https://github.com/ocornut/imgui
+
+IMGUI_API bool ImGui_ImplFreeGLUT_Init();
+IMGUI_API void ImGui_ImplFreeGLUT_InstallFuncs();
+IMGUI_API void ImGui_ImplFreeGLUT_Shutdown();
+IMGUI_API void ImGui_ImplFreeGLUT_NewFrame();
+
+// You can call ImGui_ImplFreeGLUT_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_API void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
index 32e7824..52fcbdc 100644
--- a/examples/imgui_impl_dx9.h
+++ b/examples/imgui_impl_dx9.h
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp
new file mode 100644
index 0000000..3c099ec
--- /dev/null
+++ b/examples/imgui_impl_freeglut.cpp
@@ -0,0 +1,188 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and 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)
+// 2018-03-22: Added FreeGLUT Platform binding.
+
+#include "imgui.h"
+#include "imgui_impl_freeglut.h"
+#include
+
+#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_ImplFreeGLUT_Init()
+{
+ ImGuiIO& io = ImGui::GetIO();
+ 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_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_ImplFreeGLUT_InstallFuncs()
+{
+ glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc);
+ glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc);
+ glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc);
+ glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc);
+ glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc);
+ glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc);
+ glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc);
+}
+
+void ImGui_ImplFreeGLUT_Shutdown()
+{
+}
+
+void ImGui_ImplFreeGLUT_NewFrame()
+{
+ // Setup time step
+ ImGuiIO& io = ImGui::GetIO();
+ int current_time = glutGet(GLUT_ELAPSED_TIME);
+ io.DeltaTime = (current_time - g_Time) / 1000.0f;
+ g_Time = current_time;
+
+ // Start the frame
+ ImGui::NewFrame();
+}
+
+static void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_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(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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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;
+}
+
+void ImGui_ImplFreeGLUT_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
+}
+
+void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.DisplaySize = ImVec2((float)w, (float)h);
+}
+
+void ImGui_ImplFreeGLUT_MotionFunc(int x, int y)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.MousePos = ImVec2((float)x, (float)y);
+}
diff --git a/examples/imgui_impl_freeglut.h b/examples/imgui_impl_freeglut.h
new file mode 100644
index 0000000..d79cd02
--- /dev/null
+++ b/examples/imgui_impl_freeglut.h
@@ -0,0 +1,27 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// https://github.com/ocornut/imgui
+
+IMGUI_API bool ImGui_ImplFreeGLUT_Init();
+IMGUI_API void ImGui_ImplFreeGLUT_InstallFuncs();
+IMGUI_API void ImGui_ImplFreeGLUT_Shutdown();
+IMGUI_API void ImGui_ImplFreeGLUT_NewFrame();
+
+// You can call ImGui_ImplFreeGLUT_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_API void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc
diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp
index 4f0e8f0..48ebb18 100644
--- a/examples/imgui_impl_glfw.cpp
+++ b/examples/imgui_impl_glfw.cpp
@@ -3,8 +3,10 @@
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
-// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Platform: Clipboard support.
+// [X] Platform: Gamepad navigation mapping. 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: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
index 32e7824..52fcbdc 100644
--- a/examples/imgui_impl_dx9.h
+++ b/examples/imgui_impl_dx9.h
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp
new file mode 100644
index 0000000..3c099ec
--- /dev/null
+++ b/examples/imgui_impl_freeglut.cpp
@@ -0,0 +1,188 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and 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)
+// 2018-03-22: Added FreeGLUT Platform binding.
+
+#include "imgui.h"
+#include "imgui_impl_freeglut.h"
+#include
+
+#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_ImplFreeGLUT_Init()
+{
+ ImGuiIO& io = ImGui::GetIO();
+ 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_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_ImplFreeGLUT_InstallFuncs()
+{
+ glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc);
+ glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc);
+ glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc);
+ glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc);
+ glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc);
+ glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc);
+ glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc);
+}
+
+void ImGui_ImplFreeGLUT_Shutdown()
+{
+}
+
+void ImGui_ImplFreeGLUT_NewFrame()
+{
+ // Setup time step
+ ImGuiIO& io = ImGui::GetIO();
+ int current_time = glutGet(GLUT_ELAPSED_TIME);
+ io.DeltaTime = (current_time - g_Time) / 1000.0f;
+ g_Time = current_time;
+
+ // Start the frame
+ ImGui::NewFrame();
+}
+
+static void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_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(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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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;
+}
+
+void ImGui_ImplFreeGLUT_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
+}
+
+void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.DisplaySize = ImVec2((float)w, (float)h);
+}
+
+void ImGui_ImplFreeGLUT_MotionFunc(int x, int y)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.MousePos = ImVec2((float)x, (float)y);
+}
diff --git a/examples/imgui_impl_freeglut.h b/examples/imgui_impl_freeglut.h
new file mode 100644
index 0000000..d79cd02
--- /dev/null
+++ b/examples/imgui_impl_freeglut.h
@@ -0,0 +1,27 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// https://github.com/ocornut/imgui
+
+IMGUI_API bool ImGui_ImplFreeGLUT_Init();
+IMGUI_API void ImGui_ImplFreeGLUT_InstallFuncs();
+IMGUI_API void ImGui_ImplFreeGLUT_Shutdown();
+IMGUI_API void ImGui_ImplFreeGLUT_NewFrame();
+
+// You can call ImGui_ImplFreeGLUT_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_API void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc
diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp
index 4f0e8f0..48ebb18 100644
--- a/examples/imgui_impl_glfw.cpp
+++ b/examples/imgui_impl_glfw.cpp
@@ -3,8 +3,10 @@
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
-// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Platform: Clipboard support.
+// [X] Platform: Gamepad navigation mapping. 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: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h
index 043d14f..2b0dcd4 100644
--- a/examples/imgui_impl_glfw.h
+++ b/examples/imgui_impl_glfw.h
@@ -3,8 +3,10 @@
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
-// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Platform: Clipboard support.
+// [X] Platform: Gamepad navigation mapping. 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: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
index 32e7824..52fcbdc 100644
--- a/examples/imgui_impl_dx9.h
+++ b/examples/imgui_impl_dx9.h
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp
new file mode 100644
index 0000000..3c099ec
--- /dev/null
+++ b/examples/imgui_impl_freeglut.cpp
@@ -0,0 +1,188 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and 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)
+// 2018-03-22: Added FreeGLUT Platform binding.
+
+#include "imgui.h"
+#include "imgui_impl_freeglut.h"
+#include
+
+#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_ImplFreeGLUT_Init()
+{
+ ImGuiIO& io = ImGui::GetIO();
+ 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_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_ImplFreeGLUT_InstallFuncs()
+{
+ glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc);
+ glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc);
+ glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc);
+ glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc);
+ glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc);
+ glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc);
+ glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc);
+}
+
+void ImGui_ImplFreeGLUT_Shutdown()
+{
+}
+
+void ImGui_ImplFreeGLUT_NewFrame()
+{
+ // Setup time step
+ ImGuiIO& io = ImGui::GetIO();
+ int current_time = glutGet(GLUT_ELAPSED_TIME);
+ io.DeltaTime = (current_time - g_Time) / 1000.0f;
+ g_Time = current_time;
+
+ // Start the frame
+ ImGui::NewFrame();
+}
+
+static void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_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(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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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;
+}
+
+void ImGui_ImplFreeGLUT_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
+}
+
+void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.DisplaySize = ImVec2((float)w, (float)h);
+}
+
+void ImGui_ImplFreeGLUT_MotionFunc(int x, int y)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.MousePos = ImVec2((float)x, (float)y);
+}
diff --git a/examples/imgui_impl_freeglut.h b/examples/imgui_impl_freeglut.h
new file mode 100644
index 0000000..d79cd02
--- /dev/null
+++ b/examples/imgui_impl_freeglut.h
@@ -0,0 +1,27 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// https://github.com/ocornut/imgui
+
+IMGUI_API bool ImGui_ImplFreeGLUT_Init();
+IMGUI_API void ImGui_ImplFreeGLUT_InstallFuncs();
+IMGUI_API void ImGui_ImplFreeGLUT_Shutdown();
+IMGUI_API void ImGui_ImplFreeGLUT_NewFrame();
+
+// You can call ImGui_ImplFreeGLUT_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_API void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc
diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp
index 4f0e8f0..48ebb18 100644
--- a/examples/imgui_impl_glfw.cpp
+++ b/examples/imgui_impl_glfw.cpp
@@ -3,8 +3,10 @@
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
-// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Platform: Clipboard support.
+// [X] Platform: Gamepad navigation mapping. 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: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h
index 043d14f..2b0dcd4 100644
--- a/examples/imgui_impl_glfw.h
+++ b/examples/imgui_impl_glfw.h
@@ -3,8 +3,10 @@
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
-// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Platform: Clipboard support.
+// [X] Platform: Gamepad navigation mapping. 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: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_marmalade.cpp b/examples/imgui_impl_marmalade.cpp
index 58c70be..5e60359 100644
--- a/examples/imgui_impl_marmalade.cpp
+++ b/examples/imgui_impl_marmalade.cpp
@@ -1,7 +1,7 @@
// ImGui Renderer + Platform Binding for: Marmalade + IwGx
// Implemented features:
-// [X] User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
int main(int, char**)
diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj
index dc08d18..df5a026 100644
--- a/examples/example_win32_directx10/example_win32_directx10.vcxproj
+++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj
@@ -20,7 +20,7 @@
{345A953E-A004-4648-B442-DC5F9F11068C}
- directx10_example
+ example_win32_directx10
diff --git a/examples/example_win32_directx12/example_win32_directx12.vcxproj b/examples/example_win32_directx12/example_win32_directx12.vcxproj
index f27664e..c82f000 100644
--- a/examples/example_win32_directx12/example_win32_directx12.vcxproj
+++ b/examples/example_win32_directx12/example_win32_directx12.vcxproj
@@ -20,7 +20,7 @@
{b4cf9797-519d-4afe-a8f4-5141a6b521d3}
- directx12_example
+ example_win32_directx1210.0.16299.0
diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp
index 93ae78f..5855b9f 100644
--- a/examples/imgui_impl_allegro5.cpp
+++ b/examples/imgui_impl_allegro5.cpp
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@@ -13,6 +15,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 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-bits 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.
@@ -175,6 +178,10 @@
{
g_Display = display;
+ // Setup back-end capabilities flags
+ ImGuiIO& io = ImGui::GetIO();
+ io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
+
// Create custom vertex declaration.
// Unfortunately Allegro doesn't support 32-bits 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.
@@ -187,7 +194,6 @@
};
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
- ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
@@ -224,7 +230,7 @@
// 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();
+ ImGuiIO& io = ImGui::GetIO();
switch (ev->type)
{
@@ -246,6 +252,34 @@
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;
+ }
+ al_set_system_mouse_cursor(g_Display, cursor_id);
+ }
+}
+
void ImGui_ImplAllegro5_NewFrame()
{
if (!g_Texture)
@@ -288,23 +322,5 @@
io.MouseDown[1] = mouse.buttons & (1 << 1);
io.MouseDown[2] = mouse.buttons & (1 << 2);
- // Hide OS mouse cursor if ImGui is drawing it
- if (io.MouseDrawCursor)
- {
- al_set_mouse_cursor(g_Display, g_MouseCursorInvisible);
- }
- else
- {
- ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT;
- switch (ImGui::GetMouseCursor())
- {
- 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;
- }
- al_set_system_mouse_cursor(g_Display, cursor_id);
- }
+ ImGui_ImplAllegro5_UpdateMouseCursor();
}
diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h
index 9fc2592..fbcd72f 100644
--- a/examples/imgui_impl_allegro5.h
+++ b/examples/imgui_impl_allegro5.h
@@ -2,9 +2,11 @@
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
// Implemented features:
-// [X] User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// Missing features:
-// [ ] Clipboard support via al_set_clipboard_text/al_clipboard_has_text.
+// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
+// Issues:
+// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
+// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp
index 6beeca9..1c232c6 100644
--- a/examples/imgui_impl_dx10.cpp
+++ b/examples/imgui_impl_dx10.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx10.h b/examples/imgui_impl_dx10.h
index 3deacad..9fe791a 100644
--- a/examples/imgui_impl_dx10.h
+++ b/examples/imgui_impl_dx10.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp
index 90ed4dd..d78b63e 100644
--- a/examples/imgui_impl_dx11.cpp
+++ b/examples/imgui_impl_dx11.cpp
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx11.h b/examples/imgui_impl_dx11.h
index 7444570..38d4a50 100644
--- a/examples/imgui_impl_dx11.h
+++ b/examples/imgui_impl_dx11.h
@@ -2,8 +2,8 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
-// [X] Multi-viewport rendering (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.cpp b/examples/imgui_impl_dx12.cpp
index e1cac5c..4ecc774 100644
--- a/examples/imgui_impl_dx12.cpp
+++ b/examples/imgui_impl_dx12.cpp
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx12.h b/examples/imgui_impl_dx12.h
index 0f8eaeb..2af2d59 100644
--- a/examples/imgui_impl_dx12.h
+++ b/examples/imgui_impl_dx12.h
@@ -2,7 +2,7 @@
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
// Implemented features:
-// [X] User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index 9da39b2..267c200 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_dx9.h b/examples/imgui_impl_dx9.h
index 32e7824..52fcbdc 100644
--- a/examples/imgui_impl_dx9.h
+++ b/examples/imgui_impl_dx9.h
@@ -2,7 +2,7 @@
// This needs to be used along with a Platform Binding (e.g. Win32)
// Implemented features:
-// [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp
new file mode 100644
index 0000000..3c099ec
--- /dev/null
+++ b/examples/imgui_impl_freeglut.cpp
@@ -0,0 +1,188 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and 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)
+// 2018-03-22: Added FreeGLUT Platform binding.
+
+#include "imgui.h"
+#include "imgui_impl_freeglut.h"
+#include
+
+#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_ImplFreeGLUT_Init()
+{
+ ImGuiIO& io = ImGui::GetIO();
+ 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_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_ImplFreeGLUT_InstallFuncs()
+{
+ glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc);
+ glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc);
+ glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc);
+ glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc);
+ glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc);
+ glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc);
+ glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc);
+ glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc);
+}
+
+void ImGui_ImplFreeGLUT_Shutdown()
+{
+}
+
+void ImGui_ImplFreeGLUT_NewFrame()
+{
+ // Setup time step
+ ImGuiIO& io = ImGui::GetIO();
+ int current_time = glutGet(GLUT_ELAPSED_TIME);
+ io.DeltaTime = (current_time - g_Time) / 1000.0f;
+ g_Time = current_time;
+
+ // Start the frame
+ ImGui::NewFrame();
+}
+
+static void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_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(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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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_ImplFreeGLUT_UpdateKeyboardMods();
+ (void)x; (void)y; // Unused
+}
+
+void ImGui_ImplFreeGLUT_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;
+}
+
+void ImGui_ImplFreeGLUT_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
+}
+
+void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.DisplaySize = ImVec2((float)w, (float)h);
+}
+
+void ImGui_ImplFreeGLUT_MotionFunc(int x, int y)
+{
+ ImGuiIO& io = ImGui::GetIO();
+ io.MousePos = ImVec2((float)x, (float)y);
+}
diff --git a/examples/imgui_impl_freeglut.h b/examples/imgui_impl_freeglut.h
new file mode 100644
index 0000000..d79cd02
--- /dev/null
+++ b/examples/imgui_impl_freeglut.h
@@ -0,0 +1,27 @@
+// ImGui Platform Binding for: FreeGLUT
+// This needs to be used along with a Renderer (e.g. OpenGL2)
+
+// Issues:
+// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
+
+// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
+// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// https://github.com/ocornut/imgui
+
+IMGUI_API bool ImGui_ImplFreeGLUT_Init();
+IMGUI_API void ImGui_ImplFreeGLUT_InstallFuncs();
+IMGUI_API void ImGui_ImplFreeGLUT_Shutdown();
+IMGUI_API void ImGui_ImplFreeGLUT_NewFrame();
+
+// You can call ImGui_ImplFreeGLUT_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_API void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc
+IMGUI_API void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc
+IMGUI_API void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc
diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp
index 4f0e8f0..48ebb18 100644
--- a/examples/imgui_impl_glfw.cpp
+++ b/examples/imgui_impl_glfw.cpp
@@ -3,8 +3,10 @@
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
-// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Platform: Clipboard support.
+// [X] Platform: Gamepad navigation mapping. 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: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h
index 043d14f..2b0dcd4 100644
--- a/examples/imgui_impl_glfw.h
+++ b/examples/imgui_impl_glfw.h
@@ -3,8 +3,10 @@
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
-// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
-// [X] Multi-viewport windows (when ImGuiConfigFlags_ViewportsEnable is enabled).
+// [X] Platform: Clipboard support.
+// [X] Platform: Gamepad navigation mapping. 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: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_marmalade.cpp b/examples/imgui_impl_marmalade.cpp
index 58c70be..5e60359 100644
--- a/examples/imgui_impl_marmalade.cpp
+++ b/examples/imgui_impl_marmalade.cpp
@@ -1,7 +1,7 @@
// ImGui Renderer + Platform Binding for: Marmalade + IwGx
// Implemented features:
-// [X] User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/examples/imgui_impl_marmalade.h b/examples/imgui_impl_marmalade.h
index 884ea9e..d8e98d5 100644
--- a/examples/imgui_impl_marmalade.h
+++ b/examples/imgui_impl_marmalade.h
@@ -1,7 +1,7 @@
// ImGui Renderer + Platform Binding for: Marmalade + IwGx
// Implemented features:
-// [X] User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
+// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
diff --git a/.travis.yml b/.travis.yml
index f4de9ec..5bea91c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@
fi
script:
- - make -C examples/opengl2_example
- - make -C examples/opengl3_example
- - make -C examples/sdl_opengl3_example
+ - make -C examples/example_glfw_opengl2
+ - make -C examples/example_glfw_opengl3
+ - make -C examples/example_sdl_opengl3
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1141dae..5e6839b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -57,26 +57,30 @@
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.
+ easy update path to support multi-viewports later (for future ImGui 1.7x).
- 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)
+ - Read examples/README.txt for details.
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
+ - Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
- BeginDragDropSource(): Offset tooltip position so it is off the mouse cursor, but also closer to it than regular tooltips, and not clamped by viewport. (#1739)
- BeginDragDropTarget(): Added ImGuiDragDropFlags_AcceptNoPreviewTooltip flag to request hiding the drag source tooltip from the target site. (#143)
- BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): Temporary style modification are restored at the end of BeginXXX instead of EndXXX, to not affect tooltips and child windows.
- - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not fully close/re-open the popup so its child popups won't get closed. (#1497, #1533, #1865).
+ - Popup: Improved handling of (erroneously) repeating calls to OpenPopup() to not close the popup's child popups. (#1497, #1533, #1865).
- 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).
+ - InputText(): Fixed Undo corruption 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]
+ - Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
+ - Examples: Added SDL+Vulkan example.
+ - Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag.
+ - Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (#801)
- Misc: Updated stb_textedit from 1.09 + patches to 1.12 + minor patches.
- Internals: PushItemFlag() flags are inherited by BeginChild().
diff --git a/TODO.txt b/TODO.txt
index 074ac3c..df370eb 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -295,7 +295,6 @@
- misc: imgui_cpp: perhaps a misc/ header file with more friendly helper (e.g. type-infer versions of DragScalar, vector<> variants if appropriate for some functions).
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
- - backend: freeglut (#801, #795)
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
diff --git a/examples/README.txt b/examples/README.txt
index e672a72..fe8fc23 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -33,20 +33,14 @@
MISC COMMENTS AND SUGGESTIONS
---------------------------------------
- - Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
-
- - Please read the comments and instruction at the top of each file.
-
+ - Please read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup Dear ImGui in your codebase.
+ Please read the comments and instruction at the top of each file.
+
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
to your project and use them unmodified. Each imgui_impl_xxxx.cpp comes with its own individual
ChangeLog at the top of the .cpp files, so if you want to update them later it will be easier to
catch up with what changed.
- - To LEARN how to setup imgui, you may refer to 'opengl2_example/' because is the simplest one to read.
- However, do NOT USE the OpenGL2 renderer if your code is using any modern GL3+ calls.
- Mixing old fixed-pipeline OpenGL2 and modern OpenGL3+ is going to make everything more complicated.
- Read comments below for details. If you are not sure, in doubt, use the OpenGL3 renderer.
-
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
However, consider that OS mouse cursors are typically drawn through a specific hardware accelerated path
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
@@ -55,8 +49,8 @@
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
cursor only when an interactive drag is in progress.
Note that some setup or GPU drivers are likely to be causing extra lag depending on their settings.
- If you are not sure who to blame if you feeling that dragging something is laggy, try to build an
- application drawing a shape directly under the mouse cursor.
+ If you feel that dragging windows feels laggy and you are not sure who to blame: try to build an
+ application drawing a shape directly under the mouse cursor.
---------------------------------------
@@ -72,7 +66,7 @@
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- The example _applications_ usually combine 1 platform + 1 renderer binding to create a working program.
- Examples: the directx11_example/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
+ Examples: the example_win32_directx11/ application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp.
- Some bindings for higher level frameworks carry both "Platform" and "Renderer" parts in one file.
This is the case for Allegro 5 (imgui_impl_allegro5.cpp), Marmalade (imgui_impl_marmalade5.cpp).
@@ -83,8 +77,8 @@
imgui_impl_xxxx files to fit under your coding style, consider that it is not necessary!
In fact, if you are new to Dear ImGui, rewriting them will almost always be harder.
- Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering system
- layered over DirectX11.
+ Example: your engine is built over Windows + DirectX11 but you have your own high-level rendering
+ system layered over DirectX11.
Suggestion: step 1: try using imgui_impl_win32.cpp + imgui_impl_dx11.cpp first.
Once this work, _if_ you want you can replace the imgui_impl_dx11.cpp code with a custom renderer
using your own functions, etc.
@@ -103,27 +97,28 @@
integration. It is also much more complicated and require more work to integrate correctly.
If you are new to imgui and you are trying to integrate it into your application, first try to ignore
everything related to Viewport and Platform Windows. You'll be able to come back to it later!
- Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit from
- improvements and fixes related to viewports and platform windows without extra work on your side.
+ Note that if you decide to use unmodified imgui_impl_xxxx.cpp files, you will automatically benefit
+ from improvements and fixes related to viewports and platform windows without extra work on your side.
See 'ImGuiPlatformIO' for details.
-List of officially maintained Platforms Bindings:
+List of Platforms Bindings in this repository:
- imgui_impl_glfw.cpp
- imgui_impl_sdl.cpp
- imgui_impl_win32.cpp
+ imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/
+ imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org
+ imgui_impl_win32.cpp ; Windows native API (Windows)
+ imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's)
-List of officially maintained Renderer Bindings:
+List of Renderer Bindings in this repository:
- imgui_impl_dx9.cpp
- imgui_impl_dx10.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx12.cpp
- imgui_impl_opengl2.cpp
- imgui_impl_opengl3.cpp
- imgui_impl_vulkan.cpp
+ imgui_impl_dx9.cpp ; DirectX9
+ imgui_impl_dx10.cpp ; DirectX10
+ imgui_impl_dx11.cpp ; DirectX11
+ imgui_impl_dx12.cpp ; DirectX12
+ imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
+ imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
+ imgui_impl_vulkan.cpp ; Vulkan
-List of officially maintained high-level Frameworks Bindings (combine Platform + Renderer)
+List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
imgui_impl_allegro5.cpp
imgui_impl_marmalade.cpp
@@ -133,7 +128,7 @@
https://github.com/ocornut/imgui/wiki/Links
Languages: C, C#, ChaiScript, D, Go, Haxe, Java, Lua, Odin, Pascal, PureBasic, Python, Rust, Swift...
- Frameworks: FreeGlut, Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
+ Frameworks: Cinder, Cocos2d-x, Emscripten, SFML, GML/GameMaker Studio, Irrlicht, Ogre,
OpenSceneGraph, openFrameworks, LOVE, NanoRT, Nim Game Lib, Qt3d, SFML, Unreal Engine 4...
Miscellaneous: Software Renderer, RemoteImgui, etc.
@@ -216,7 +211,7 @@
example_apple/
OSX & iOS example + OpenGL2.
THIS EXAMPLE HAS NOT BEEN MAINTAINED PROPERLY AND NEEDS A MAINTAINER.
- Consider using the opengl3_example/ instead.
+ Consider using the example_glfw_opengl3/ instead.
On iOS, Using Synergy to access keyboard/mouse data from server computer.
Synergy keyboard integration is rather hacky.
@@ -224,6 +219,10 @@
Allegro 5 example.
= main.cpp + imgui_impl_allegro5.cpp
+example_freeglut_opengl2/
+ FreeGLUT + OpenGL2.
+ = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp
+
example_marmalade/
Marmalade example using IwGx.
= main.cpp + imgui_impl_marmalade.cpp
diff --git a/examples/example_apple/README.md b/examples/example_apple/README.md
index d414d13..c2c8348 100644
--- a/examples/example_apple/README.md
+++ b/examples/example_apple/README.md
@@ -6,7 +6,7 @@
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.
+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 code in example_glfw_opengl3/ should also work on OS X and is much simpler.** This is an integration for iOS with Synergy.
Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.
diff --git a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
index 20ee14b..df2df27 100644
--- a/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
+++ b/examples/example_apple/imguiex-ios/imgui_impl_ios.mm
@@ -610,7 +610,7 @@
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
-// NOTE: this is copied pretty much entirely from the opengl3_example, with only minor changes for ES
+// NOTE: this is copied pretty much entirely from the example_glfw_opengl3, with only minor changes for ES
static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
new file mode 100644
index 0000000..0c60ba3
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj
@@ -0,0 +1,174 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {F90D0333-5FB1-440D-918D-DD39A1B5187E}
+ example_freeglut_opengl2
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(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_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
new file mode 100644
index 0000000..b459194
--- /dev/null
+++ b/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ {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
+
+
+ sources
+
+
+ sources
+
+
+
+
+
+ sources
+
+
+
\ No newline at end of file
diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_freeglut_opengl2/main.cpp
new file mode 100644
index 0000000..b5f2b99
--- /dev/null
+++ b/examples/example_freeglut_opengl2/main.cpp
@@ -0,0 +1,133 @@
+// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
+// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
+// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
+
+#include "imgui.h"
+#include "../imgui_impl_freeglut.h"
+#include "../imgui_impl_opengl2.h"
+#include
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4505) // unreferenced local function has been removed
+#endif
+
+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 a simple window.
+ // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
+ {
+ static float f = 0.0f;
+ static int counter = 0;
+ ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
+ 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
+
+ ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state
+ ImGui::Checkbox("Another Window", &show_another_window);
+
+ if (ImGui::Button("Button")) // Buttons return true when clicked (NB: 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);
+ }
+
+ // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
+ if (show_another_window)
+ {
+ ImGui::Begin("Another Window", &show_another_window);
+ ImGui::Text("Hello from another window!");
+ if (ImGui::Button("Close Me"))
+ show_another_window = false;
+ ImGui::End();
+ }
+
+ // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
+ if (show_demo_window)
+ {
+ ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
+ ImGui::ShowDemoWindow(&show_demo_window);
+ }
+}
+
+void glut_display_func()
+{
+ ImGui_ImplOpenGL2_NewFrame();
+ ImGui_ImplFreeGLUT_NewFrame();
+
+ my_display_code();
+
+ 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);
+ glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);
+ glutInitWindowSize(1280, 720);
+ glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example");
+
+ // Setup GLUT display function
+ // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us,
+ // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
+ glutDisplayFunc(glut_display_func);
+
+ // Setup ImGui binding
+ ImGui::CreateContext();
+ ImGuiIO& io = ImGui::GetIO(); (void)io;
+ //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
+
+ ImGui_ImplFreeGLUT_Init();
+ ImGui_ImplFreeGLUT_InstallFuncs();
+ ImGui_ImplOpenGL2_Init();
+
+ // 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 'misc/fonts/README.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);
+
+ glutMainLoop();
+
+ // Cleanup
+ ImGui_ImplOpenGL2_Shutdown();
+ ImGui_ImplFreeGLUT_Shutdown();
+ ImGui::DestroyContext();
+
+ return 0;
+}
diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp
index ada10a0..6c384d3 100644
--- a/examples/example_glfw_opengl2/main.cpp
+++ b/examples/example_glfw_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 opengl3_example/ folder**
+// **Prefer using the code in the example_glfw_opengl2/ folder**
// See imgui_impl_glfw.cpp for details.
#include "imgui.h"
diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp
index 06414b0..dce39eb 100644
--- a/examples/example_glfw_opengl3/main.cpp
+++ b/examples/example_glfw_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_glfw.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.
+#include // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
+//#include
#include
static void glfw_error_callback(int error, const char* description)
diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl_opengl2/main.cpp
index 5a4dbd4..441e75a 100644
--- a/examples/example_sdl_opengl2/main.cpp
+++ b/examples/example_sdl_opengl2/main.cpp
@@ -3,7 +3,7 @@
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan 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 sdl_opengl3_example/ folder**
+// **Prefer using the code in the example_sdl_opengl3/ folder**
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp
index cdb7fce..05492d9 100644
--- a/examples/example_sdl_opengl3/main.cpp
+++ b/examples/example_sdl_opengl3/main.cpp
@@ -7,7 +7,8 @@
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
#include
-#include