mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-15 17:23:13 +02:00
Compare commits
89 Commits
Author | SHA1 | Date | |
---|---|---|---|
da3c4330c1 | |||
c00a3bd98f | |||
a5cf227503 | |||
be66f94639 | |||
cc4b1f9e47 | |||
b9ae9bb1e3 | |||
50c43d1c8e | |||
6b4443755d | |||
aa668c410a | |||
f52f0a5277 | |||
19b4fcdacb | |||
5b1394c5ac | |||
6c1ae6cc71 | |||
6d7677534f | |||
772354377b | |||
9d155c73bc | |||
a419d46205 | |||
131bf5ee4a | |||
f388216ff0 | |||
c808eb92c6 | |||
eb592bf7d3 | |||
1441756a0f | |||
2e6e1bec58 | |||
ed0f7004d0 | |||
7fa3e71abb | |||
e6db078eda | |||
f3e642322f | |||
eed1fba157 | |||
faecf90383 | |||
12c72d2893 | |||
a72d5ada61 | |||
ac9aaf4b6e | |||
e610afeea3 | |||
82873c7ad4 | |||
745f01022e | |||
31fd6c585a | |||
b4488d4f48 | |||
000c1fc221 | |||
5be915d6ab | |||
90b50bd4c3 | |||
8606d9fa11 | |||
b039dbc62e | |||
edb06a6c4d | |||
ca753829cb | |||
28953208d4 | |||
ede3a3b92d | |||
9cf94d5dd6 | |||
0fe48cbb61 | |||
74c0309126 | |||
ed4dcd9072 | |||
cf0afb48ac | |||
d02b11dfbd | |||
1efafa1d29 | |||
3fcc178c23 | |||
dd748f0e39 | |||
500a60debc | |||
02afbaeef0 | |||
a3b0e0acfa | |||
084c26aa41 | |||
3c427e284f | |||
fbfe193fcd | |||
ae7f833c69 | |||
76e31bd51a | |||
e623be998d | |||
3dcd552628 | |||
9aae21483a | |||
61d94ff88e | |||
a7d3ae8937 | |||
781a7950d7 | |||
788febf044 | |||
5719b23e01 | |||
7c3b9172ad | |||
3d318a6577 | |||
0b190f11b9 | |||
571676ebd2 | |||
4b353ce482 | |||
c12da2a607 | |||
ca5dc0c019 | |||
1afd29d382 | |||
ec04e8bb05 | |||
9cc63ba279 | |||
201fcfd2e5 | |||
d014d0285a | |||
af6cf25255 | |||
e2436ca625 | |||
7eadcf7d7d | |||
062b1f0463 | |||
2eaf722fd7 | |||
eb7033e75b |
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
@ -18,7 +18,7 @@ You may use the Issue Tracker to submit bug reports, feature requests or suggest
|
|||||||
**Guidelines to report an issue or ask a question:**
|
**Guidelines to report an issue or ask a question:**
|
||||||
- Please provide your imgui version number.
|
- Please provide your imgui version number.
|
||||||
- Please state if you have made substantial modifications to your copy of imgui.
|
- Please state if you have made substantial modifications to your copy of imgui.
|
||||||
- Try to be explicit with your expectations and what you have tried. What you have in mind or in your code is not obvious to other people.
|
- Try to be explicit with your Goals, your Expectations and what you have Tried. What you have in mind or in your code is not obvious to other people. People frequently discuss problems without first mentioning their goal.
|
||||||
- If you are discussing an assert or a crash, please provide a debugger callstack. Never state "it crashes" without additional information. If you don't know how to use a debugger and retrieve a callstack, learning about it will be useful.
|
- If you are discussing an assert or a crash, please provide a debugger callstack. Never state "it crashes" without additional information. If you don't know how to use a debugger and retrieve a callstack, learning about it will be useful.
|
||||||
- Please make sure that your compilation settings have asserts enabled. Calls to IM_ASSERT() are scattered in the code to help catch common issues. By default IM_ASSERT() calls the standard assert() function. To verify that your asserts are enabled, add the line `IM_ASSERT(false);` in your main() function. Your application should display an error message and abort. If your application report an error, it means that your asserts are disabled. Please make sure they are enabled.
|
- Please make sure that your compilation settings have asserts enabled. Calls to IM_ASSERT() are scattered in the code to help catch common issues. By default IM_ASSERT() calls the standard assert() function. To verify that your asserts are enabled, add the line `IM_ASSERT(false);` in your main() function. Your application should display an error message and abort. If your application report an error, it means that your asserts are disabled. Please make sure they are enabled.
|
||||||
- When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of the example back-ends (imgui_impl_XXX files), or a modified one, or if you built your own.
|
- When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of the example back-ends (imgui_impl_XXX files), or a modified one, or if you built your own.
|
||||||
@ -27,10 +27,10 @@ You may use the Issue Tracker to submit bug reports, feature requests or suggest
|
|||||||
- When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
- When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||||
|
|
||||||
**Some unfortunate words of warning**
|
**Some unfortunate words of warning**
|
||||||
- If you are or were involved in cheating schemes (e.g. DLL injection) for competitive online multi-player games, please don't post here. We won't answer and you will be blocked. We've had too many of you. Please stop.
|
- If you are or were involved in cheating schemes (e.g. DLL injection) for competitive online multi-player games, please don't post here. We won't answer and you will be blocked. We've had too many of you.
|
||||||
- Due to frequent abuse of this service from aforementioned users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and incomplete questions may be dismissed.
|
- Due to frequent abuse of this service from aforementioned users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and incomplete questions may be dismissed.
|
||||||
|
|
||||||
If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users or members of the community will know what information are useful in a given context.
|
If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users or members of the community will know which information are useful in a given context.
|
||||||
|
|
||||||
## How to create an Pull Request
|
## How to create an Pull Request
|
||||||
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||||
|
14
.github/issue_template.md
vendored
14
.github/issue_template.md
vendored
@ -1,13 +1,13 @@
|
|||||||
IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS, please post on the "Getting Started" Discourse forum:
|
(Click "Preview" to turn any http URL into a clickable link)
|
||||||
|
|
||||||
|
1. IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS, please post on the "Getting Started" Discourse forum:
|
||||||
https://discourse.dearimgui.org/c/getting-started
|
https://discourse.dearimgui.org/c/getting-started
|
||||||
|
|
||||||
Otherwise, you may use this Issue Tracker to ask for help and submit bug reports, feature requests or suggestions. PLEASE CAREFULLY READ THIS DOCUMENT before submitting any issue:
|
2. You may use this Issue Tracker to ask for help and submit bug reports, feature requests or suggestions that don't fit in any category of (1). PLEASE CAREFULLY READ THE CONTRIBUTING DOCUMENT before submitting any issue: https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
||||||
https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
|
||||||
(Click "Preview" to turn the URL above into a clickable link)
|
|
||||||
|
|
||||||
PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of ShowDemoWindow() including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the CONTRIBUTING.md file linked above.
|
3. PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of ShowDemoWindow() including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the CONTRIBUTING.md file linked above.
|
||||||
|
|
||||||
(Delete everything above this section before submitting your issue.)
|
4. Delete points 1-4 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue.
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -23,6 +23,8 @@ Compiler: XXX _(if the question is related to building)_
|
|||||||
|
|
||||||
**My Issue/Question:** _(please provide context)_
|
**My Issue/Question:** _(please provide context)_
|
||||||
|
|
||||||
|
XXX
|
||||||
|
|
||||||
**Standalone, minimal, complete and verifiable example:** _(see CONTRIBUTING.md)_
|
**Standalone, minimal, complete and verifiable example:** _(see CONTRIBUTING.md)_
|
||||||
```
|
```
|
||||||
ImGui::Begin("Example Bug");
|
ImGui::Begin("Example Bug");
|
||||||
|
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@ -1,8 +1,8 @@
|
|||||||
- Please read https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
- Please read https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
||||||
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||||
- When fixing a warning or compilation problem, please post the compiler log and specify the version and OS you are using.
|
- When adding a feature, try to attach screenshots/gifs to clarify the context and demonstrate the feature at a glance.
|
||||||
- Try to attach screenshots to clarify the context and demonstrate the feature at a glance.
|
- When fixing a warning or compilation problem, post the compiler log and specify the version and OS you are using.
|
||||||
- Make sure your code follows the coding style already used in imgui (4 spaces instead of tabs, "type* name", "local_variable", "FunctionName", "MemberName", etc.). We don't use modern C++ idioms and can compile without C++11.
|
- Make sure your code follows the coding style already used in the codebase (4 spaces identation, no tabs, `type* name`, `local_variable`, `FunctionName()`, `MemberName`, `// Text Comment`, `//CodeComment()`, etc.). We don't use modern C++ idioms, we don't use C++ style cast, we don't use C++ headers, and we can compile without a C++11 compatible compiler.
|
||||||
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR.
|
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR.
|
||||||
|
|
||||||
(Clear this form before submitting your PR)
|
(Clear this form before submitting your PR)
|
||||||
|
@ -29,6 +29,65 @@ HOW TO UPDATE?
|
|||||||
- Please report any issue!
|
- Please report any issue!
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
VERSION 1.66 (Released 2018-11-22)
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete).
|
||||||
|
- Renamed misc/stl/imgui_stl.* to misc/cpp/imgui_stdlib.* in prevision for other C++ helper files. (#2035, #2096)
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- Fixed calling SetNextWindowSize()/SetWindowSize() with non-integer values leading to
|
||||||
|
accidental alteration of window position. We now round the provided size. (#2067)
|
||||||
|
- Fixed calling DestroyContext() always saving .ini data with the current context instead
|
||||||
|
of the supplied context pointer. (#2066)
|
||||||
|
- Nav, Focus: Fixed ImGuiWindowFlags_NoBringToFrontOnFocus windows not being restoring focus
|
||||||
|
properly after the main menu bar or last focused window is deactivated.
|
||||||
|
- Nav: Fixed an assert in certain circumstance (mostly when using popups) when mouse positions stop being valid. (#2168)
|
||||||
|
- Nav: Fixed explicit directional input not re-highlighting current nav item if there is a single item in the window
|
||||||
|
and highlight has been previously disabled by the mouse. (#787)
|
||||||
|
- DragFloat: Fixed a situation where dragging with value rounding enabled or with a power curve
|
||||||
|
erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075).
|
||||||
|
- DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024)
|
||||||
|
- DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024)
|
||||||
|
- SliderAngle: Added optional format argument to alter precision or localize the string. (#2150) [@podsvirov]
|
||||||
|
- Window: Resizing from edges (with io.ConfigResizeWindowsFromEdges Beta flag) extends the hit region
|
||||||
|
of root floating windows outside the window, making it easier to resize windows. Resize grips are also
|
||||||
|
extended accordingly so there are no discontinuity when hovering between borders and corners. (#1495, #822)
|
||||||
|
- Window: Added ImGuiWindowFlags_NoBackground flag to avoid rendering window background. This is mostly to allow
|
||||||
|
the creation of new flag combinations, as we could already use SetNextWindowBgAlpha(0.0f). (#1660) [@biojppm, @ocornut]
|
||||||
|
- Window: Added ImGuiWindowFlags_NoDecoration helper flag which is essentially NoTitleBar+NoResize+NoScrollbar+NoCollapse.
|
||||||
|
- Window: Added ImGuiWindowFlags_NoMouseInputs which is basically the old ImGuiWindowFlags_NoInputs (essentially
|
||||||
|
we have renamed ImGuiWindowFlags_NoInputs to ImGuiWindowFlags_NoMouseInputs). Made the new ImGuiWindowFlags_NoInputs
|
||||||
|
encompass both NoMouseInputs+NoNav, which is consistent with its description. (#1660, #787)
|
||||||
|
- Window, Inputs: Fixed resizing from edges when io.MousePos is not pixel-rounded by rounding mouse position input. (#2110)
|
||||||
|
- BeginChild(): Fixed BeginChild(const char*, ...) variation erroneously not applying the ID stack
|
||||||
|
to the provided string to uniquely identify the child window. This was undoing an intentional change
|
||||||
|
introduced in 1.50 and broken in 1.60. (#1698, #894, #713).
|
||||||
|
- TextUnformatted(): Fixed a case where large-text path would read bytes past the text_end marker depending
|
||||||
|
on the position of new lines in the buffer (it wasn't affecting the output but still not the right thing to do!)
|
||||||
|
- ListBox(): Fixed frame sizing when items_count==1 unnecessarily showing a scrollbar. (#2173) [@luk1337, @ocornut]
|
||||||
|
- ListBox(): Tweaked frame sizing so list boxes will look more consistent when FramePadding is far from ItemSpacing.
|
||||||
|
- RenderText(): Some optimization for very large text buffers, useful for non-optimized builds.
|
||||||
|
- BeginMenu(): Fixed menu popup horizontal offset being off the item in the menu bar when WindowPadding=0.0f.
|
||||||
|
- ArrowButton(): Fixed arrow shape being horizontally misaligned by (FramePadding.y-FramePadding.x) if they are different.
|
||||||
|
- Demo: Split the contents of ShowDemoWindow() into smaller functions as it appears to speed up link time with VS. (#2152)
|
||||||
|
- Drag and Drop: Added GetDragDropPayload() to peek directly into the payload (if any) from anywhere. (#143)
|
||||||
|
- ImGuiTextBuffer: Avoid heap allocation when empty.
|
||||||
|
- ImDrawList: Fixed AddConvexPolyFilled() undefined behavior when passing points_count smaller than 3,
|
||||||
|
in particular, points_count==0 could lead to a memory stomp if the draw list was previously empty.
|
||||||
|
- Examples: DirectX10, DirectX11: Removed seemingly unnecessary calls to invalidate and recreate device objects
|
||||||
|
in the WM_SIZE handler. (#2088) [@ice1000]
|
||||||
|
- Examples: GLFW: User previously installed GLFW callbacks are now saved and chain-called by the default callbacks. (#1759)
|
||||||
|
- Examples: OpenGL3: Added support for GL 4.5's glClipControl(GL_UPPER_LEFT). (#2186)
|
||||||
|
- Examples: OpenGL3+GLFW: Fixed error condition when using the GLAD loader. (#2157) [@blackball]
|
||||||
|
- Examples: OpenGL3+GLFW/SDL: Made main.cpp compile with IMGUI_IMPL_OPENGL_LOADER_CUSTOM (may be missing init). (#2178) [@doug-moen]
|
||||||
|
- Examples: SDL2+Vulkan: Fixed application shutdown which could deadlock on Linux + Xorg. (#2181) [@eRabbit0]
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
VERSION 1.65 (Released 2018-09-06)
|
VERSION 1.65 (Released 2018-09-06)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -50,7 +109,7 @@ Other Changes:
|
|||||||
Although it is not perfect and will keep being improved, it is fairly functional and used by many. (#787)
|
Although it is not perfect and will keep being improved, it is fairly functional and used by many. (#787)
|
||||||
- Fixed a build issue with non-Cygwin GCC under Windows.
|
- Fixed a build issue with non-Cygwin GCC under Windows.
|
||||||
- Demo: Added a "Configuration" block to make io.ConfigFlags/io.BackendFlags more prominent.
|
- Demo: Added a "Configuration" block to make io.ConfigFlags/io.BackendFlags more prominent.
|
||||||
- Examples: OpenGL3: Fixed error condition when using the GLAD loader. (#2059, #2002). [@jiri]
|
- Examples: OpenGL3+SDL2: Fixed error condition when using the GLAD loader. (#2059, #2002) [@jiri]
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -123,6 +182,7 @@ Other Changes:
|
|||||||
- Selectable: Added ImGuiSelectableFlags_Disabled flag in the public API. (#211)
|
- Selectable: Added ImGuiSelectableFlags_Disabled flag in the public API. (#211)
|
||||||
- ColorEdit4: Fixed a bug when text input or drag and drop leading to unsaturated HSV values would erroneously alter the resulting color. (#2050)
|
- ColorEdit4: Fixed a bug when text input or drag and drop leading to unsaturated HSV values would erroneously alter the resulting color. (#2050)
|
||||||
- Misc: Added optional misc/stl/imgui_stl.h wrapper to use with STL types (e.g. InputText with std::string). (#2006, #1443, #1008)
|
- Misc: Added optional misc/stl/imgui_stl.h wrapper to use with STL types (e.g. InputText with std::string). (#2006, #1443, #1008)
|
||||||
|
[*EDIT* renamed to misc/std/imgui_stdlib.h in 1.66]
|
||||||
- Misc: Added IMGUI_VERSION_NUM for easy compile-time testing. (#2025)
|
- Misc: Added IMGUI_VERSION_NUM for easy compile-time testing. (#2025)
|
||||||
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
|
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
|
||||||
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
|
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
|
||||||
@ -194,7 +254,7 @@ Other Changes:
|
|||||||
- Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well.
|
- Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well.
|
||||||
- Read examples/README.txt for details.
|
- Read examples/README.txt for details.
|
||||||
- Added IsItemDeactivated() to query if the last item was active previously and isn't anymore. Useful for Undo/Redo patterns. (#820, #956, #1875)
|
- Added IsItemDeactivated() to query if the last item was active previously and isn't anymore. Useful for Undo/Redo patterns. (#820, #956, #1875)
|
||||||
- Added IsItemDeactivatedAfterChange() [*EDIT* renamed to IsItemDeactivatedAfterEdit() in 1.63) if the last item was active previously,
|
- Added IsItemDeactivatedAfterChange() [*EDIT* renamed to IsItemDeactivatedAfterEdit() in 1.63] if the last item was active previously,
|
||||||
is not anymore, and during its active state modified a value. Note that you may still get false positive (e.g. drag value and while
|
is not anymore, and during its active state modified a value. Note that you may still get false positive (e.g. drag value and while
|
||||||
holding return on the same value). (#820, #956, #1875)
|
holding return on the same value). (#820, #956, #1875)
|
||||||
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
|
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
|
||||||
@ -314,6 +374,9 @@ Breaking Changes:
|
|||||||
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
||||||
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
||||||
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it should be easy to replicate on your side (you can find the code in 1.53).
|
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it should be easy to replicate on your side (you can find the code in 1.53).
|
||||||
|
- [EDITED] Window: BeginChild() with an explicit name doesn't include the hash within the internal window name. (#1698)
|
||||||
|
This change was erroneously introduced, undoing the change done for #894, #713, and not documented properly in the original
|
||||||
|
1.60 release Changelog. It was fixed on 2018-09-28 (1.66) and I wrote this paragraph the same day.
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
@ -522,7 +585,6 @@ Other Changes:
|
|||||||
- Window: Using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. (#1380, #1502)
|
- Window: Using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. (#1380, #1502)
|
||||||
- Window: Active Modal window always set the WantCaptureKeyboard flag. (#744)
|
- Window: Active Modal window always set the WantCaptureKeyboard flag. (#744)
|
||||||
- Window: Moving window doesn't use accumulating MouseDelta so straying out of imgui boundaries keeps moved imgui window at the same cursor-relative position.
|
- Window: Moving window doesn't use accumulating MouseDelta so straying out of imgui boundaries keeps moved imgui window at the same cursor-relative position.
|
||||||
- Window: BeginChild() which an explicit name doesn't include the hash within the internal window name. (#1698)
|
|
||||||
- IsWindowFocused(): Added ImGuiFocusedFlags_ChildWindows flag to include child windows in the focused test. (#1382).
|
- IsWindowFocused(): Added ImGuiFocusedFlags_ChildWindows flag to include child windows in the focused test. (#1382).
|
||||||
- IsWindowFocused(): Added ImGuiFocusedFlags_RootWindow flag to start focused test from the root (top-most) window. Obsolete IsRootWindowFocused(). (#1382)
|
- IsWindowFocused(): Added ImGuiFocusedFlags_RootWindow flag to start focused test from the root (top-most) window. Obsolete IsRootWindowFocused(). (#1382)
|
||||||
- IsWindowHovered(): Added ImGuiHoveredFlags_ChildWindows flag to include child windows in the hovered test. (#1382).
|
- IsWindowHovered(): Added ImGuiHoveredFlags_ChildWindows flag to include child windows in the hovered test. (#1382).
|
||||||
|
@ -3,7 +3,7 @@ dear imgui,
|
|||||||
[](https://travis-ci.org/ocornut/imgui)
|
[](https://travis-ci.org/ocornut/imgui)
|
||||||
[](https://scan.coverity.com/projects/4720)
|
[](https://scan.coverity.com/projects/4720)
|
||||||
|
|
||||||
_(This library is free but needs your support to sustain its development. There are many desirable features and maintenance ahead. If you are an individual using dear imgui, please consider donating via Patreon or PayPal. If your company is using dear imgui, please consider financial support (e.g. sponsoring a few weeks/months of development. I can invoice for technical support, custom development etc. Email: omarcornut at gmail)._
|
_(This library is free but needs your support to sustain its development. There are many desirable features and maintenance ahead. If you are an individual using dear imgui, please consider donating via Patreon or PayPal. If your company is using dear imgui, please consider financial support (e.g. sponsoring a few weeks/months of development). I can invoice for technical support, custom development etc. Email: omarcornut at gmail)._
|
||||||
|
|
||||||
Monthly donations via Patreon:
|
Monthly donations via Patreon:
|
||||||
<br>[](http://www.patreon.com/imgui)
|
<br>[](http://www.patreon.com/imgui)
|
||||||
@ -17,6 +17,8 @@ Dear ImGui is designed to enable fast iterations and to empower programmers to c
|
|||||||
|
|
||||||
Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard.
|
Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard.
|
||||||
|
|
||||||
|
See [Software using dear imgui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui), [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) and [Gallery](https://github.com/ocornut/imgui/issues/1902) pages to get an idea of its use cases.
|
||||||
|
|
||||||
Dear ImGui is self-contained within a few files that you can easily copy and compile into your application/engine:
|
Dear ImGui is self-contained within a few files that you can easily copy and compile into your application/engine:
|
||||||
- imgui.cpp
|
- imgui.cpp
|
||||||
- imgui.h
|
- imgui.h
|
||||||
@ -25,9 +27,9 @@ Dear ImGui is self-contained within a few files that you can easily copy and com
|
|||||||
- imgui_widgets.cpp
|
- imgui_widgets.cpp
|
||||||
- imgui_internal.h
|
- imgui_internal.h
|
||||||
- imconfig.h (empty by default, user-editable)
|
- imconfig.h (empty by default, user-editable)
|
||||||
- stb_rect_pack.h
|
- imstb_rectpack.h
|
||||||
- stb_textedit.h
|
- imstb_textedit.h
|
||||||
- stb_truetype.h
|
- imstb_truetype.h
|
||||||
|
|
||||||
No specific build process is required. You can add the .cpp files to your project or #include them from an existing file.
|
No specific build process is required. You can add the .cpp files to your project or #include them from an existing file.
|
||||||
|
|
||||||
@ -85,9 +87,9 @@ Result:
|
|||||||
|
|
||||||
### How it works
|
### How it works
|
||||||
|
|
||||||
Check out the References section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize state duplication, state synchronization and state storage from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.
|
Check out the References section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize superfluous state duplication, state synchronization and state retention from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.
|
||||||
|
|
||||||
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes is typically very small. Because it doesn't know or touch graphics state directly, you can call ImGui commands anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate dear imgui with your existing codebase.
|
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes required to render them is fairly small. Because Dear ImGui doesn't know or touch graphics state directly, you can call its functions anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate dear imgui with your existing codebase.
|
||||||
|
|
||||||
_A common misunderstanding is to mistake immediate mode gui for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the gui functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely._
|
_A common misunderstanding is to mistake immediate mode gui for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the gui functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely._
|
||||||
|
|
||||||
@ -97,27 +99,27 @@ Demo Binaries
|
|||||||
-------------
|
-------------
|
||||||
|
|
||||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
||||||
- [imgui-demo-binaries-20180512.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20180512.zip) (Windows binaries, Dear ImGui 1.61 WIP built 2018/05/12, 5 executables)
|
- [imgui-demo-binaries-20181008.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20181008.zip) (Windows binaries, Dear ImGui 1.66 WIP built 2018/10/08, master branch, 5 executables)
|
||||||
|
|
||||||
The demo applications are unfortunately not yet DPI aware so expect some blurriness on a 4K screen. For DPI awareness you can load/reload your font at different scale, and scale your Style with `style.ScaleAllSizes()`.
|
The demo applications are unfortunately not yet DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at different scale, and scale your Style with `style.ScaleAllSizes()`.
|
||||||
|
|
||||||
Bindings
|
Bindings
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that. If you are an experienced programmer and at ease with those concepts, it should take you less than an hour to integrate Dear ImGui in your custom engine, but make sure to spend time reading the FAQ, the comments and other documentation!
|
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that. If you are an experienced programmer at ease with those concepts, it should take you about an hour to integrate Dear ImGui in your custom engine. Make sure to spend time reading the FAQ, the comments and other documentation!
|
||||||
|
|
||||||
_NB: those third-party bindings may be more or less maintained, more or less close to the original API (as people who create language bindings sometimes haven't used the C++ API themselves.. for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
_NB: those third-party bindings may be more or less maintained, more or less close to the original API (as people who create language bindings sometimes haven't used the C++ API themselves.. for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
||||||
|
|
||||||
Languages: (third-party bindings)
|
Languages: (third-party bindings)
|
||||||
- C: [cimgui](https://github.com/Extrawurst/cimgui) or [sonoro1234's cimgui](https://github.com/sonoro1234/cimgui) (more recent update), also see [#1879](https://github.com/ocornut/imgui/issues/1879)
|
- C: [cimgui](https://github.com/cimgui/cimgui) (2018: now auto-generated! you can use its json output to generate bindings for other languages)
|
||||||
- C#/.Net: [ImGui.NET](https://github.com/mellinoe/ImGui.NET)
|
- C#/.Net: [ImGui.NET](https://github.com/mellinoe/ImGui.NET)
|
||||||
- ChaiScript: [imgui-chaiscript](https://github.com/JuJuBoSc/imgui-chaiscript)
|
- ChaiScript: [imgui-chaiscript](https://github.com/JuJuBoSc/imgui-chaiscript)
|
||||||
- D: [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
|
- D: [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
|
||||||
- Go: [go-imgui](https://github.com/Armored-Dragon/go-imgui)
|
- Go: [imgui-go](https://github.com/inkyblackness/imgui-go) or [go-imgui](https://github.com/Armored-Dragon/go-imgui)
|
||||||
- Haxe/hxcpp: [linc_imgui](https://github.com/Aidan63/linc_imgui)
|
- Haxe/hxcpp: [linc_imgui](https://github.com/Aidan63/linc_imgui)
|
||||||
- Java: [jimgui](https://github.com/ice1000/jimgui)
|
- Java: [jimgui](https://github.com/ice1000/jimgui)
|
||||||
- JavaScript: [imgui-js](https://github.com/flyover/imgui-js)
|
- JavaScript: [imgui-js](https://github.com/flyover/imgui-js)
|
||||||
- Lua: [imgui_lua_bindings](https://github.com/patrickriordan/imgui_lua_bindings) or [lua-ffi-bindings](https://github.com/thenumbernine/lua-ffi-bindings)
|
- Lua: [LuaJIT-ImGui](https://github.com/sonoro1234/LuaJIT-ImGui), [imgui_lua_bindings](https://github.com/patrickriordan/imgui_lua_bindings) or [lua-ffi-bindings](https://github.com/thenumbernine/lua-ffi-bindings)
|
||||||
- Odin: [odin-dear_imgui](https://github.com/ThisDrunkDane/odin-dear_imgui)
|
- Odin: [odin-dear_imgui](https://github.com/ThisDrunkDane/odin-dear_imgui)
|
||||||
- Pascal: [imgui-pas](https://github.com/dpethes/imgui-pas)
|
- Pascal: [imgui-pas](https://github.com/dpethes/imgui-pas)
|
||||||
- PureBasic: [pb-cimgui](https://github.com/hippyau/pb-cimgui)
|
- PureBasic: [pb-cimgui](https://github.com/hippyau/pb-cimgui)
|
||||||
@ -126,20 +128,20 @@ Languages: (third-party bindings)
|
|||||||
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
||||||
|
|
||||||
Frameworks:
|
Frameworks:
|
||||||
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, Metal, OpenGL2, OpenGL3+/ES2/ES3, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Renderers: DirectX 9/10/11/12, Metal, OpenGL2, OpenGL3+/ES2/ES3, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
||||||
- Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421)
|
- Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421)
|
||||||
- Unmerged PR: ORX: [#1843](https://github.com/ocornut/imgui/pull/1843)
|
|
||||||
- Cinder: [Cinder-ImGui](https://github.com/simongeilfus/Cinder-ImGui)
|
- Cinder: [Cinder-ImGui](https://github.com/simongeilfus/Cinder-ImGui)
|
||||||
- Cocos2d-x: [imguix](https://github.com/c0i/imguix), [issue #551](https://github.com/ocornut/imgui/issues/551)
|
- Cocos2d-x: [imguix](https://github.com/c0i/imguix), [#551](https://github.com/ocornut/imgui/issues/551)
|
||||||
- Flexium: [FlexGUI](https://github.com/DXsmiley/FlexGUI)
|
- Flexium: [FlexGUI](https://github.com/DXsmiley/FlexGUI)
|
||||||
- GML/GameMakerStudio2: [ImGuiGML](https://marketplace.yoyogames.com/assets/6221/imguigml)
|
- GML/GameMakerStudio2: [ImGuiGML](https://marketplace.yoyogames.com/assets/6221/imguigml)
|
||||||
- Irrlicht: [IrrIMGUI](https://github.com/ZahlGraf/IrrIMGUI)
|
- Irrlicht: [IrrIMGUI](https://github.com/ZahlGraf/IrrIMGUI)
|
||||||
- Ogre: [ogreimgui](https://bitbucket.org/LMCrashy/ogreimgui/src)
|
- Ogre: [ogreimgui](https://bitbucket.org/LMCrashy/ogreimgui/src)
|
||||||
- OpenFrameworks: [ofxImGui](https://github.com/jvcleave/ofxImGui)
|
- OpenFrameworks: [ofxImGui](https://github.com/jvcleave/ofxImGui)
|
||||||
- OpenSceneGraph/OSG: [gist](https://gist.github.com/fulezi/d2442ca7626bf270226014501357042c)
|
- OpenSceneGraph/OSG: [gist](https://gist.github.com/fulezi/d2442ca7626bf270226014501357042c)
|
||||||
|
- ORX: [pr #1843](https://github.com/ocornut/imgui/pull/1843)
|
||||||
- LÖVE+Lua: [love-imgui](https://github.com/slages/love-imgui)
|
- LÖVE+Lua: [love-imgui](https://github.com/slages/love-imgui)
|
||||||
- Magnum: [magnum-imgui](https://github.com/lecopivo/magnum-imgui), [MagnumImguiPort](https://github.com/lecopivo/MagnumImguiPort)
|
- Magnum: [magnum-imgui](https://github.com/lecopivo/magnum-imgui), [MagnumImguiPort](https://github.com/lecopivo/MagnumImguiPort)
|
||||||
- NanoRT: [syoyo/imgui](https://github.com/syoyo/imgui/tree/nanort)
|
- NanoRT: [syoyo/imgui](https://github.com/syoyo/imgui/tree/nanort)
|
||||||
@ -152,10 +154,11 @@ For other bindings: see [Bindings](https://github.com/ocornut/imgui/wiki/Binding
|
|||||||
|
|
||||||
Roadmap
|
Roadmap
|
||||||
-------
|
-------
|
||||||
Some of the goals for 2018 are:
|
Some of the goals for 2019 are:
|
||||||
|
- Finish work on docking, tabs. (see [#2109](https://github.com/ocornut/imgui/issues/2109), public branch looking for feedback)
|
||||||
|
- Finish work on multiple viewports / multiple OS windows. (see [#1542](https://github.com/ocornut/imgui/issues/1542), public branch looking for feedback)
|
||||||
- Finish work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787))
|
- Finish work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787))
|
||||||
- Finish work on viewports and multiple OS windows management. (see [#1542](https://github.com/ocornut/imgui/issues/1542))
|
- Add an automation and testing system, both to test the library and end-user apps.
|
||||||
- Finish work on docking, tabs. (see [#351](https://github.com/ocornut/imgui/issues/351#issuecomment-346865709))
|
|
||||||
- Make Columns better. (they are currently pretty terrible!)
|
- Make Columns better. (they are currently pretty terrible!)
|
||||||
- Make the examples look better, improve styles, improve font support, make the examples hi-DPI aware.
|
- Make the examples look better, improve styles, improve font support, make the examples hi-DPI aware.
|
||||||
|
|
||||||
@ -210,14 +213,14 @@ The Immediate Mode GUI paradigm may at first appear unusual to some users. This
|
|||||||
- [Nicolas Guillemot's CppCon'16 flash-talk about Dear ImGui](https://www.youtube.com/watch?v=LSRJ1jZq90k).
|
- [Nicolas Guillemot's CppCon'16 flash-talk about Dear ImGui](https://www.youtube.com/watch?v=LSRJ1jZq90k).
|
||||||
- [Thierry Excoffier's Zero Memory Widget](http://perso.univ-lyon1.fr/thierry.excoffier/ZMW/).
|
- [Thierry Excoffier's Zero Memory Widget](http://perso.univ-lyon1.fr/thierry.excoffier/ZMW/).
|
||||||
|
|
||||||
See the [Wiki](https://github.com/ocornut/imgui/wiki) and [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for third-party bindings to different languages and frameworks.
|
See the [Wiki](https://github.com/ocornut/imgui/wiki) for more references and [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for third-party bindings to different languages and frameworks.
|
||||||
|
|
||||||
Support Forums
|
Support Forums
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
If you have issues with: compiling, linking, adding fonts, running or displaying Dear ImGui, or wiring inputs: please post on the Discourse forum: https://discourse.dearimgui.org/c/getting-started.
|
If you have issues with: compiling, linking, adding fonts, running or displaying Dear ImGui, or wiring inputs: please post on the Discourse forum: https://discourse.dearimgui.org.
|
||||||
|
|
||||||
For any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues.
|
For any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues. Please read and fill the New Issue template carefully.
|
||||||
|
|
||||||
Frequently Asked Question (FAQ)
|
Frequently Asked Question (FAQ)
|
||||||
-------------------------------
|
-------------------------------
|
||||||
@ -228,14 +231,17 @@ Frequently Asked Question (FAQ)
|
|||||||
- Example code is in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output.
|
- Example code is in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output.
|
||||||
- Standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder.
|
- Standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder.
|
||||||
- We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort.
|
- We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort.
|
||||||
|
- Your programming IDE is your friend, find the type or function declaration to find comments associated to it.
|
||||||
|
|
||||||
**Which version should I get?**
|
**Which version should I get?**
|
||||||
|
|
||||||
I occasionally tag [Releases](https://github.com/ocornut/imgui/releases) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported.
|
I occasionally tag [Releases](https://github.com/ocornut/imgui/releases) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported.
|
||||||
|
|
||||||
|
You may also peak at the [Multi-Viewport](https://github.com/ocornut/imgui/issues/1542) and [Docking](https://github.com/ocornut/imgui/issues/2109) branches. Even though they are marked beta, several projects are using them and they are kept in sync with master regularly.
|
||||||
|
|
||||||
**Who uses Dear ImGui?**
|
**Who uses Dear ImGui?**
|
||||||
|
|
||||||
See the [Software using dear imgui page](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) for an (incomplete) list of games/software which are publicly known to use dear imgui. Please add yours if you can!
|
See the [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) and [Software using dear imgui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) pages for an (incomplete) list of games/software which are publicly known to use dear imgui. Please add yours if you can!
|
||||||
|
|
||||||
**Why the odd dual naming, "dear imgui" vs "ImGui"?**
|
**Why the odd dual naming, "dear imgui" vs "ImGui"?**
|
||||||
|
|
||||||
@ -280,7 +286,7 @@ You can alter the look of the interface to some degree: changing colors, sizes,
|
|||||||
|
|
||||||
Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost-insanity/quagmire. Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers. Dear ImGui doesn't use any C++ header file. Language-wise, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.
|
Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost-insanity/quagmire. Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers. Dear ImGui doesn't use any C++ header file. Language-wise, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.
|
||||||
|
|
||||||
There is a [c-api for ImGui (cimgui)](https://github.com/Extrawurst/cimgui) by Stephan Dilly + a newer, [auto-generated cimgui](https://github.com/sonoro1234/cimgui) by sonoro1234. Both are designed for binding other languages. I would suggest using your target language functionalities to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. Also see [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for third-party bindings to other languages.
|
There is an auto-generated [c-api for Dear ImGui (cimgui)](https://github.com/cimgui/cimgui) by Sonoro1234 and Stephan Dilly. This is designed for binding other languages. If possible, I would suggest using your target language functionalities to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. Also see [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for third-party bindings to other languages.
|
||||||
|
|
||||||
Support dear imgui
|
Support dear imgui
|
||||||
------------------
|
------------------
|
||||||
@ -302,13 +308,13 @@ If your company uses dear imgui, please consider financial support (e.g. sponsor
|
|||||||
- Blizzard Entertainment.
|
- Blizzard Entertainment.
|
||||||
|
|
||||||
**Double-chocolate sponsors**
|
**Double-chocolate sponsors**
|
||||||
- Media Molecule, Mobigame, Insomniac Games, Aras Pranckevičius, Lizardcube, Greggman, DotEmu, Nadeo, Supercell, Runner, Artometa, Friendly Shade.
|
- Media Molecule, Mobigame, Insomniac Games, Aras Pranckevičius, Lizardcube, Greggman, DotEmu, Nadeo, Supercell, Runner.
|
||||||
|
|
||||||
**Salty caramel supporters**
|
**Salty caramel supporters**
|
||||||
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Recognition Robotics, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko, Mercury Labs, Singularity Demo Group, Mischa Alff, Sebastien Ronsse, Lionel Landwerlin, Nikolay Ivanov, Ron Gilbert, Brandon Townsend, Nikhil Deshpande, Cort Stratton, drudru, Harfang 3D, Jeff Roberts.
|
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Recognition Robotics, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko, Mercury Labs, Singularity Demo Group, Mischa Alff, Sebastien Ronsse, Lionel Landwerlin, Nikolay Ivanov, Ron Gilbert, Brandon Townsend, Nikhil Deshpande, Cort Stratton, drudru, Harfang 3D, Jeff Roberts.
|
||||||
|
|
||||||
**Caramel supporters**
|
**Caramel supporters**
|
||||||
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, Kit framework, Josh Faust, Martin Donlon, Quinton, Felix, Andrew Belt, Codecat, Cort Stratton, Claudio Canepa, Doug McNabb, Emmanuel Julien, Guillaume Chereau, Jeffrey Slutter, Jeremiah Deckard, r-lyeh, Roger Clark, Nekith, Joshua Fisher, Malte Hoffmann, Mustafa Karaalioglu, Merlyn Morgan-Graham, Per Vognsen, Fabian Giesen, Jan Staubach, Matt Hargett, John Shearer, Jesse Chounard, kingcoopa, Miloš Tošić, Jonas Bernemann, Johan Andersson, Nathan Hartman, Michael Labbe, Tomasz Golebiowski, Louis Schnellbach, Felipe Alfonso, Jimmy Andrews, Bojan Endrovski, Robin Berg Pettersen, Rachel Crawford, Edsel Malasig, Andrew Johnson, Sean Hunter, Jordan Mellow, Nefarius Software Solutions, Laura Wieme, Robert Nix, Mick Honey, Astrofra, Jonas Lehmann, Steven Kah Hien Wong, Bartosz Bielecki, Oscar Penas, A M, Liam Moynihan.
|
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, Kit framework, Josh Faust, Martin Donlon, Quinton, Felix, Andrew Belt, Codecat, Cort Stratton, Claudio Canepa, Doug McNabb, Emmanuel Julien, Guillaume Chereau, Jeffrey Slutter, Jeremiah Deckard, r-lyeh, Roger Clark, Nekith, Joshua Fisher, Malte Hoffmann, Mustafa Karaalioglu, Merlyn Morgan-Graham, Per Vognsen, Fabian Giesen, Jan Staubach, Matt Hargett, John Shearer, Jesse Chounard, kingcoopa, Miloš Tošić, Jonas Bernemann, Johan Andersson, Nathan Hartman, Michael Labbe, Tomasz Golebiowski, Louis Schnellbach, Felipe Alfonso, Jimmy Andrews, Bojan Endrovski, Robin Berg Pettersen, Rachel Crawford, Edsel Malasig, Andrew Johnson, Sean Hunter, Jordan Mellow, Nefarius Software Solutions, Laura Wieme, Robert Nix, Mick Honey, Astrofra, Jonas Lehmann, Steven Kah Hien Wong, Bartosz Bielecki, Oscar Penas, A M, Liam Moynihan, Artometa.
|
||||||
|
|
||||||
And all other supporters; THANK YOU!
|
And all other supporters; THANK YOU!
|
||||||
(Please contact me if you would like to be added or removed from this list)
|
(Please contact me if you would like to be added or removed from this list)
|
||||||
|
@ -44,7 +44,7 @@ You can find binaries of some of those example applications at:
|
|||||||
- Dear ImGui has 0 to 1 frame of lag for most behaviors, at 60 FPS your experience should be pleasant.
|
- 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
|
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).
|
and will feel smoother than common GPU rendered contents (including Dear ImGui windows).
|
||||||
You may experiment with the io.MouseDrawCursor flag to request ImGui to draw a mouse cursor itself,
|
You may experiment with the io.MouseDrawCursor flag to request Dear ImGui to draw a mouse cursor itself,
|
||||||
to visualize the lag between a hardware cursor and a software cursor. However, rendering a mouse cursor
|
to visualize the lag between a hardware cursor and a software cursor. However, rendering a mouse cursor
|
||||||
at 60 FPS will feel slow. It might be beneficial to the user experience to switch to a software rendered
|
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.
|
cursor only when an interactive drag is in progress.
|
||||||
@ -179,7 +179,7 @@ example_glfw_opengl2/
|
|||||||
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
||||||
GLFW + OpenGL2 example (legacy, fixed pipeline).
|
GLFW + OpenGL2 example (legacy, fixed pipeline).
|
||||||
This code is mostly provided as a reference to learn about ImGui integration, because it is shorter.
|
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
||||||
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
||||||
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
||||||
state, and might confuse your GPU driver. One star, not recommended.
|
state, and might confuse your GPU driver. One star, not recommended.
|
||||||
@ -200,7 +200,7 @@ example_sdl_opengl2/
|
|||||||
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
||||||
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
|
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
|
||||||
This code is mostly provided as a reference to learn about ImGui integration, because it is shorter.
|
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
||||||
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
||||||
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
||||||
state, and might confuse your GPU driver. One star, not recommended.
|
state, and might confuse your GPU driver. One star, not recommended.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for Allegro 5
|
// dear imgui: standalone example application for Allegro 5
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <allegro5/allegro.h>
|
#include <allegro5/allegro.h>
|
||||||
@ -22,14 +22,16 @@ int main(int, char**)
|
|||||||
al_register_event_source(queue, al_get_keyboard_event_source());
|
al_register_event_source(queue, al_get_keyboard_event_source());
|
||||||
al_register_event_source(queue, al_get_mouse_event_source());
|
al_register_event_source(queue, al_get_mouse_event_source());
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplAllegro5_Init(display);
|
ImGui_ImplAllegro5_Init(display);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
|
|
||||||
// If we want to receive key events, we either need to be in the responder chain of the key view,
|
// If we want to receive key events, we either need to be in the responder chain of the key view,
|
||||||
// or else we can install a local monitor. The consequence of this heavy-handed approach is that
|
// or else we can install a local monitor. The consequence of this heavy-handed approach is that
|
||||||
// we receive events for all controls, not just ImGui widgets. If we had native controls in our
|
// we receive events for all controls, not just Dear ImGui widgets. If we had native controls in our
|
||||||
// window, we'd want to be much more careful than just ingesting the complete event stream, though
|
// window, we'd want to be much more careful than just ingesting the complete event stream, though we
|
||||||
// we do make an effort to be good citizens by passing along events when ImGui doesn't want to capture.
|
// do make an effort to be good citizens by passing along events when Dear ImGui doesn't want to capture.
|
||||||
NSEventMask eventMask = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventTypeScrollWheel;
|
NSEventMask eventMask = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventTypeScrollWheel;
|
||||||
[NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event) {
|
[NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event) {
|
||||||
BOOL wantsCapture = ImGui_ImplOSX_HandleEvent(event, self.view);
|
BOOL wantsCapture = ImGui_ImplOSX_HandleEvent(event, self.view);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 50;
|
objectVersion = 48;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 50;
|
objectVersion = 48;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for OSX + OpenGL2, using legacy fixed pipeline
|
// dear imgui: standalone example application for OSX + OpenGL2, using legacy fixed pipeline
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "../imgui_impl_osx.h"
|
#include "../imgui_impl_osx.h"
|
||||||
@ -237,16 +237,17 @@
|
|||||||
if ([view openGLContext] == nil)
|
if ([view openGLContext] == nil)
|
||||||
NSLog(@"No OpenGL Context!");
|
NSLog(@"No OpenGL Context!");
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplOSX_Init();
|
ImGui_ImplOSX_Init();
|
||||||
ImGui_ImplOpenGL2_Init();
|
ImGui_ImplOpenGL2_Init();
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline
|
// dear 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.
|
// If you are new to dear 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)
|
// (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's)
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
@ -57,7 +57,7 @@ void my_display_code()
|
|||||||
|
|
||||||
void glut_display_func()
|
void glut_display_func()
|
||||||
{
|
{
|
||||||
// Start the ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplOpenGL2_NewFrame();
|
ImGui_ImplOpenGL2_NewFrame();
|
||||||
ImGui_ImplFreeGLUT_NewFrame();
|
ImGui_ImplFreeGLUT_NewFrame();
|
||||||
|
|
||||||
@ -95,16 +95,17 @@ int main(int argc, char** argv)
|
|||||||
// otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
|
// otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves.
|
||||||
glutDisplayFunc(glut_display_func);
|
glutDisplayFunc(glut_display_func);
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup Dear ImGui context
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplFreeGLUT_Init();
|
ImGui_ImplFreeGLUT_Init();
|
||||||
ImGui_ImplFreeGLUT_InstallFuncs();
|
ImGui_ImplFreeGLUT_InstallFuncs();
|
||||||
ImGui_ImplOpenGL2_Init();
|
ImGui_ImplOpenGL2_Init();
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for GLFW + OpenGL2, using legacy fixed pipeline
|
// dear imgui: standalone example application for GLFW + OpenGL2, using legacy fixed pipeline
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
// (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.)**
|
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
@ -12,6 +12,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
|
||||||
|
// To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma.
|
||||||
|
// Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio.
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||||||
|
#pragma comment(lib, "legacy_stdio_definitions")
|
||||||
|
#endif
|
||||||
|
|
||||||
static void glfw_error_callback(int error, const char* description)
|
static void glfw_error_callback(int error, const char* description)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Glfw Error %d: %s\n", error, description);
|
fprintf(stderr, "Glfw Error %d: %s\n", error, description);
|
||||||
@ -29,17 +36,18 @@ int main(int, char**)
|
|||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval(1); // Enable vsync
|
glfwSwapInterval(1); // Enable vsync
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||||
ImGui_ImplOpenGL2_Init();
|
ImGui_ImplOpenGL2_Init();
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for GLFW + OpenGL 3, using programmable pipeline
|
// dear imgui: standalone example application for GLFW + OpenGL 3, using programmable pipeline
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
@ -20,7 +20,15 @@
|
|||||||
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <GLFW/glfw3.h> // Include glfw3.h after our OpenGL definitions
|
// Include glfw3.h after our OpenGL definitions
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
|
||||||
|
// To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma.
|
||||||
|
// Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio.
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||||||
|
#pragma comment(lib, "legacy_stdio_definitions")
|
||||||
|
#endif
|
||||||
|
|
||||||
static void glfw_error_callback(int error, const char* description)
|
static void glfw_error_callback(int error, const char* description)
|
||||||
{
|
{
|
||||||
@ -64,7 +72,9 @@ int main(int, char**)
|
|||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW)
|
||||||
bool err = glewInit() != GLEW_OK;
|
bool err = glewInit() != GLEW_OK;
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
bool err = gladLoadGL() != 0;
|
bool err = gladLoadGL() == 0;
|
||||||
|
#else
|
||||||
|
bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
|
||||||
#endif
|
#endif
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
@ -72,17 +82,18 @@ int main(int, char**)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||||
ImGui_ImplOpenGL3_Init(glsl_version);
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -32,5 +32,5 @@ include_directories(${GLFW_DIR}/deps)
|
|||||||
|
|
||||||
file(GLOB sources *.cpp)
|
file(GLOB sources *.cpp)
|
||||||
|
|
||||||
add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/examples/imgui_impl_glfw.cpp ${IMGUI_DIR}/examples/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp)
|
add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/examples/imgui_impl_glfw.cpp ${IMGUI_DIR}/examples/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp ${IMGUI_DIR}/imgui_widgets.cpp)
|
||||||
target_link_libraries(example_glfw_vulkan ${LIBRARIES})
|
target_link_libraries(example_glfw_vulkan ${LIBRARIES})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
@ -153,6 +153,7 @@
|
|||||||
<ClCompile Include="..\..\imgui.cpp" />
|
<ClCompile Include="..\..\imgui.cpp" />
|
||||||
<ClCompile Include="..\..\imgui_demo.cpp" />
|
<ClCompile Include="..\..\imgui_demo.cpp" />
|
||||||
<ClCompile Include="..\..\imgui_draw.cpp" />
|
<ClCompile Include="..\..\imgui_draw.cpp" />
|
||||||
|
<ClCompile Include="..\..\imgui_widgets.cpp" />
|
||||||
<ClCompile Include="..\imgui_impl_glfw.cpp" />
|
<ClCompile Include="..\imgui_impl_glfw.cpp" />
|
||||||
<ClCompile Include="..\imgui_impl_vulkan.cpp" />
|
<ClCompile Include="..\imgui_impl_vulkan.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
<ClCompile Include="..\imgui_impl_vulkan.cpp">
|
<ClCompile Include="..\imgui_impl_vulkan.cpp">
|
||||||
<Filter>sources</Filter>
|
<Filter>sources</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\imgui_widgets.cpp">
|
||||||
|
<Filter>imgui</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\imconfig.h">
|
<ClInclude Include="..\..\imconfig.h">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for Glfw + Vulkan
|
// dear imgui: standalone example application for Glfw + Vulkan
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_glfw.h"
|
#include "imgui_impl_glfw.h"
|
||||||
@ -11,6 +11,13 @@
|
|||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
|
// [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and compatibility with old VS compilers.
|
||||||
|
// To link with VS2010-era libraries, VS2015+ requires linking with legacy_stdio_definitions.lib, which we do using this pragma.
|
||||||
|
// Your own project should not be affected, as you are likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio.
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||||||
|
#pragma comment(lib, "legacy_stdio_definitions")
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define IMGUI_UNLIMITED_FRAME_RATE
|
//#define IMGUI_UNLIMITED_FRAME_RATE
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define IMGUI_VULKAN_DEBUG_REPORT
|
#define IMGUI_VULKAN_DEBUG_REPORT
|
||||||
@ -189,12 +196,12 @@ static void SetupVulkanWindowData(ImGui_ImplVulkanH_WindowData* wd, VkSurfaceKHR
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Surface Format
|
// Select Surface Format
|
||||||
const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
|
const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
|
||||||
const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
|
const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
|
||||||
wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
|
wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
|
||||||
|
|
||||||
// Get Present Mode
|
// Select Present Mode
|
||||||
#ifdef IMGUI_UNLIMITED_FRAME_RATE
|
#ifdef IMGUI_UNLIMITED_FRAME_RATE
|
||||||
VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR };
|
VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR };
|
||||||
#else
|
#else
|
||||||
@ -343,17 +350,15 @@ int main(int, char**)
|
|||||||
ImGui_ImplVulkanH_WindowData* wd = &g_WindowData;
|
ImGui_ImplVulkanH_WindowData* wd = &g_WindowData;
|
||||||
SetupVulkanWindowData(wd, surface, w, h);
|
SetupVulkanWindowData(wd, surface, w, h);
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
|
||||||
// Setup GLFW binding
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplGlfw_InitForVulkan(window, true);
|
ImGui_ImplGlfw_InitForVulkan(window, true);
|
||||||
|
|
||||||
// Setup Vulkan binding
|
|
||||||
ImGui_ImplVulkan_InitInfo init_info = {};
|
ImGui_ImplVulkan_InitInfo init_info = {};
|
||||||
init_info.Instance = g_Instance;
|
init_info.Instance = g_Instance;
|
||||||
init_info.PhysicalDevice = g_PhysicalDevice;
|
init_info.PhysicalDevice = g_PhysicalDevice;
|
||||||
@ -366,7 +371,7 @@ int main(int, char**)
|
|||||||
init_info.CheckVkResultFn = check_vk_result;
|
init_info.CheckVkResultFn = check_vk_result;
|
||||||
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
|
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// ImGui - standalone example application for Marmalade
|
// dear imgui: standalone example application for Marmalade
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
// Copyright (C) 2015 by Giovanni Zito
|
// Copyright (C) 2015 by Giovanni Zito
|
||||||
// This file is part of ImGui
|
// This file is part of Dear ImGui
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_marmalade.h"
|
#include "imgui_impl_marmalade.h"
|
||||||
@ -16,14 +16,16 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
IwGxInit();
|
IwGxInit();
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_Marmalade_Init(true);
|
ImGui_Marmalade_Init(true);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui - null/dummy example application (compile and link imgui with no inputs, no outputs)
|
// dear imgui: null/dummy example application (compile and link imgui with no inputs, no outputs)
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
- On Windows with Visual Studio's CLI
|
- On Windows with Visual Studio's CLI
|
||||||
|
|
||||||
```
|
```
|
||||||
set SDL2DIR=path_to_your_sdl2_folder
|
set SDL2_DIR=path_to_your_sdl2_folder
|
||||||
cl /Zi /MD /I %SDL2DIR%\include /I .. /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||||
|
# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries
|
||||||
|
# or for 64-bit:
|
||||||
|
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||||
```
|
```
|
||||||
|
|
||||||
- On Linux and similar Unixes
|
- On Linux and similar Unixes
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
||||||
mkdir Debug
|
set OUT_DIR=Debug
|
||||||
cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_sdl.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
set OUT_EXE=example_sdl_opengl2.exe
|
||||||
|
set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include
|
||||||
|
set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp
|
||||||
|
set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib
|
||||||
|
mkdir %OUT_DIR%
|
||||||
|
cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_DIR%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for SDL2 + OpenGL
|
// dear imgui: standalone example application for SDL2 + OpenGL
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
// (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.)**
|
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
@ -34,16 +34,17 @@ int main(int, char**)
|
|||||||
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
||||||
SDL_GL_SetSwapInterval(1); // Enable vsync
|
SDL_GL_SetSwapInterval(1); // Enable vsync
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
|
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
|
||||||
ImGui_ImplOpenGL2_Init();
|
ImGui_ImplOpenGL2_Init();
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
- On Windows with Visual Studio's CLI
|
- On Windows with Visual Studio's CLI
|
||||||
|
|
||||||
```
|
```
|
||||||
set SDL2DIR=path_to_your_sdl2_folder
|
set SDL2_DIR=path_to_your_sdl2_folder
|
||||||
cl /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||||
|
# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries
|
||||||
|
# or for 64-bit:
|
||||||
|
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||||
```
|
```
|
||||||
|
|
||||||
- On Linux and similar Unixes
|
- On Linux and similar Unixes
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
||||||
mkdir Debug
|
set OUT_DIR=Debug
|
||||||
cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl3.cpp ..\imgui_impl_sdl.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
set OUT_EXE=example_sdl_opengl3.exe
|
||||||
|
set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w
|
||||||
|
set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c
|
||||||
|
set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib
|
||||||
|
mkdir %OUT_DIR%
|
||||||
|
cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for SDL2 + OpenGL
|
// dear imgui: standalone example application for SDL2 + OpenGL
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||||
// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.)
|
// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.)
|
||||||
|
|
||||||
@ -65,6 +65,8 @@ int main(int, char**)
|
|||||||
bool err = glewInit() != GLEW_OK;
|
bool err = glewInit() != GLEW_OK;
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
bool err = gladLoadGL() == 0;
|
bool err = gladLoadGL() == 0;
|
||||||
|
#else
|
||||||
|
bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
|
||||||
#endif
|
#endif
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
@ -72,16 +74,17 @@ int main(int, char**)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
|
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
|
||||||
ImGui_ImplOpenGL3_Init(glsl_version);
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for SDL2 + Vulkan
|
// dear imgui: standalone example application for SDL2 + Vulkan
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_sdl.h"
|
#include "imgui_impl_sdl.h"
|
||||||
@ -186,18 +186,19 @@ static void SetupVulkanWindowData(ImGui_ImplVulkanH_WindowData* wd, VkSurfaceKHR
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Surface Format
|
// Select Surface Format
|
||||||
const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
|
const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM };
|
||||||
const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
|
const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
|
||||||
wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
|
wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace);
|
||||||
|
|
||||||
// Get Present Mode
|
// Select Present Mode
|
||||||
#ifdef IMGUI_UNLIMITED_FRAME_RATE
|
#ifdef IMGUI_UNLIMITED_FRAME_RATE
|
||||||
VkPresentModeKHR present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
|
VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR };
|
||||||
#else
|
#else
|
||||||
VkPresentModeKHR present_mode = VK_PRESENT_MODE_FIFO_KHR;
|
VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR };
|
||||||
#endif
|
#endif
|
||||||
wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_mode, 1);
|
wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_modes[0], IM_ARRAYSIZE(present_modes));
|
||||||
|
//printf("[vulkan] Selected PresentMode = %d\n", wd->PresentMode);
|
||||||
|
|
||||||
// Create SwapChain, RenderPass, Framebuffer, etc.
|
// Create SwapChain, RenderPass, Framebuffer, etc.
|
||||||
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator);
|
ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator);
|
||||||
@ -332,15 +333,13 @@ int main(int, char**)
|
|||||||
ImGui_ImplVulkanH_WindowData* wd = &g_WindowData;
|
ImGui_ImplVulkanH_WindowData* wd = &g_WindowData;
|
||||||
SetupVulkanWindowData(wd, surface, w, h);
|
SetupVulkanWindowData(wd, surface, w, h);
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup Dear ImGui context
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
// Setup SDL binding
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplSDL2_InitForVulkan(window);
|
ImGui_ImplSDL2_InitForVulkan(window);
|
||||||
|
|
||||||
// Setup Vulkan binding
|
|
||||||
ImGui_ImplVulkan_InitInfo init_info = {};
|
ImGui_ImplVulkan_InitInfo init_info = {};
|
||||||
init_info.Instance = g_Instance;
|
init_info.Instance = g_Instance;
|
||||||
init_info.PhysicalDevice = g_PhysicalDevice;
|
init_info.PhysicalDevice = g_PhysicalDevice;
|
||||||
@ -353,7 +352,7 @@ int main(int, char**)
|
|||||||
init_info.CheckVkResultFn = check_vk_result;
|
init_info.CheckVkResultFn = check_vk_result;
|
||||||
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
|
ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
@ -481,8 +480,9 @@ int main(int, char**)
|
|||||||
ImGui_ImplVulkan_Shutdown();
|
ImGui_ImplVulkan_Shutdown();
|
||||||
ImGui_ImplSDL2_Shutdown();
|
ImGui_ImplSDL2_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
CleanupVulkan();
|
CleanupVulkan();
|
||||||
|
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for DirectX 10
|
// dear imgui: standalone example application for DirectX 10
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_win32.h"
|
#include "imgui_impl_win32.h"
|
||||||
@ -75,11 +75,9 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
|
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
|
||||||
{
|
{
|
||||||
ImGui_ImplDX10_InvalidateDeviceObjects();
|
|
||||||
CleanupRenderTarget();
|
CleanupRenderTarget();
|
||||||
g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0);
|
g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0);
|
||||||
CreateRenderTarget();
|
CreateRenderTarget();
|
||||||
ImGui_ImplDX10_CreateDeviceObjects();
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
@ -112,16 +110,17 @@ int main(int, char**)
|
|||||||
ShowWindow(hwnd, SW_SHOWDEFAULT);
|
ShowWindow(hwnd, SW_SHOWDEFAULT);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplWin32_Init(hwnd);
|
ImGui_ImplWin32_Init(hwnd);
|
||||||
ImGui_ImplDX10_Init(g_pd3dDevice);
|
ImGui_ImplDX10_Init(g_pd3dDevice);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for DirectX 11
|
// dear imgui - standalone example application for DirectX 11
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_win32.h"
|
#include "imgui_impl_win32.h"
|
||||||
@ -78,11 +78,9 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
|
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
|
||||||
{
|
{
|
||||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
|
||||||
CleanupRenderTarget();
|
CleanupRenderTarget();
|
||||||
g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0);
|
g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0);
|
||||||
CreateRenderTarget();
|
CreateRenderTarget();
|
||||||
ImGui_ImplDX11_CreateDeviceObjects();
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
@ -115,16 +113,17 @@ int main(int, char**)
|
|||||||
ShowWindow(hwnd, SW_SHOWDEFAULT);
|
ShowWindow(hwnd, SW_SHOWDEFAULT);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplWin32_Init(hwnd);
|
ImGui_ImplWin32_Init(hwnd);
|
||||||
ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);
|
ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for DirectX 12
|
// dear imgui: standalone example application for DirectX 12
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
|
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
@ -286,19 +286,20 @@ int main(int, char**)
|
|||||||
ShowWindow(hwnd, SW_SHOWDEFAULT);
|
ShowWindow(hwnd, SW_SHOWDEFAULT);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplWin32_Init(hwnd);
|
ImGui_ImplWin32_Init(hwnd);
|
||||||
ImGui_ImplDX12_Init(g_pd3dDevice, NUM_FRAMES_IN_FLIGHT,
|
ImGui_ImplDX12_Init(g_pd3dDevice, NUM_FRAMES_IN_FLIGHT,
|
||||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||||
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
|
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
|
||||||
g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
|
g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui - standalone example application for DirectX 9
|
// dear imgui: standalone example application for DirectX 9
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_dx9.h"
|
#include "imgui_impl_dx9.h"
|
||||||
@ -75,15 +75,17 @@ int main(int, char**)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup Dear ImGui binding
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
|
||||||
|
// Setup Platform/Renderer bindings
|
||||||
ImGui_ImplWin32_Init(hwnd);
|
ImGui_ImplWin32_Init(hwnd);
|
||||||
ImGui_ImplDX9_Init(g_pd3dDevice);
|
ImGui_ImplDX9_Init(g_pd3dDevice);
|
||||||
|
|
||||||
// Setup style
|
// Setup Style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// ImGui Renderer + Platform Binding for: Allegro 5
|
// dear imgui: Renderer + Platform Binding for Allegro 5
|
||||||
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
|
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Platform: Clipboard support (from Allegro 5.1.12)
|
// [X] Platform: Clipboard support (from Allegro 5.1.12)
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
|
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert the format of vertices.
|
// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually.
|
||||||
|
// [ ] Platform: Missing gamepad support.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
@ -74,7 +74,7 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
|
|||||||
al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
|
al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
|
||||||
|
|
||||||
// Setup orthographic projection matrix
|
// Setup orthographic projection matrix
|
||||||
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right).
|
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right).
|
||||||
{
|
{
|
||||||
float L = draw_data->DisplayPos.x;
|
float L = draw_data->DisplayPos.x;
|
||||||
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
|
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
|
||||||
@ -108,7 +108,7 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
|
|||||||
const int* indices = NULL;
|
const int* indices = NULL;
|
||||||
if (sizeof(ImDrawIdx) == 2)
|
if (sizeof(ImDrawIdx) == 2)
|
||||||
{
|
{
|
||||||
// FIXME-OPT: Unfortunately Allegro doesn't support 16-bit indices.. You can '#define ImDrawIdx int' in imconfig.h to request ImGui to output 32-bit indices.
|
// FIXME-OPT: Unfortunately Allegro doesn't support 16-bit indices.. You can '#define ImDrawIdx int' in imconfig.h to request Dear ImGui to output 32-bit indices.
|
||||||
// Otherwise, we convert them from 16-bit to 32-bit at runtime here, which works perfectly but is a little wasteful.
|
// Otherwise, we convert them from 16-bit to 32-bit at runtime here, which works perfectly but is a little wasteful.
|
||||||
static ImVector<int> indices_converted;
|
static ImVector<int> indices_converted;
|
||||||
indices_converted.resize(cmd_list->IdxBuffer.Size);
|
indices_converted.resize(cmd_list->IdxBuffer.Size);
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
// ImGui Renderer + Platform Binding for: Allegro 5
|
// dear imgui: Renderer + Platform Binding for Allegro 5
|
||||||
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
|
// (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
// [X] Platform: Clipboard support (from Allegro 5.1.12)
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] Renderer: The renderer is suboptimal as we need to convert vertices.
|
// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually.
|
||||||
// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text.
|
// [ ] Platform: Missing gamepad support.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX10
|
// dear imgui: Renderer for DirectX10
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX10
|
// dear imgui: Renderer for DirectX10
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -8,6 +8,8 @@
|
|||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
struct ID3D10Device;
|
struct ID3D10Device;
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device);
|
IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX11
|
// dear imgui: Renderer for DirectX11
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX11
|
// dear imgui: Renderer for DirectX11
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -8,6 +8,8 @@
|
|||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
struct ID3D11Device;
|
struct ID3D11Device;
|
||||||
struct ID3D11DeviceContext;
|
struct ID3D11DeviceContext;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX12
|
// dear imgui: Renderer for DirectX12
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX12
|
// dear imgui: Renderer for DirectX12
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -10,6 +10,8 @@
|
|||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
enum DXGI_FORMAT;
|
enum DXGI_FORMAT;
|
||||||
struct ID3D12Device;
|
struct ID3D12Device;
|
||||||
struct ID3D12GraphicsCommandList;
|
struct ID3D12GraphicsCommandList;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX9
|
// dear imgui: Renderer for DirectX9
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -140,7 +140,7 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
|||||||
g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
||||||
|
|
||||||
// Setup orthographic projection matrix
|
// Setup orthographic projection matrix
|
||||||
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right).
|
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right).
|
||||||
// Being agnostic of whether <d3dx9.h> or <DirectXMath.h> can be used, we aren't relying on D3DXMatrixIdentity()/D3DXMatrixOrthoOffCenterLH() or DirectX::XMMatrixIdentity()/DirectX::XMMatrixOrthographicOffCenterLH()
|
// Being agnostic of whether <d3dx9.h> or <DirectXMath.h> can be used, we aren't relying on D3DXMatrixIdentity()/D3DXMatrixOrthoOffCenterLH() or DirectX::XMMatrixIdentity()/DirectX::XMMatrixOrthographicOffCenterLH()
|
||||||
{
|
{
|
||||||
float L = draw_data->DisplayPos.x + 0.5f;
|
float L = draw_data->DisplayPos.x + 0.5f;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: DirectX9
|
// dear imgui: Renderer for DirectX9
|
||||||
// This needs to be used along with a Platform Binding (e.g. Win32)
|
// This needs to be used along with a Platform Binding (e.g. Win32)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -8,6 +8,8 @@
|
|||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
struct IDirect3DDevice9;
|
struct IDirect3DDevice9;
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device);
|
IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device);
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
// ImGui Platform Binding for: FreeGLUT
|
// dear imgui: Platform Binding for FreeGLUT
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL2)
|
// This needs to be used along with a Renderer (e.g. OpenGL2)
|
||||||
|
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
||||||
|
// [ ] Platform: Missing gamepad support.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
@ -97,7 +98,7 @@ void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y)
|
|||||||
//printf("char_down_func %d '%c'\n", c, c);
|
//printf("char_down_func %d '%c'\n", c, c);
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
if (c >= 32)
|
if (c >= 32)
|
||||||
io.AddInputCharacter(c);
|
io.AddInputCharacter((unsigned short)c);
|
||||||
|
|
||||||
// Store letters in KeysDown[] array as both uppercase and lowercase + Handle GLUT translating CTRL+A..CTRL+Z as 1..26.
|
// 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.
|
// 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.
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
// ImGui Platform Binding for: FreeGLUT
|
// dear imgui: Platform Binding for FreeGLUT
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL2)
|
// This needs to be used along with a Renderer (e.g. OpenGL2)
|
||||||
|
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I
|
||||||
|
// [ ] Platform: Missing gamepad support.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplFreeGLUT_Init();
|
IMGUI_IMPL_API bool ImGui_ImplFreeGLUT_Init();
|
||||||
IMGUI_IMPL_API void ImGui_ImplFreeGLUT_InstallFuncs();
|
IMGUI_IMPL_API void ImGui_ImplFreeGLUT_InstallFuncs();
|
||||||
IMGUI_IMPL_API void ImGui_ImplFreeGLUT_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplFreeGLUT_Shutdown();
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// ImGui Platform Binding for: GLFW
|
// dear imgui: Platform Binding for GLFW
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
|
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
|
||||||
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Clipboard support.
|
// [X] Platform: Clipboard support.
|
||||||
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||||
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
||||||
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
|
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
|
||||||
|
|
||||||
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2018-11-07: Inputs: When installing our GLFW callbacks, we save user's previously installed ones - if any - and chain call them.
|
||||||
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||||
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
|
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
|
||||||
@ -57,6 +58,12 @@ static double g_Time = 0.0;
|
|||||||
static bool g_MouseJustPressed[5] = { false, false, false, false, false };
|
static bool g_MouseJustPressed[5] = { false, false, false, false, false };
|
||||||
static GLFWcursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = { 0 };
|
static GLFWcursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = { 0 };
|
||||||
|
|
||||||
|
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||||
|
static GLFWmousebuttonfun g_PrevUserCallbackMousebutton = NULL;
|
||||||
|
static GLFWscrollfun g_PrevUserCallbackScroll = NULL;
|
||||||
|
static GLFWkeyfun g_PrevUserCallbackKey = NULL;
|
||||||
|
static GLFWcharfun g_PrevUserCallbackChar = NULL;
|
||||||
|
|
||||||
static const char* ImGui_ImplGlfw_GetClipboardText(void* user_data)
|
static const char* ImGui_ImplGlfw_GetClipboardText(void* user_data)
|
||||||
{
|
{
|
||||||
return glfwGetClipboardString((GLFWwindow*)user_data);
|
return glfwGetClipboardString((GLFWwindow*)user_data);
|
||||||
@ -67,49 +74,53 @@ static void ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)
|
|||||||
glfwSetClipboardString((GLFWwindow*)user_data, text);
|
glfwSetClipboardString((GLFWwindow*)user_data, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/)
|
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
|
||||||
{
|
{
|
||||||
|
if (g_PrevUserCallbackMousebutton != NULL)
|
||||||
|
g_PrevUserCallbackMousebutton(window, button, action, mods);
|
||||||
|
|
||||||
if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
|
if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
|
||||||
g_MouseJustPressed[button] = true;
|
g_MouseJustPressed[button] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_ScrollCallback(GLFWwindow*, double xoffset, double yoffset)
|
void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
|
||||||
{
|
{
|
||||||
|
if (g_PrevUserCallbackScroll != NULL)
|
||||||
|
g_PrevUserCallbackScroll(window, xoffset, yoffset);
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.MouseWheelH += (float)xoffset;
|
io.MouseWheelH += (float)xoffset;
|
||||||
io.MouseWheel += (float)yoffset;
|
io.MouseWheel += (float)yoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_KeyCallback(GLFWwindow*, int key, int, int action, int mods)
|
void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
|
if (g_PrevUserCallbackKey != NULL)
|
||||||
|
g_PrevUserCallbackKey(window, key, scancode, action, mods);
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
if (action == GLFW_PRESS)
|
if (action == GLFW_PRESS)
|
||||||
io.KeysDown[key] = true;
|
io.KeysDown[key] = true;
|
||||||
if (action == GLFW_RELEASE)
|
if (action == GLFW_RELEASE)
|
||||||
io.KeysDown[key] = false;
|
io.KeysDown[key] = false;
|
||||||
|
|
||||||
(void)mods; // Modifiers are not reliable across systems
|
// Modifiers are not reliable across systems
|
||||||
io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
|
io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
|
||||||
io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
|
io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
|
||||||
io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
|
io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
|
||||||
io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
|
io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_CharCallback(GLFWwindow*, unsigned int c)
|
void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c)
|
||||||
{
|
{
|
||||||
|
if (g_PrevUserCallbackChar != NULL)
|
||||||
|
g_PrevUserCallbackChar(window, c);
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
if (c > 0 && c < 0x10000)
|
if (c > 0 && c < 0x10000)
|
||||||
io.AddInputCharacter((unsigned short)c);
|
io.AddInputCharacter((unsigned short)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window)
|
|
||||||
{
|
|
||||||
glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
|
|
||||||
glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
|
|
||||||
glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
|
|
||||||
glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
|
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
|
||||||
{
|
{
|
||||||
g_Window = window;
|
g_Window = window;
|
||||||
@ -159,8 +170,18 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
|||||||
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
|
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
|
||||||
g_MouseCursors[ImGuiMouseCursor_Hand] = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
|
g_MouseCursors[ImGuiMouseCursor_Hand] = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
|
||||||
|
|
||||||
|
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||||
|
g_PrevUserCallbackMousebutton = NULL;
|
||||||
|
g_PrevUserCallbackScroll = NULL;
|
||||||
|
g_PrevUserCallbackKey = NULL;
|
||||||
|
g_PrevUserCallbackChar = NULL;
|
||||||
if (install_callbacks)
|
if (install_callbacks)
|
||||||
ImGui_ImplGlfw_InstallCallbacks(window);
|
{
|
||||||
|
g_PrevUserCallbackMousebutton = glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
|
||||||
|
g_PrevUserCallbackScroll = glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
|
||||||
|
g_PrevUserCallbackKey = glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
|
||||||
|
g_PrevUserCallbackChar = glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback);
|
||||||
|
}
|
||||||
|
|
||||||
g_ClientApi = client_api;
|
g_ClientApi = client_api;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// ImGui Platform Binding for: GLFW
|
// dear imgui: Platform Binding for GLFW
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
|
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
|
||||||
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Clipboard support.
|
// [X] Platform: Clipboard support.
|
||||||
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||||
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
||||||
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
|
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
|
||||||
|
|
||||||
@ -16,6 +16,8 @@
|
|||||||
// The 'glsl_version' initialization parameter defaults to "#version 150" if NULL.
|
// The 'glsl_version' initialization parameter defaults to "#version 150" if NULL.
|
||||||
// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
|
// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
struct GLFWwindow;
|
struct GLFWwindow;
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
|
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
|
||||||
@ -23,9 +25,8 @@ IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool in
|
|||||||
IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
|
||||||
|
|
||||||
// GLFW callbacks (installed by default if you enable 'install_callbacks' during initialization)
|
// InitXXX function with 'install_callbacks=true': install GLFW callbacks. They will call user's previously installed callbacks, if any.
|
||||||
// Provided here if you want to chain callbacks.
|
// InitXXX function with 'install_callbacks=false': do not install GLFW callbacks. You will need to call them yourself from your own GLFW callbacks.
|
||||||
// You can also handle inputs yourself and use those as a reference.
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
|
IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
|
||||||
IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
|
IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
|
||||||
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// ImGui Renderer + Platform Binding for: Marmalade + IwGx
|
// dear imgui: Renderer + Platform Binding for Marmalade + IwGx
|
||||||
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of ImGui)
|
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: 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.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// ImGui Renderer + Platform Binding for: Marmalade + IwGx
|
// dear imgui: Renderer + Platform Binding for Marmalade + IwGx
|
||||||
|
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: 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.
|
||||||
@ -7,8 +8,7 @@
|
|||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
// Copyright (C) 2015 by Giovanni Zito
|
#pragma once
|
||||||
// This file is part of ImGui
|
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks);
|
IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks);
|
||||||
IMGUI_IMPL_API void ImGui_Marmalade_Shutdown();
|
IMGUI_IMPL_API void ImGui_Marmalade_Shutdown();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: Metal
|
// dear imgui: Renderer for Metal
|
||||||
// This needs to be used along with a Platform Binding (e.g. OSX)
|
// This needs to be used along with a Platform Binding (e.g. OSX)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: Metal
|
// dear imgui: Renderer for Metal
|
||||||
// This needs to be used along with a Platform Binding (e.g. OSX)
|
// This needs to be used along with a Platform Binding (e.g. OSX)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -408,7 +408,7 @@ void ImGui_ImplMetal_DestroyDeviceObjects()
|
|||||||
[commandEncoder setDepthStencilState:g_sharedMetalContext.depthStencilState];
|
[commandEncoder setDepthStencilState:g_sharedMetalContext.depthStencilState];
|
||||||
|
|
||||||
// Setup viewport, orthographic projection matrix
|
// Setup viewport, orthographic projection matrix
|
||||||
// Our visible imgui space lies from draw_data->DisplayPps (top left) to
|
// Our visible imgui space lies from draw_data->DisplayPos (top left) to
|
||||||
// draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
// draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
||||||
MTLViewport viewport =
|
MTLViewport viewport =
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
|
// dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -102,7 +102,7 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
|
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
|
||||||
|
|
||||||
// Setup viewport, orthographic projection matrix
|
// Setup viewport, orthographic projection matrix
|
||||||
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
||||||
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
|
// dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
@ -16,6 +16,8 @@
|
|||||||
// confuse your GPU driver.
|
// confuse your GPU driver.
|
||||||
// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
|
// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
|
IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
|
||||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
// dear imgui: Renderer for OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||||
|
|
||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2018-11-13: OpenGL: Support for GL 4.5's glClipControl(GL_UPPER_LEFT).
|
||||||
// 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used.
|
// 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used.
|
||||||
// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
|
// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
|
||||||
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
||||||
@ -162,6 +163,12 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
||||||
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||||
GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
||||||
|
bool clip_origin_lower_left = true;
|
||||||
|
#ifdef GL_CLIP_ORIGIN
|
||||||
|
GLenum last_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)&last_clip_origin); // Support for GL 4.5's glClipControl(GL_UPPER_LEFT)
|
||||||
|
if (last_clip_origin == GL_UPPER_LEFT)
|
||||||
|
clip_origin_lower_left = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@ -175,7 +182,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Setup viewport, orthographic projection matrix
|
// Setup viewport, orthographic projection matrix
|
||||||
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
||||||
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||||
float L = draw_data->DisplayPos.x;
|
float L = draw_data->DisplayPos.x;
|
||||||
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
|
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
|
||||||
@ -234,7 +241,10 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||||
{
|
{
|
||||||
// Apply scissor/clipping rectangle
|
// Apply scissor/clipping rectangle
|
||||||
|
if (clip_origin_lower_left)
|
||||||
glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
|
glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
|
||||||
|
else
|
||||||
|
glScissor((int)clip_rect.x, (int)clip_rect.y, (int)clip_rect.z, (int)clip_rect.w); // Support for GL 4.5's glClipControl(GL_UPPER_LEFT)
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
||||||
@ -306,13 +316,13 @@ void ImGui_ImplOpenGL3_DestroyFontsTexture()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you get an error please report on github. You may try different GL context version or GLSL version.
|
// If you get an error please report on github. You may try different GL context version or GLSL version. See GL<>GLSL version table at the top of this file.
|
||||||
static bool CheckShader(GLuint handle, const char* desc)
|
static bool CheckShader(GLuint handle, const char* desc)
|
||||||
{
|
{
|
||||||
GLint status = 0, log_length = 0;
|
GLint status = 0, log_length = 0;
|
||||||
glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
|
glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
|
||||||
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
if (status == GL_FALSE)
|
if ((GLboolean)status == GL_FALSE)
|
||||||
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc);
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc);
|
||||||
if (log_length > 0)
|
if (log_length > 0)
|
||||||
{
|
{
|
||||||
@ -321,17 +331,17 @@ static bool CheckShader(GLuint handle, const char* desc)
|
|||||||
glGetShaderInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
glGetShaderInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
||||||
fprintf(stderr, "%s\n", buf.begin());
|
fprintf(stderr, "%s\n", buf.begin());
|
||||||
}
|
}
|
||||||
return status == GL_TRUE;
|
return (GLboolean)status == GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you get an error please report on github. You may try different GL context version or GLSL version.
|
// If you get an error please report on GitHub. You may try different GL context version or GLSL version.
|
||||||
static bool CheckProgram(GLuint handle, const char* desc)
|
static bool CheckProgram(GLuint handle, const char* desc)
|
||||||
{
|
{
|
||||||
GLint status = 0, log_length = 0;
|
GLint status = 0, log_length = 0;
|
||||||
glGetProgramiv(handle, GL_LINK_STATUS, &status);
|
glGetProgramiv(handle, GL_LINK_STATUS, &status);
|
||||||
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
if (status == GL_FALSE)
|
if ((GLboolean)status == GL_FALSE)
|
||||||
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s!\n", desc);
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! (with GLSL '%s')\n", desc, g_GlslVersionString);
|
||||||
if (log_length > 0)
|
if (log_length > 0)
|
||||||
{
|
{
|
||||||
ImVector<char> buf;
|
ImVector<char> buf;
|
||||||
@ -339,7 +349,7 @@ static bool CheckProgram(GLuint handle, const char* desc)
|
|||||||
glGetProgramInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
glGetProgramInfoLog(handle, log_length, NULL, (GLchar*)buf.begin());
|
||||||
fprintf(stderr, "%s\n", buf.begin());
|
fprintf(stderr, "%s\n", buf.begin());
|
||||||
}
|
}
|
||||||
return status == GL_TRUE;
|
return (GLboolean)status == GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
// dear imgui: Renderer for OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||||
|
|
||||||
@ -19,6 +19,8 @@
|
|||||||
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||||
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
// Set default OpenGL loader to be gl3w
|
// Set default OpenGL loader to be gl3w
|
||||||
#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Platform Binding for: OSX / Cocoa
|
// dear imgui: Platform Binding for OSX / Cocoa
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
||||||
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Platform Binding for: OSX / Cocoa
|
// dear imgui: Platform Binding for OSX / Cocoa
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
||||||
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
|||||||
{
|
{
|
||||||
int c = [str characterAtIndex:i];
|
int c = [str characterAtIndex:i];
|
||||||
if (c < 0xF700 && !io.KeyCtrl)
|
if (c < 0xF700 && !io.KeyCtrl)
|
||||||
io.AddInputCharacter(c);
|
io.AddInputCharacter((unsigned short)c);
|
||||||
|
|
||||||
// We must reset in case we're pressing a sequence of special keys while keeping the command pressed
|
// We must reset in case we're pressing a sequence of special keys while keeping the command pressed
|
||||||
int key = mapCharacterToKey(c);
|
int key = mapCharacterToKey(c);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Platform Binding for: SDL2
|
// dear imgui: Platform Binding for SDL2
|
||||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||||
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||||
|
|
||||||
@ -8,6 +8,7 @@
|
|||||||
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
||||||
// Missing features:
|
// Missing features:
|
||||||
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
||||||
|
// [ ] Platform: Gamepad support (need to use SDL_GameController API to fill the io.NavInputs[] value when ImGuiConfigFlags_NavEnableGamepad is set).
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Platform Binding for: SDL2
|
// dear imgui: Platform Binding for SDL2
|
||||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||||
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||||
|
|
||||||
@ -8,11 +8,14 @@
|
|||||||
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
||||||
// Missing features:
|
// Missing features:
|
||||||
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
||||||
|
// [ ] Platform: Gamepad support (need to use SDL_GameController API to fill the io.NavInputs[] value when ImGuiConfigFlags_NavEnableGamepad is set).
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
struct SDL_Window;
|
struct SDL_Window;
|
||||||
typedef union SDL_Event SDL_Event;
|
typedef union SDL_Event SDL_Event;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: Vulkan
|
// dear imgui: Renderer for Vulkan
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
// Missing features:
|
// Missing features:
|
||||||
@ -273,7 +273,7 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup scale and translation:
|
// Setup scale and translation:
|
||||||
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
|
||||||
{
|
{
|
||||||
float scale[2];
|
float scale[2];
|
||||||
scale[0] = 2.0f / draw_data->DisplaySize.x;
|
scale[0] = 2.0f / draw_data->DisplaySize.x;
|
||||||
@ -840,6 +840,7 @@ VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_d
|
|||||||
void ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator)
|
void ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator)
|
||||||
{
|
{
|
||||||
IM_ASSERT(physical_device != VK_NULL_HANDLE && device != VK_NULL_HANDLE);
|
IM_ASSERT(physical_device != VK_NULL_HANDLE && device != VK_NULL_HANDLE);
|
||||||
|
(void)physical_device;
|
||||||
(void)allocator;
|
(void)allocator;
|
||||||
|
|
||||||
// Create Command Buffers
|
// Create Command Buffers
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// ImGui Renderer for: Vulkan
|
// dear imgui: Renderer for Vulkan
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
// Missing features:
|
// Missing features:
|
||||||
@ -11,6 +11,8 @@
|
|||||||
// The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
|
// The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
|
||||||
// IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
|
// IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
#define IMGUI_VK_QUEUED_FRAMES 2
|
#define IMGUI_VK_QUEUED_FRAMES 2
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
// ImGui Platform Binding for: Windows (standard windows API for 32 and 64 bits applications)
|
// dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications)
|
||||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Clipboard support (for Win32 this is actually part of core imgui)
|
// [X] Platform: Clipboard support (for Win32 this is actually part of core imgui)
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
// [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).
|
// [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).
|
||||||
|
// Missing features:
|
||||||
|
// [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice).
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_win32.h"
|
#include "imgui_impl_win32.h"
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// ImGui Platform Binding for: Windows (standard windows API for 32 and 64 bits applications)
|
// dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications)
|
||||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Clipboard support (for Win32 this is actually part of core imgui)
|
// [X] Platform: Clipboard support (for Win32 this is actually part of core imgui)
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
// [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).
|
// [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).
|
||||||
|
// Missing features:
|
||||||
|
// [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice).
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
|
IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
|
||||||
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
//---- Don't implement some functions to reduce linkage requirements.
|
//---- Don't implement some functions to reduce linkage requirements.
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow.
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow.
|
||||||
|
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function.
|
||||||
//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf.
|
//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf.
|
||||||
//#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h.
|
//#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h.
|
||||||
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
|
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
|
||||||
|
117
imgui.h
117
imgui.h
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.65
|
// dear imgui, v1.66
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// See imgui.cpp file for documentation.
|
// See imgui.cpp file for documentation.
|
||||||
@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY00 then bounced up to XYY01 when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY00 then bounced up to XYY01 when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.65"
|
#define IMGUI_VERSION "1.66"
|
||||||
#define IMGUI_VERSION_NUM 16501
|
#define IMGUI_VERSION_NUM 16601
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert))
|
||||||
|
|
||||||
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
||||||
@ -189,14 +189,20 @@ namespace ImGui
|
|||||||
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font
|
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font
|
||||||
|
|
||||||
// Windows
|
// Windows
|
||||||
// (Begin = push window to the stack and start appending to it. End = pop window from the stack. You may append multiple times to the same window during the same frame)
|
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
|
||||||
// Begin()/BeginChild() return false to indicate the window being collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
// - You may append multiple times to the same window during the same frame.
|
||||||
// You need to always call a matching End()/EndChild() for a Begin()/BeginChild() call, regardless of its return value (this is due to legacy reason and is inconsistent with BeginMenu/EndMenu, BeginPopup/EndPopup and other functions where the End call should only be called if the corresponding Begin function returned true.)
|
// - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked.
|
||||||
// Passing 'bool* p_open != NULL' shows a close widget in the upper-right corner of the window, which when clicking will set the boolean to false.
|
// - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
||||||
// Use child windows to introduce independent scrolling/clipping regions within a host window. Child windows can embed their own child.
|
// Always call a matching End() for each Begin() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.]
|
||||||
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
|
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
|
||||||
IMGUI_API void End();
|
IMGUI_API void End();
|
||||||
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0); // Begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400).
|
|
||||||
|
// Child Windows
|
||||||
|
// - Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child.
|
||||||
|
// - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400).
|
||||||
|
// - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
||||||
|
// Always call a matching EndChild() for each BeginChild() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.]
|
||||||
|
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0);
|
||||||
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0);
|
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0);
|
||||||
IMGUI_API void EndChild();
|
IMGUI_API void EndChild();
|
||||||
|
|
||||||
@ -223,7 +229,7 @@ namespace ImGui
|
|||||||
IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ enforce the range of scrollbars). not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin()
|
IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ enforce the range of scrollbars). not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin()
|
||||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin()
|
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin()
|
||||||
IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most. call before Begin()
|
IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most. call before Begin()
|
||||||
IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg.
|
IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
|
||||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
|
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
|
||||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
||||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
||||||
@ -241,7 +247,7 @@ namespace ImGui
|
|||||||
IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y
|
IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y
|
||||||
IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()]
|
IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()]
|
||||||
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
|
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
|
||||||
IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
||||||
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.
|
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.
|
||||||
|
|
||||||
// Parameters stacks (shared)
|
// Parameters stacks (shared)
|
||||||
@ -374,7 +380,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||||
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||||
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||||
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
|
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = "%.0f deg");
|
||||||
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d");
|
||||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d");
|
||||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d");
|
||||||
@ -386,7 +392,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||||
|
|
||||||
// Widgets: Input with Keyboard
|
// Widgets: Input with Keyboard
|
||||||
// If you want to use InputText() with a dynamic string type such as std::string or your own, see misc/stl/imgui_stl.h
|
// If you want to use InputText() with a dynamic string type such as std::string or your own, see misc/cpp/imgui_stdlib.h
|
||||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0);
|
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0);
|
||||||
@ -478,12 +484,12 @@ namespace ImGui
|
|||||||
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked in void (where there are no imgui windows).
|
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked in void (where there are no imgui windows).
|
||||||
IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside)
|
IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside)
|
||||||
IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true!
|
IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true!
|
||||||
IMGUI_API bool OpenPopupOnItemClick(const char* str_id = NULL, int mouse_button = 1); // helper to open popup when clicked on last item. return true when just opened.
|
IMGUI_API bool OpenPopupOnItemClick(const char* str_id = NULL, int mouse_button = 1); // helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). return true when just opened.
|
||||||
IMGUI_API bool IsPopupOpen(const char* str_id); // return true if the popup is open
|
IMGUI_API bool IsPopupOpen(const char* str_id); // return true if the popup is open
|
||||||
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
|
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
|
||||||
|
|
||||||
// Columns
|
// Columns
|
||||||
// You can also use SameLine(pos_x) for simplified columns. The columns API is still work-in-progress and rather lacking.
|
// You can also use SameLine(pos_x) for simplified columns. The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!)
|
||||||
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true);
|
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true);
|
||||||
IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished
|
IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished
|
||||||
IMGUI_API int GetColumnIndex(); // get current column index
|
IMGUI_API int GetColumnIndex(); // get current column index
|
||||||
@ -506,20 +512,21 @@ namespace ImGui
|
|||||||
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
||||||
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
|
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
|
||||||
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true!
|
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true!
|
||||||
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
|
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
|
||||||
IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
|
IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
|
||||||
IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true!
|
IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true!
|
||||||
|
IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type.
|
||||||
|
|
||||||
// Clipping
|
// Clipping
|
||||||
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);
|
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);
|
||||||
IMGUI_API void PopClipRect();
|
IMGUI_API void PopClipRect();
|
||||||
|
|
||||||
// Focus, Activation
|
// Focus, Activation
|
||||||
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHere()" when applicable, to make your code more forward compatible when navigation branch is merged)
|
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item")
|
||||||
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item".
|
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window.
|
||||||
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.
|
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.
|
||||||
|
|
||||||
// Utilities
|
// Item/Widgets Utilities
|
||||||
// See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.
|
// See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.
|
||||||
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
||||||
IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false)
|
IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false)
|
||||||
@ -536,6 +543,8 @@ namespace ImGui
|
|||||||
IMGUI_API ImVec2 GetItemRectMax(); // "
|
IMGUI_API ImVec2 GetItemRectMax(); // "
|
||||||
IMGUI_API ImVec2 GetItemRectSize(); // get size of last item, in screen space
|
IMGUI_API ImVec2 GetItemRectSize(); // get size of last item, in screen space
|
||||||
IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
|
IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
|
||||||
|
|
||||||
|
// Miscellaneous Utilities
|
||||||
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped.
|
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped.
|
||||||
IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
|
IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
|
||||||
IMGUI_API double GetTime();
|
IMGUI_API double GetTime();
|
||||||
@ -547,16 +556,16 @@ namespace ImGui
|
|||||||
IMGUI_API ImGuiStorage* GetStateStorage();
|
IMGUI_API ImGuiStorage* GetStateStorage();
|
||||||
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
||||||
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.
|
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.
|
||||||
|
|
||||||
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame
|
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame
|
||||||
IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
|
IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
|
||||||
|
|
||||||
|
// Color Utilities
|
||||||
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in);
|
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in);
|
||||||
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in);
|
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in);
|
||||||
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
|
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
|
||||||
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
||||||
|
|
||||||
// Inputs
|
// Inputs Utilities
|
||||||
IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); // map ImGuiKey_* values into user's key index. == io.KeyMap[key]
|
IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); // map ImGuiKey_* values into user's key index. == io.KeyMap[key]
|
||||||
IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index]. note that imgui doesn't know the semantic of each entry of io.KeysDown[]. Use your own indices/enums according to how your backend/engine stored them into io.KeysDown[]!
|
IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index]. note that imgui doesn't know the semantic of each entry of io.KeysDown[]. Use your own indices/enums according to how your backend/engine stored them into io.KeysDown[]!
|
||||||
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true); // was key pressed (went from !Down to Down). if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate
|
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true); // was key pressed (went from !Down to Down). if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate
|
||||||
@ -611,8 +620,9 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
|
ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
|
||||||
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it
|
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it
|
||||||
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
|
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
|
||||||
|
ImGuiWindowFlags_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).
|
||||||
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
||||||
ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs, hovering test with pass through.
|
ImGuiWindowFlags_NoMouseInputs = 1 << 9, // Disable catching mouse, hovering test with pass through.
|
||||||
ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar
|
ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar
|
||||||
ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.
|
ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.
|
||||||
ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state
|
ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state
|
||||||
@ -623,6 +633,8 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
||||||
ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
|
ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
|
||||||
ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||||
|
ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse,
|
||||||
|
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
||||||
@ -647,10 +659,10 @@ enum ImGuiInputTextFlags_
|
|||||||
ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs
|
ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs
|
||||||
ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus
|
ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified)
|
ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified)
|
||||||
ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Call user function on pressing TAB (for completion handling)
|
ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Callback on pressing TAB (for completion handling)
|
||||||
ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Call user function on pressing Up/Down arrows (for history handling)
|
ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Callback on pressing Up/Down arrows (for history handling)
|
||||||
ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Call user function every time. User code may query cursor position, modify text buffer.
|
ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Callback on each iteration. User code may query cursor position, modify text buffer.
|
||||||
ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 in callback to discard character.
|
ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
|
||||||
ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field
|
ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field
|
||||||
ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
|
ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
|
||||||
ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally
|
ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally
|
||||||
@ -659,7 +671,7 @@ enum ImGuiInputTextFlags_
|
|||||||
ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*'
|
ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*'
|
||||||
ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
|
ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
|
||||||
ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
|
ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
|
||||||
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Allow buffer capacity resize + notify when the string wants to be resized (for string types which hold a cache of their Size) (see misc/stl/imgui_stl.h for an example of using this)
|
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiInputTextFlags_Multiline = 1 << 20 // For internal use by InputTextMultiline()
|
ImGuiInputTextFlags_Multiline = 1 << 20 // For internal use by InputTextMultiline()
|
||||||
};
|
};
|
||||||
@ -720,7 +732,7 @@ enum ImGuiFocusedFlags_
|
|||||||
ImGuiFocusedFlags_None = 0,
|
ImGuiFocusedFlags_None = 0,
|
||||||
ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused
|
ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused
|
||||||
ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
|
ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused
|
ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use ImGui::GetIO().WantCaptureMouse instead.
|
||||||
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1204,6 +1216,8 @@ struct ImGuiIO
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
// OBSOLETED in 1.66 (from Sep 2018)
|
||||||
|
static inline void SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); }
|
||||||
// OBSOLETED in 1.63 (from Aug 2018)
|
// OBSOLETED in 1.63 (from Aug 2018)
|
||||||
static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); }
|
static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); }
|
||||||
// OBSOLETED in 1.61 (from Apr 2018)
|
// OBSOLETED in 1.61 (from Apr 2018)
|
||||||
@ -1255,7 +1269,7 @@ public:
|
|||||||
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
||||||
inline ~ImVector() { if (Data) ImGui::MemFree(Data); }
|
inline ~ImVector() { if (Data) ImGui::MemFree(Data); }
|
||||||
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
||||||
inline ImVector& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; }
|
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; }
|
||||||
|
|
||||||
inline bool empty() const { return Size == 0; }
|
inline bool empty() const { return Size == 0; }
|
||||||
inline int size() const { return Size; }
|
inline int size() const { return Size; }
|
||||||
@ -1355,25 +1369,27 @@ struct ImGuiTextFilter
|
|||||||
int CountGrep;
|
int CountGrep;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper: Text buffer for logging/accumulating text
|
// Helper: Growable text buffer for logging/accumulating text
|
||||||
|
// (this could be called 'ImGuiTextBuilder' / 'ImGuiStringBuilder')
|
||||||
struct ImGuiTextBuffer
|
struct ImGuiTextBuffer
|
||||||
{
|
{
|
||||||
ImVector<char> Buf;
|
ImVector<char> Buf;
|
||||||
|
static char EmptyString[1];
|
||||||
|
|
||||||
ImGuiTextBuffer() { Buf.push_back(0); }
|
ImGuiTextBuffer() { }
|
||||||
inline char operator[](int i) { return Buf.Data[i]; }
|
inline char operator[](int i) { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }
|
||||||
const char* begin() const { return &Buf.front(); }
|
const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; }
|
||||||
const char* end() const { return &Buf.back(); } // Buf is zero-terminated, so end() will point on the zero-terminator
|
const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator
|
||||||
int size() const { return Buf.Size - 1; }
|
int size() const { return Buf.Data ? Buf.Size - 1 : 0; }
|
||||||
bool empty() { return Buf.Size <= 1; }
|
bool empty() { return Buf.Size <= 1; }
|
||||||
void clear() { Buf.clear(); Buf.push_back(0); }
|
void clear() { Buf.clear(); }
|
||||||
void reserve(int capacity) { Buf.reserve(capacity); }
|
void reserve(int capacity) { Buf.reserve(capacity); }
|
||||||
const char* c_str() const { return Buf.Data; }
|
const char* c_str() const { return Buf.Data ? Buf.Data : EmptyString; }
|
||||||
IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2);
|
IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2);
|
||||||
IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2);
|
IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper: key->value storage
|
// Helper: Key->Value storage
|
||||||
// Typically you don't have to worry about this since a storage is held within each Window.
|
// Typically you don't have to worry about this since a storage is held within each Window.
|
||||||
// We use it to e.g. store collapse state for a tree (Int 0/1)
|
// We use it to e.g. store collapse state for a tree (Int 0/1)
|
||||||
// This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame)
|
// This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame)
|
||||||
@ -1424,9 +1440,12 @@ struct ImGuiStorage
|
|||||||
|
|
||||||
// Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used.
|
// Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used.
|
||||||
// The callback function should return 0 by default.
|
// The callback function should return 0 by default.
|
||||||
// Special processing:
|
// Callbacks (follow a flag name and see comments in ImGuiInputTextFlags_ declarations for more details)
|
||||||
// - ImGuiInputTextFlags_CallbackCharFilter: return 1 if the character is not allowed. You may also set 'EventChar=0' as any character replacement are allowed.
|
// - ImGuiInputTextFlags_CallbackCompletion: Callback on pressing TAB
|
||||||
// - ImGuiInputTextFlags_CallbackResize: notified by InputText() when the string is resized. BufTextLen is set to the new desired string length so you can update the string size on your side of the fence. You can also replace Buf pointer if your underlying data is reallocated. No need to initialize new characters or zero-terminator as InputText will do it right after the resize callback.
|
// - ImGuiInputTextFlags_CallbackHistory: Callback on pressing Up/Down arrows
|
||||||
|
// - ImGuiInputTextFlags_CallbackAlways: Callback on each iteration
|
||||||
|
// - ImGuiInputTextFlags_CallbackCharFilter: Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
|
||||||
|
// - ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow.
|
||||||
struct ImGuiInputTextCallbackData
|
struct ImGuiInputTextCallbackData
|
||||||
{
|
{
|
||||||
ImGuiInputTextFlags EventFlag; // One ImGuiInputTextFlags_Callback* // Read-only
|
ImGuiInputTextFlags EventFlag; // One ImGuiInputTextFlags_Callback* // Read-only
|
||||||
@ -1436,19 +1455,19 @@ struct ImGuiInputTextCallbackData
|
|||||||
// Arguments for the different callback events
|
// Arguments for the different callback events
|
||||||
// - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary.
|
// - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary.
|
||||||
// - If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so InputText can update its internal state.
|
// - If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so InputText can update its internal state.
|
||||||
ImWchar EventChar; // Character input // Read-write // [CharFilter] Replace character or set to zero. return 1 is equivalent to setting EventChar=0;
|
ImWchar EventChar; // Character input // Read-write // [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0;
|
||||||
ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only // [Completion,History]
|
ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only // [Completion,History]
|
||||||
char* Buf; // Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer!
|
char* Buf; // Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer!
|
||||||
int BufTextLen; // Text length in bytes // Read-write // [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length()
|
int BufTextLen; // Text length (in bytes) // Read-write // [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length()
|
||||||
int BufSize; // Buffer capacity in bytes // Read-only // [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1
|
int BufSize; // Buffer size (in bytes) = capacity+1 // Read-only // [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1
|
||||||
bool BufDirty; // Set if you modify Buf/BufTextLen!! // Write // [Completion,History,Always]
|
bool BufDirty; // Set if you modify Buf/BufTextLen! // Write // [Completion,History,Always]
|
||||||
int CursorPos; // // Read-write // [Completion,History,Always]
|
int CursorPos; // // Read-write // [Completion,History,Always]
|
||||||
int SelectionStart; // // Read-write // [Completion,History,Always] == to SelectionEnd when no selection)
|
int SelectionStart; // // Read-write // [Completion,History,Always] == to SelectionEnd when no selection)
|
||||||
int SelectionEnd; // // Read-write // [Completion,History,Always]
|
int SelectionEnd; // // Read-write // [Completion,History,Always]
|
||||||
|
|
||||||
// Helper functions for text manipulation.
|
// Helper functions for text manipulation.
|
||||||
// Use those function to benefit from the CallbackResize behaviors. Calling those function reset the selection.
|
// Use those function to benefit from the CallbackResize behaviors. Calling those function reset the selection.
|
||||||
ImGuiInputTextCallbackData();
|
IMGUI_API ImGuiInputTextCallbackData();
|
||||||
IMGUI_API void DeleteChars(int pos, int bytes_count);
|
IMGUI_API void DeleteChars(int pos, int bytes_count);
|
||||||
IMGUI_API void InsertChars(int pos, const char* text, const char* text_end = NULL);
|
IMGUI_API void InsertChars(int pos, const char* text, const char* text_end = NULL);
|
||||||
bool HasSelection() const { return SelectionStart != SelectionEnd; }
|
bool HasSelection() const { return SelectionStart != SelectionEnd; }
|
||||||
@ -1581,7 +1600,7 @@ struct ImDrawCmd
|
|||||||
ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
|
ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
|
||||||
void* UserCallbackData; // The draw callback code can access this.
|
void* UserCallbackData; // The draw callback code can access this.
|
||||||
|
|
||||||
ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = NULL; UserCallback = NULL; UserCallbackData = NULL; }
|
ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = (ImTextureID)NULL; UserCallback = NULL; UserCallbackData = NULL; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Vertex index (override with '#define ImDrawIdx unsigned int' inside in imconfig.h)
|
// Vertex index (override with '#define ImDrawIdx unsigned int' inside in imconfig.h)
|
||||||
@ -1920,7 +1939,7 @@ struct ImFont
|
|||||||
ImVec2 DisplayOffset; // = (0.f,0.f) // Offset font rendering by xx pixels
|
ImVec2 DisplayOffset; // = (0.f,0.f) // Offset font rendering by xx pixels
|
||||||
ImVector<ImFontGlyph> Glyphs; // // All glyphs.
|
ImVector<ImFontGlyph> Glyphs; // // All glyphs.
|
||||||
ImVector<float> IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
|
ImVector<float> IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
|
||||||
ImVector<unsigned short> IndexLookup; // // Sparse. Index glyphs by Unicode code-point.
|
ImVector<ImWchar> IndexLookup; // // Sparse. Index glyphs by Unicode code-point.
|
||||||
const ImFontGlyph* FallbackGlyph; // == FindGlyph(FontFallbackChar)
|
const ImFontGlyph* FallbackGlyph; // == FindGlyph(FontFallbackChar)
|
||||||
float FallbackAdvanceX; // == FallbackGlyph->AdvanceX
|
float FallbackAdvanceX; // == FallbackGlyph->AdvanceX
|
||||||
ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
|
ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
|
||||||
@ -1949,7 +1968,7 @@ struct ImFont
|
|||||||
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
||||||
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8
|
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8
|
||||||
IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
|
IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
|
||||||
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const;
|
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const;
|
||||||
IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;
|
IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
|
216
imgui_demo.cpp
216
imgui_demo.cpp
@ -1,22 +1,25 @@
|
|||||||
// dear imgui, v1.65
|
// dear imgui, v1.66
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Message to the person tempted to delete this file when integrating ImGui into their code base:
|
// Message to the person tempted to delete this file when integrating Dear ImGui into their code base:
|
||||||
// Don't do it! Do NOT remove this file from your project! It is useful reference code that you and other users will want to refer to.
|
// Do NOT remove this file from your project! Think again! It is the most useful reference code that you and other coders
|
||||||
|
// will want to refer to and call. Have the ImGui::ShowDemoWindow() function wired in an always-available debug menu of
|
||||||
|
// your game/app! Removing this file from your project is hindering access to documentation for everyone in your team,
|
||||||
|
// likely leading you to poorer usage of the library.
|
||||||
// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow().
|
// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow().
|
||||||
// During development, you can call ImGui::ShowDemoWindow() in your code to learn about various features of ImGui. Have it wired in a debug menu!
|
// If you want to link core Dear ImGui in your shipped builds but want an easy guarantee that the demo will not be linked,
|
||||||
// Removing this file from your project is hindering access to documentation for everyone in your team, likely leading you to poorer usage of the library.
|
// you can setup your imconfig.h with #define IMGUI_DISABLE_DEMO_WINDOWS and those functions will be empty.
|
||||||
// Note that you can #define IMGUI_DISABLE_DEMO_WINDOWS in imconfig.h for the same effect.
|
// In other situation, whenever you have Dear ImGui available you probably want this to be available for reference.
|
||||||
// If you want to link core ImGui in your final builds but not those demo windows, #define IMGUI_DISABLE_DEMO_WINDOWS in imconfig.h and those functions will be empty.
|
|
||||||
// In other situation, when you have ImGui available you probably want this to be available for reference and execution.
|
|
||||||
// Thank you,
|
// Thank you,
|
||||||
// -Your beloved friend, imgui_demo.cpp (that you won't delete)
|
// -Your beloved friend, imgui_demo.cpp (that you won't delete)
|
||||||
|
|
||||||
// Message to beginner C/C++ programmers about the meaning of the 'static' keyword: in this demo code, we frequently we use 'static' variables inside functions.
|
// Message to beginner C/C++ programmers about the meaning of the 'static' keyword:
|
||||||
// A static variable persist across calls, so it is essentially like a global variable but declared inside the scope of the function.
|
// In this demo code, we frequently we use 'static' variables inside functions. A static variable persist across calls, so it is
|
||||||
// We do this as a way to gather code and data in the same place, just to make the demo code faster to read, faster to write, and use less code.
|
// essentially like a global variable but declared inside the scope of the function. We do this as a way to gather code and data
|
||||||
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant or used in threads.
|
// in the same place, to make the demo source code faster to read, faster to write, and smaller in size.
|
||||||
// This might be a pattern you occasionally want to use in your code, but most of the real data you would be editing is likely to be stored outside your functions.
|
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant
|
||||||
|
// or used in threads. This might be a pattern you will want to use in your code, but most of the real data you would be editing is
|
||||||
|
// likely going to be stored outside your functions.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -152,6 +155,13 @@ void ImGui::ShowUserGuide()
|
|||||||
// [SECTION] Demo Window / ShowDemoWindow()
|
// [SECTION] Demo Window / ShowDemoWindow()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// We split the contents of the big ShowDemoWindow() function into smaller functions (because the link time of very large functions grow non-linearly)
|
||||||
|
static void ShowDemoWindowWidgets();
|
||||||
|
static void ShowDemoWindowLayout();
|
||||||
|
static void ShowDemoWindowPopups();
|
||||||
|
static void ShowDemoWindowColumns();
|
||||||
|
static void ShowDemoWindowMisc();
|
||||||
|
|
||||||
// Demonstrate most Dear ImGui features (this is big function!)
|
// Demonstrate most Dear ImGui features (this is big function!)
|
||||||
// You may execute this function to experiment with the UI and understand what it does. You may then search for keywords in the code when you are interested by a specific feature.
|
// You may execute this function to experiment with the UI and understand what it does. You may then search for keywords in the code when you are interested by a specific feature.
|
||||||
void ImGui::ShowDemoWindow(bool* p_open)
|
void ImGui::ShowDemoWindow(bool* p_open)
|
||||||
@ -207,6 +217,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
static bool no_collapse = false;
|
static bool no_collapse = false;
|
||||||
static bool no_close = false;
|
static bool no_close = false;
|
||||||
static bool no_nav = false;
|
static bool no_nav = false;
|
||||||
|
static bool no_background = false;
|
||||||
|
static bool no_bring_to_front = false;
|
||||||
|
|
||||||
ImGuiWindowFlags window_flags = 0;
|
ImGuiWindowFlags window_flags = 0;
|
||||||
if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;
|
if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;
|
||||||
@ -216,6 +228,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (no_resize) window_flags |= ImGuiWindowFlags_NoResize;
|
if (no_resize) window_flags |= ImGuiWindowFlags_NoResize;
|
||||||
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
||||||
if (no_nav) window_flags |= ImGuiWindowFlags_NoNav;
|
if (no_nav) window_flags |= ImGuiWindowFlags_NoNav;
|
||||||
|
if (no_background) window_flags |= ImGuiWindowFlags_NoBackground;
|
||||||
|
if (no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||||
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
||||||
|
|
||||||
// We specify a default position/size in case there's no data in the .ini file. Typically this isn't required! We only do it to make the Demo applications a little more welcoming.
|
// We specify a default position/size in case there's no data in the .ini file. Typically this isn't required! We only do it to make the Demo applications a little more welcoming.
|
||||||
@ -359,11 +373,27 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Checkbox("No resize", &no_resize); ImGui::SameLine(300);
|
ImGui::Checkbox("No resize", &no_resize); ImGui::SameLine(300);
|
||||||
ImGui::Checkbox("No collapse", &no_collapse);
|
ImGui::Checkbox("No collapse", &no_collapse);
|
||||||
ImGui::Checkbox("No close", &no_close); ImGui::SameLine(150);
|
ImGui::Checkbox("No close", &no_close); ImGui::SameLine(150);
|
||||||
ImGui::Checkbox("No nav", &no_nav);
|
ImGui::Checkbox("No nav", &no_nav); ImGui::SameLine(300);
|
||||||
|
ImGui::Checkbox("No background", &no_background);
|
||||||
|
ImGui::Checkbox("No bring to front", &no_bring_to_front);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Widgets"))
|
// All demo contents
|
||||||
{
|
ShowDemoWindowWidgets();
|
||||||
|
ShowDemoWindowLayout();
|
||||||
|
ShowDemoWindowPopups();
|
||||||
|
ShowDemoWindowColumns();
|
||||||
|
ShowDemoWindowMisc();
|
||||||
|
|
||||||
|
// End of ShowDemoWindow()
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ShowDemoWindowWidgets()
|
||||||
|
{
|
||||||
|
if (!ImGui::CollapsingHeader("Widgets"))
|
||||||
|
return;
|
||||||
|
|
||||||
if (ImGui::TreeNode("Basic"))
|
if (ImGui::TreeNode("Basic"))
|
||||||
{
|
{
|
||||||
static int clicked = 0;
|
static int clicked = 0;
|
||||||
@ -386,7 +416,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.
|
// Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.
|
||||||
for (int i = 0; i < 7; i++)
|
for (int i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
if (i > 0) ImGui::SameLine();
|
if (i > 0)
|
||||||
|
ImGui::SameLine();
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.6f));
|
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.6f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.7f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.7f));
|
||||||
@ -396,7 +427,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arrow buttons
|
// Use AlignTextToFramePadding() to align text baseline to the baseline of framed elements (otherwise a Text+SameLine+Button sequence will have the text a little too high by default)
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::Text("Hold to repeat:");
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
// Arrow buttons with Repeater
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
||||||
ImGui::PushButtonRepeat(true);
|
ImGui::PushButtonRepeat(true);
|
||||||
@ -439,7 +475,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
static char str0[128] = "Hello, world!";
|
static char str0[128] = "Hello, world!";
|
||||||
static int i0 = 123;
|
static int i0 = 123;
|
||||||
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
||||||
ImGui::SameLine(); ShowHelpMarker("USER:\nHold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See misc/stl/imgui_stl.h for an example (this is not demonstrated in imgui_demo.cpp).");
|
ImGui::SameLine(); ShowHelpMarker("USER:\nHold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example (this is not demonstrated in imgui_demo.cpp).");
|
||||||
|
|
||||||
ImGui::InputInt("input int", &i0);
|
ImGui::InputInt("input int", &i0);
|
||||||
ImGui::SameLine(); ShowHelpMarker("You can apply arithmetic operators +,*,/ on numerical values.\n e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\nUse +- to subtract.\n");
|
ImGui::SameLine(); ShowHelpMarker("You can apply arithmetic operators +,*,/ on numerical values.\n e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\nUse +- to subtract.\n");
|
||||||
@ -586,13 +622,13 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Checkbox("Enable extra group", &closable_group);
|
ImGui::Checkbox("Enable extra group", &closable_group);
|
||||||
if (ImGui::CollapsingHeader("Header"))
|
if (ImGui::CollapsingHeader("Header"))
|
||||||
{
|
{
|
||||||
ImGui::Text("IsItemHovered: %d", IsItemHovered());
|
ImGui::Text("IsItemHovered: %d", ImGui::IsItemHovered());
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
ImGui::Text("Some content %d", i);
|
ImGui::Text("Some content %d", i);
|
||||||
}
|
}
|
||||||
if (ImGui::CollapsingHeader("Header with a close button", &closable_group))
|
if (ImGui::CollapsingHeader("Header with a close button", &closable_group))
|
||||||
{
|
{
|
||||||
ImGui::Text("IsItemHovered: %d", IsItemHovered());
|
ImGui::Text("IsItemHovered: %d", ImGui::IsItemHovered());
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
ImGui::Text("More content %d", i);
|
ImGui::Text("More content %d", i);
|
||||||
}
|
}
|
||||||
@ -658,7 +694,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application!
|
// Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application!
|
||||||
// Please use u8"text in any language" in your application!
|
// Please use u8"text in any language" in your application!
|
||||||
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
||||||
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->LoadFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details.");
|
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->AddFontFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details.");
|
||||||
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
||||||
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
||||||
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
||||||
@ -886,7 +922,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
"label:\n"
|
"label:\n"
|
||||||
"\tlock cmpxchg8b eax\n";
|
"\tlock cmpxchg8b eax\n";
|
||||||
|
|
||||||
ShowHelpMarker("You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/stl/imgui_stl.h for an example. (This is not demonstrated in imgui_demo.cpp)");
|
ShowHelpMarker("You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example. (This is not demonstrated in imgui_demo.cpp)");
|
||||||
ImGui::Checkbox("Read-only", &read_only);
|
ImGui::Checkbox("Read-only", &read_only);
|
||||||
ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput | (read_only ? ImGuiInputTextFlags_ReadOnly : 0);
|
ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput | (read_only ? ImGuiInputTextFlags_ReadOnly : 0);
|
||||||
ImGui::InputTextMultiline("##source", text, IM_ARRAYSIZE(text), ImVec2(-1.0f, ImGui::GetTextLineHeight() * 16), flags);
|
ImGui::InputTextMultiline("##source", text, IM_ARRAYSIZE(text), ImVec2(-1.0f, ImGui::GetTextLineHeight() * 16), flags);
|
||||||
@ -1034,11 +1070,11 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
|
|
||||||
if (ImGui::BeginDragDropTarget())
|
if (ImGui::BeginDragDropTarget())
|
||||||
{
|
{
|
||||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
|
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
|
||||||
memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 3);
|
memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 3);
|
||||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))
|
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))
|
||||||
memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 4);
|
memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 4);
|
||||||
EndDragDropTarget();
|
ImGui::EndDragDropTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
@ -1454,7 +1490,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Text("This is another child window for testing with the _ChildWindows flag.");
|
ImGui::Text("This is another child window for testing with the _ChildWindows flag.");
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
if (embed_all_inside_a_child_window)
|
if (embed_all_inside_a_child_window)
|
||||||
EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
// Calling IsItemHovered() after begin returns the hovered status of the title bar.
|
// Calling IsItemHovered() after begin returns the hovered status of the title bar.
|
||||||
// This is useful in particular if you want to create a context menu (with BeginPopupContextItem) associated to the title bar of a window.
|
// This is useful in particular if you want to create a context menu (with BeginPopupContextItem) associated to the title bar of a window.
|
||||||
@ -1477,10 +1513,13 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ShowDemoWindowLayout()
|
||||||
|
{
|
||||||
|
if (!ImGui::CollapsingHeader("Layout"))
|
||||||
|
return;
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Layout"))
|
|
||||||
{
|
|
||||||
if (ImGui::TreeNode("Child regions"))
|
if (ImGui::TreeNode("Child regions"))
|
||||||
{
|
{
|
||||||
static bool disable_mouse_wheel = false;
|
static bool disable_mouse_wheel = false;
|
||||||
@ -1502,10 +1541,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
{
|
{
|
||||||
ImGui::Text("%04d: scrollable region", i);
|
ImGui::Text("%04d: scrollable region", i);
|
||||||
if (goto_line && line == i)
|
if (goto_line && line == i)
|
||||||
ImGui::SetScrollHere();
|
ImGui::SetScrollHereY();
|
||||||
}
|
}
|
||||||
if (goto_line && line >= 100)
|
if (goto_line && line >= 100)
|
||||||
ImGui::SetScrollHere();
|
ImGui::SetScrollHereY();
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1514,7 +1553,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Child 2: rounded border
|
// Child 2: rounded border
|
||||||
{
|
{
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
||||||
ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar));
|
ImGui::BeginChild("Child2", ImVec2(0, 300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar));
|
||||||
if (!disable_menu && ImGui::BeginMenuBar())
|
if (!disable_menu && ImGui::BeginMenuBar())
|
||||||
{
|
{
|
||||||
if (ImGui::BeginMenu("Menu"))
|
if (ImGui::BeginMenu("Menu"))
|
||||||
@ -1608,21 +1647,21 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::SameLine(300); ImGui::SmallButton("x=300");
|
ImGui::SameLine(300); ImGui::SmallButton("x=300");
|
||||||
|
|
||||||
// Checkbox
|
// Checkbox
|
||||||
static bool c1=false,c2=false,c3=false,c4=false;
|
static bool c1 = false, c2 = false, c3 = false, c4 = false;
|
||||||
ImGui::Checkbox("My", &c1); ImGui::SameLine();
|
ImGui::Checkbox("My", &c1); ImGui::SameLine();
|
||||||
ImGui::Checkbox("Tailor", &c2); ImGui::SameLine();
|
ImGui::Checkbox("Tailor", &c2); ImGui::SameLine();
|
||||||
ImGui::Checkbox("Is", &c3); ImGui::SameLine();
|
ImGui::Checkbox("Is", &c3); ImGui::SameLine();
|
||||||
ImGui::Checkbox("Rich", &c4);
|
ImGui::Checkbox("Rich", &c4);
|
||||||
|
|
||||||
// Various
|
// Various
|
||||||
static float f0=1.0f, f1=2.0f, f2=3.0f;
|
static float f0 = 1.0f, f1 = 2.0f, f2 = 3.0f;
|
||||||
ImGui::PushItemWidth(80);
|
ImGui::PushItemWidth(80);
|
||||||
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD" };
|
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD" };
|
||||||
static int item = -1;
|
static int item = -1;
|
||||||
ImGui::Combo("Combo", &item, items, IM_ARRAYSIZE(items)); ImGui::SameLine();
|
ImGui::Combo("Combo", &item, items, IM_ARRAYSIZE(items)); ImGui::SameLine();
|
||||||
ImGui::SliderFloat("X", &f0, 0.0f,5.0f); ImGui::SameLine();
|
ImGui::SliderFloat("X", &f0, 0.0f, 5.0f); ImGui::SameLine();
|
||||||
ImGui::SliderFloat("Y", &f1, 0.0f,5.0f); ImGui::SameLine();
|
ImGui::SliderFloat("Y", &f1, 0.0f, 5.0f); ImGui::SameLine();
|
||||||
ImGui::SliderFloat("Z", &f2, 0.0f,5.0f);
|
ImGui::SliderFloat("Z", &f2, 0.0f, 5.0f);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
ImGui::PushItemWidth(80);
|
ImGui::PushItemWidth(80);
|
||||||
@ -1639,7 +1678,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
// Dummy
|
// Dummy
|
||||||
ImVec2 button_sz(40,40);
|
ImVec2 button_sz(40, 40);
|
||||||
ImGui::Button("A", button_sz); ImGui::SameLine();
|
ImGui::Button("A", button_sz); ImGui::SameLine();
|
||||||
ImGui::Dummy(button_sz); ImGui::SameLine();
|
ImGui::Dummy(button_sz); ImGui::SameLine();
|
||||||
ImGui::Button("B", button_sz);
|
ImGui::Button("B", button_sz);
|
||||||
@ -1688,9 +1727,9 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
const float values[5] = { 0.5f, 0.20f, 0.80f, 0.60f, 0.25f };
|
const float values[5] = { 0.5f, 0.20f, 0.80f, 0.60f, 0.25f };
|
||||||
ImGui::PlotHistogram("##values", values, IM_ARRAYSIZE(values), 0, NULL, 0.0f, 1.0f, size);
|
ImGui::PlotHistogram("##values", values, IM_ARRAYSIZE(values), 0, NULL, 0.0f, 1.0f, size);
|
||||||
|
|
||||||
ImGui::Button("ACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f,size.y));
|
ImGui::Button("ACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f, size.y));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Button("REACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f,size.y));
|
ImGui::Button("REACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f, size.y));
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
@ -1764,7 +1803,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
|
|
||||||
if (ImGui::TreeNode("Scrolling"))
|
if (ImGui::TreeNode("Scrolling"))
|
||||||
{
|
{
|
||||||
ImGui::TextWrapped("(Use SetScrollHere() or SetScrollFromPosY() to scroll to a given position.)");
|
ImGui::TextWrapped("(Use SetScrollHereY() or SetScrollFromPosY() to scroll to a given position.)");
|
||||||
static bool track = true;
|
static bool track = true;
|
||||||
static int track_line = 50, scroll_to_px = 200;
|
static int track_line = 50, scroll_to_px = 200;
|
||||||
ImGui::Checkbox("Track", &track);
|
ImGui::Checkbox("Track", &track);
|
||||||
@ -1787,8 +1826,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
{
|
{
|
||||||
if (track && line == track_line)
|
if (track && line == track_line)
|
||||||
{
|
{
|
||||||
ImGui::TextColored(ImColor(255,255,0), "Line %d", line);
|
ImGui::TextColored(ImVec4(1,1,0,1), "Line %d", line);
|
||||||
ImGui::SetScrollHere(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom
|
ImGui::SetScrollHereY(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1811,7 +1850,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::SliderInt("Lines", &lines, 1, 15);
|
ImGui::SliderInt("Lines", &lines, 1, 15);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 1.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 1.0f));
|
||||||
ImGui::BeginChild("scrolling", ImVec2(0, ImGui::GetFrameHeightWithSpacing()*7 + 30), true, ImGuiWindowFlags_HorizontalScrollbar);
|
ImGui::BeginChild("scrolling", ImVec2(0, ImGui::GetFrameHeightWithSpacing() * 7 + 30), true, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
for (int line = 0; line < lines; line++)
|
for (int line = 0; line < lines; line++)
|
||||||
{
|
{
|
||||||
// Display random stuff (for the sake of this trivial demo we are using basic Button+SameLine. If you want to create your own time line for a real application you may be better off
|
// Display random stuff (for the sake of this trivial demo we are using basic Button+SameLine. If you want to create your own time line for a real application you may be better off
|
||||||
@ -1857,17 +1896,35 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::DragFloat2("size", (float*)&size, 0.5f, 0.0f, 200.0f, "%.0f");
|
ImGui::DragFloat2("size", (float*)&size, 0.5f, 0.0f, 200.0f, "%.0f");
|
||||||
ImGui::TextWrapped("(Click and drag)");
|
ImGui::TextWrapped("(Click and drag)");
|
||||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||||
ImVec4 clip_rect(pos.x, pos.y, pos.x+size.x, pos.y+size.y);
|
ImVec4 clip_rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y);
|
||||||
ImGui::InvisibleButton("##dummy", size);
|
ImGui::InvisibleButton("##dummy", size);
|
||||||
if (ImGui::IsItemActive() && ImGui::IsMouseDragging()) { offset.x += ImGui::GetIO().MouseDelta.x; offset.y += ImGui::GetIO().MouseDelta.y; }
|
if (ImGui::IsItemActive() && ImGui::IsMouseDragging()) { offset.x += ImGui::GetIO().MouseDelta.x; offset.y += ImGui::GetIO().MouseDelta.y; }
|
||||||
ImGui::GetWindowDrawList()->AddRectFilled(pos, ImVec2(pos.x+size.x,pos.y+size.y), IM_COL32(90,90,120,255));
|
ImGui::GetWindowDrawList()->AddRectFilled(pos, ImVec2(pos.x + size.x, pos.y + size.y), IM_COL32(90, 90, 120, 255));
|
||||||
ImGui::GetWindowDrawList()->AddText(ImGui::GetFont(), ImGui::GetFontSize()*2.0f, ImVec2(pos.x+offset.x,pos.y+offset.y), IM_COL32(255,255,255,255), "Line 1 hello\nLine 2 clip me!", NULL, 0.0f, &clip_rect);
|
ImGui::GetWindowDrawList()->AddText(ImGui::GetFont(), ImGui::GetFontSize()*2.0f, ImVec2(pos.x + offset.x, pos.y + offset.y), IM_COL32(255, 255, 255, 255), "Line 1 hello\nLine 2 clip me!", NULL, 0.0f, &clip_rect);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ShowDemoWindowPopups()
|
||||||
|
{
|
||||||
|
if (!ImGui::CollapsingHeader("Popups & Modal windows"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Popups are windows with a few special properties:
|
||||||
|
// - They block normal mouse hovering detection outside them. (*)
|
||||||
|
// - Unless modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
|
||||||
|
// - Their visibility state (~bool) is held internally by imgui instead of being held by the programmer as we are used to with regular Begin() calls.
|
||||||
|
// (*) One can use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) to bypass it and detect hovering even when normally blocked by a popup.
|
||||||
|
// Those three properties are intimately connected. The library needs to hold their visibility state because it can close popups at any time.
|
||||||
|
|
||||||
|
// Typical use for regular windows:
|
||||||
|
// bool my_tool_is_active = false; if (ImGui::Button("Open")) my_tool_is_active = true; [...] if (my_tool_is_active) Begin("My Tool", &my_tool_is_active) { [...] } End();
|
||||||
|
// Typical use for popups:
|
||||||
|
// if (ImGui::Button("Open")) ImGui::OpenPopup("MyPopup"); if (ImGui::BeginPopup("MyPopup") { [...] EndPopup(); }
|
||||||
|
|
||||||
|
// With popups we have to go through a library call (here OpenPopup) to manipulate the visibility state.
|
||||||
|
// This may be a bit confusing at first but it should quickly make sense. Follow on the examples below.
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Popups & Modal windows"))
|
|
||||||
{
|
|
||||||
if (ImGui::TreeNode("Popups"))
|
if (ImGui::TreeNode("Popups"))
|
||||||
{
|
{
|
||||||
ImGui::TextWrapped("When a popup is active, it inhibits interacting with windows that are behind the popup. Clicking outside the popup closes it.");
|
ImGui::TextWrapped("When a popup is active, it inhibits interacting with windows that are behind the popup. Clicking outside the popup closes it.");
|
||||||
@ -1879,10 +1936,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Simple selection popup
|
// Simple selection popup
|
||||||
// (If you want to show the current selection inside the Button itself, you may want to build a string using the "###" operator to preserve a constant ID with a variable label)
|
// (If you want to show the current selection inside the Button itself, you may want to build a string using the "###" operator to preserve a constant ID with a variable label)
|
||||||
if (ImGui::Button("Select.."))
|
if (ImGui::Button("Select.."))
|
||||||
ImGui::OpenPopup("select");
|
ImGui::OpenPopup("my_select_popup");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextUnformatted(selected_fish == -1 ? "<None>" : names[selected_fish]);
|
ImGui::TextUnformatted(selected_fish == -1 ? "<None>" : names[selected_fish]);
|
||||||
if (ImGui::BeginPopup("select"))
|
if (ImGui::BeginPopup("my_select_popup"))
|
||||||
{
|
{
|
||||||
ImGui::Text("Aquarium");
|
ImGui::Text("Aquarium");
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
@ -1894,8 +1951,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
|
|
||||||
// Showing a menu with toggles
|
// Showing a menu with toggles
|
||||||
if (ImGui::Button("Toggle.."))
|
if (ImGui::Button("Toggle.."))
|
||||||
ImGui::OpenPopup("toggle");
|
ImGui::OpenPopup("my_toggle_popup");
|
||||||
if (ImGui::BeginPopup("toggle"))
|
if (ImGui::BeginPopup("my_toggle_popup"))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(names); i++)
|
for (int i = 0; i < IM_ARRAYSIZE(names); i++)
|
||||||
ImGui::MenuItem(names[i], "", &toggles[i]);
|
ImGui::MenuItem(names[i], "", &toggles[i]);
|
||||||
@ -1926,9 +1983,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Popup Menu.."))
|
// Call the more complete ShowExampleMenuFile which we use in various places of this demo
|
||||||
ImGui::OpenPopup("FilePopup");
|
if (ImGui::Button("File Menu.."))
|
||||||
if (ImGui::BeginPopup("FilePopup"))
|
ImGui::OpenPopup("my_file_popup");
|
||||||
|
if (ImGui::BeginPopup("my_file_popup"))
|
||||||
{
|
{
|
||||||
ShowExampleMenuFile();
|
ShowExampleMenuFile();
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
@ -1940,7 +1998,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (ImGui::TreeNode("Context menus"))
|
if (ImGui::TreeNode("Context menus"))
|
||||||
{
|
{
|
||||||
// BeginPopupContextItem() is a helper to provide common/simple popup behavior of essentially doing:
|
// BeginPopupContextItem() is a helper to provide common/simple popup behavior of essentially doing:
|
||||||
// if (IsItemHovered() && IsMouseClicked(0))
|
// if (IsItemHovered() && IsMouseReleased(0))
|
||||||
// OpenPopup(id);
|
// OpenPopup(id);
|
||||||
// return BeginPopup(id);
|
// return BeginPopup(id);
|
||||||
// For more advanced uses you may want to replicate and cuztomize this code. This the comments inside BeginPopupContextItem() implementation.
|
// For more advanced uses you may want to replicate and cuztomize this code. This the comments inside BeginPopupContextItem() implementation.
|
||||||
@ -1956,10 +2014,18 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We can also use OpenPopupOnItemClick() which is the same as BeginPopupContextItem() but without the Begin call.
|
||||||
|
// So here we will make it that clicking on the text field with the right mouse button (1) will toggle the visibility of the popup above.
|
||||||
|
ImGui::Text("(You can also right-click me to the same popup as above.)");
|
||||||
|
ImGui::OpenPopupOnItemClick("item context menu", 1);
|
||||||
|
|
||||||
|
// When used after an item that has an ID (here the Button), we can skip providing an ID to BeginPopupContextItem().
|
||||||
|
// BeginPopupContextItem() will use the last item ID as the popup ID.
|
||||||
|
// In addition here, we want to include your editable label inside the button label. We use the ### operator to override the ID (read FAQ about ID for details)
|
||||||
static char name[32] = "Label1";
|
static char name[32] = "Label1";
|
||||||
char buf[64]; sprintf(buf, "Button: %s###Button", name); // ### operator override ID ignoring the preceding label
|
char buf[64]; sprintf(buf, "Button: %s###Button", name); // ### operator override ID ignoring the preceding label
|
||||||
ImGui::Button(buf);
|
ImGui::Button(buf);
|
||||||
if (ImGui::BeginPopupContextItem()) // When used after an item that has an ID (here the Button), we can skip providing an ID to BeginPopupContextItem().
|
if (ImGui::BeginPopupContextItem())
|
||||||
{
|
{
|
||||||
ImGui::Text("Edit name:");
|
ImGui::Text("Edit name:");
|
||||||
ImGui::InputText("##edit", name, IM_ARRAYSIZE(name));
|
ImGui::InputText("##edit", name, IM_ARRAYSIZE(name));
|
||||||
@ -1987,14 +2053,14 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
//ImGui::Combo("Combo", &dummy_i, "Delete\0Delete harder\0");
|
//ImGui::Combo("Combo", &dummy_i, "Delete\0Delete harder\0");
|
||||||
|
|
||||||
static bool dont_ask_me_next_time = false;
|
static bool dont_ask_me_next_time = false;
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||||
ImGui::Checkbox("Don't ask me next time", &dont_ask_me_next_time);
|
ImGui::Checkbox("Don't ask me next time", &dont_ask_me_next_time);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
if (ImGui::Button("OK", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); }
|
if (ImGui::Button("OK", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); }
|
||||||
ImGui::SetItemDefaultFocus();
|
ImGui::SetItemDefaultFocus();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Cancel", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); }
|
if (ImGui::Button("Cancel", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); }
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2044,10 +2110,13 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ShowDemoWindowColumns()
|
||||||
|
{
|
||||||
|
if (!ImGui::CollapsingHeader("Columns"))
|
||||||
|
return;
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Columns"))
|
|
||||||
{
|
|
||||||
ImGui::PushID("Columns");
|
ImGui::PushID("Columns");
|
||||||
|
|
||||||
// Basic columns
|
// Basic columns
|
||||||
@ -2224,8 +2293,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ShowDemoWindowMisc()
|
||||||
|
{
|
||||||
if (ImGui::CollapsingHeader("Filtering"))
|
if (ImGui::CollapsingHeader("Filtering"))
|
||||||
{
|
{
|
||||||
static ImGuiTextFilter filter;
|
static ImGuiTextFilter filter;
|
||||||
@ -2383,9 +2454,6 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of ShowDemoWindow()
|
|
||||||
ImGui::End();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -2474,8 +2542,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");
|
ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");
|
||||||
ImGui::Checkbox("Anti-aliased fill", &style.AntiAliasedFill);
|
ImGui::Checkbox("Anti-aliased fill", &style.AntiAliasedFill);
|
||||||
ImGui::PushItemWidth(100);
|
ImGui::PushItemWidth(100);
|
||||||
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, NULL, 2.0f);
|
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, "%.2f", 2.0f);
|
||||||
if (style.CurveTessellationTol < 0.0f) style.CurveTessellationTol = 0.10f;
|
if (style.CurveTessellationTol < 0.10f) style.CurveTessellationTol = 0.10f;
|
||||||
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -2883,7 +2951,7 @@ struct ExampleAppConsole
|
|||||||
if (copy_to_clipboard)
|
if (copy_to_clipboard)
|
||||||
ImGui::LogFinish();
|
ImGui::LogFinish();
|
||||||
if (ScrollToBottom)
|
if (ScrollToBottom)
|
||||||
ImGui::SetScrollHere(1.0f);
|
ImGui::SetScrollHereY(1.0f);
|
||||||
ScrollToBottom = false;
|
ScrollToBottom = false;
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
@ -3125,7 +3193,7 @@ struct ExampleAppLog
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ScrollToBottom)
|
if (ScrollToBottom)
|
||||||
ImGui::SetScrollHere(1.0f);
|
ImGui::SetScrollHereY(1.0f);
|
||||||
ScrollToBottom = false;
|
ScrollToBottom = false;
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.65
|
// dear imgui, v1.66
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -822,6 +822,9 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
|||||||
|
|
||||||
void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col)
|
void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col)
|
||||||
{
|
{
|
||||||
|
if (points_count < 3)
|
||||||
|
return;
|
||||||
|
|
||||||
const ImVec2 uv = _Data->TexUvWhitePixel;
|
const ImVec2 uv = _Data->TexUvWhitePixel;
|
||||||
|
|
||||||
if (Flags & ImDrawListFlags_AntiAliasedFill)
|
if (Flags & ImDrawListFlags_AntiAliasedFill)
|
||||||
@ -1392,7 +1395,7 @@ ImFontAtlas::ImFontAtlas()
|
|||||||
{
|
{
|
||||||
Locked = false;
|
Locked = false;
|
||||||
Flags = ImFontAtlasFlags_None;
|
Flags = ImFontAtlasFlags_None;
|
||||||
TexID = NULL;
|
TexID = (ImTextureID)NULL;
|
||||||
TexDesiredWidth = 0;
|
TexDesiredWidth = 0;
|
||||||
TexGlyphPadding = 1;
|
TexGlyphPadding = 1;
|
||||||
|
|
||||||
@ -1708,7 +1711,7 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
|
|
||||||
ImFontAtlasBuildRegisterDefaultCustomRects(atlas);
|
ImFontAtlasBuildRegisterDefaultCustomRects(atlas);
|
||||||
|
|
||||||
atlas->TexID = NULL;
|
atlas->TexID = (ImTextureID)NULL;
|
||||||
atlas->TexWidth = atlas->TexHeight = 0;
|
atlas->TexWidth = atlas->TexHeight = 0;
|
||||||
atlas->TexUvScale = ImVec2(0.0f, 0.0f);
|
atlas->TexUvScale = ImVec2(0.0f, 0.0f);
|
||||||
atlas->TexUvWhitePixel = ImVec2(0.0f, 0.0f);
|
atlas->TexUvWhitePixel = ImVec2(0.0f, 0.0f);
|
||||||
@ -1894,7 +1897,7 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const int codepoint = range.first_unicode_codepoint_in_range + char_idx;
|
const int codepoint = range.first_unicode_codepoint_in_range + char_idx;
|
||||||
if (cfg.MergeMode && dst_font->FindGlyphNoFallback((unsigned short)codepoint))
|
if (cfg.MergeMode && dst_font->FindGlyphNoFallback((ImWchar)codepoint))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float char_advance_x_org = pc.xadvance;
|
float char_advance_x_org = pc.xadvance;
|
||||||
@ -2316,21 +2319,21 @@ void ImFont::BuildLookupTable()
|
|||||||
{
|
{
|
||||||
int codepoint = (int)Glyphs[i].Codepoint;
|
int codepoint = (int)Glyphs[i].Codepoint;
|
||||||
IndexAdvanceX[codepoint] = Glyphs[i].AdvanceX;
|
IndexAdvanceX[codepoint] = Glyphs[i].AdvanceX;
|
||||||
IndexLookup[codepoint] = (unsigned short)i;
|
IndexLookup[codepoint] = (ImWchar)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a glyph to handle TAB
|
// Create a glyph to handle TAB
|
||||||
// FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at "column 0" ?)
|
// FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at "column 0" ?)
|
||||||
if (FindGlyph((unsigned short)' '))
|
if (FindGlyph((ImWchar)' '))
|
||||||
{
|
{
|
||||||
if (Glyphs.back().Codepoint != '\t') // So we can call this function multiple times
|
if (Glyphs.back().Codepoint != '\t') // So we can call this function multiple times
|
||||||
Glyphs.resize(Glyphs.Size + 1);
|
Glyphs.resize(Glyphs.Size + 1);
|
||||||
ImFontGlyph& tab_glyph = Glyphs.back();
|
ImFontGlyph& tab_glyph = Glyphs.back();
|
||||||
tab_glyph = *FindGlyph((unsigned short)' ');
|
tab_glyph = *FindGlyph((ImWchar)' ');
|
||||||
tab_glyph.Codepoint = '\t';
|
tab_glyph.Codepoint = '\t';
|
||||||
tab_glyph.AdvanceX *= 4;
|
tab_glyph.AdvanceX *= 4;
|
||||||
IndexAdvanceX[(int)tab_glyph.Codepoint] = (float)tab_glyph.AdvanceX;
|
IndexAdvanceX[(int)tab_glyph.Codepoint] = (float)tab_glyph.AdvanceX;
|
||||||
IndexLookup[(int)tab_glyph.Codepoint] = (unsigned short)(Glyphs.Size-1);
|
IndexLookup[(int)tab_glyph.Codepoint] = (ImWchar)(Glyphs.Size-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
FallbackGlyph = FindGlyphNoFallback(FallbackChar);
|
FallbackGlyph = FindGlyphNoFallback(FallbackChar);
|
||||||
@ -2352,7 +2355,7 @@ void ImFont::GrowIndex(int new_size)
|
|||||||
if (new_size <= IndexLookup.Size)
|
if (new_size <= IndexLookup.Size)
|
||||||
return;
|
return;
|
||||||
IndexAdvanceX.resize(new_size, -1.0f);
|
IndexAdvanceX.resize(new_size, -1.0f);
|
||||||
IndexLookup.resize(new_size, (unsigned short)-1);
|
IndexLookup.resize(new_size, (ImWchar)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// x0/y0/x1/y1 are offset from the character upper-left layout position, in pixels. Therefore x0/y0 are often fairly close to zero.
|
// x0/y0/x1/y1 are offset from the character upper-left layout position, in pixels. Therefore x0/y0 are often fairly close to zero.
|
||||||
@ -2385,13 +2388,13 @@ void ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst)
|
|||||||
IM_ASSERT(IndexLookup.Size > 0); // Currently this can only be called AFTER the font has been built, aka after calling ImFontAtlas::GetTexDataAs*() function.
|
IM_ASSERT(IndexLookup.Size > 0); // Currently this can only be called AFTER the font has been built, aka after calling ImFontAtlas::GetTexDataAs*() function.
|
||||||
int index_size = IndexLookup.Size;
|
int index_size = IndexLookup.Size;
|
||||||
|
|
||||||
if (dst < index_size && IndexLookup.Data[dst] == (unsigned short)-1 && !overwrite_dst) // 'dst' already exists
|
if (dst < index_size && IndexLookup.Data[dst] == (ImWchar)-1 && !overwrite_dst) // 'dst' already exists
|
||||||
return;
|
return;
|
||||||
if (src >= index_size && dst >= index_size) // both 'dst' and 'src' don't exist -> no-op
|
if (src >= index_size && dst >= index_size) // both 'dst' and 'src' don't exist -> no-op
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GrowIndex(dst + 1);
|
GrowIndex(dst + 1);
|
||||||
IndexLookup[dst] = (src < index_size) ? IndexLookup.Data[src] : (unsigned short)-1;
|
IndexLookup[dst] = (src < index_size) ? IndexLookup.Data[src] : (ImWchar)-1;
|
||||||
IndexAdvanceX[dst] = (src < index_size) ? IndexAdvanceX.Data[src] : 1.0f;
|
IndexAdvanceX[dst] = (src < index_size) ? IndexAdvanceX.Data[src] : 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2399,8 +2402,8 @@ const ImFontGlyph* ImFont::FindGlyph(ImWchar c) const
|
|||||||
{
|
{
|
||||||
if (c >= IndexLookup.Size)
|
if (c >= IndexLookup.Size)
|
||||||
return FallbackGlyph;
|
return FallbackGlyph;
|
||||||
const unsigned short i = IndexLookup[c];
|
const ImWchar i = IndexLookup[c];
|
||||||
if (i == (unsigned short)-1)
|
if (i == (ImWchar)-1)
|
||||||
return FallbackGlyph;
|
return FallbackGlyph;
|
||||||
return &Glyphs.Data[i];
|
return &Glyphs.Data[i];
|
||||||
}
|
}
|
||||||
@ -2409,8 +2412,8 @@ const ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) const
|
|||||||
{
|
{
|
||||||
if (c >= IndexLookup.Size)
|
if (c >= IndexLookup.Size)
|
||||||
return NULL;
|
return NULL;
|
||||||
const unsigned short i = IndexLookup[c];
|
const ImWchar i = IndexLookup[c];
|
||||||
if (i == (unsigned short)-1)
|
if (i == (ImWchar)-1)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &Glyphs.Data[i];
|
return &Glyphs.Data[i];
|
||||||
}
|
}
|
||||||
@ -2608,7 +2611,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
|||||||
return text_size;
|
return text_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const
|
void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const
|
||||||
{
|
{
|
||||||
if (c == ' ' || c == '\t' || c == '\n' || c == '\r') // Match behavior of RenderText(), those 4 codepoints are hard-coded.
|
if (c == ' ' || c == '\t' || c == '\n' || c == '\r') // Match behavior of RenderText(), those 4 codepoints are hard-coded.
|
||||||
return;
|
return;
|
||||||
@ -2643,11 +2646,10 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
|||||||
// Fast-forward to first visible line
|
// Fast-forward to first visible line
|
||||||
const char* s = text_begin;
|
const char* s = text_begin;
|
||||||
if (y + line_height < clip_rect.y && !word_wrap_enabled)
|
if (y + line_height < clip_rect.y && !word_wrap_enabled)
|
||||||
while (y + line_height < clip_rect.y)
|
while (y + line_height < clip_rect.y && s < text_end)
|
||||||
{
|
{
|
||||||
while (s < text_end)
|
s = (const char*)memchr(s, '\n', text_end - s);
|
||||||
if (*s++ == '\n')
|
s = s ? s + 1 : text_end;
|
||||||
break;
|
|
||||||
y += line_height;
|
y += line_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2657,15 +2659,16 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
|||||||
{
|
{
|
||||||
const char* s_end = s;
|
const char* s_end = s;
|
||||||
float y_end = y;
|
float y_end = y;
|
||||||
while (y_end < clip_rect.w)
|
while (y_end < clip_rect.w && s_end < text_end)
|
||||||
{
|
{
|
||||||
while (s_end < text_end)
|
s_end = (const char*)memchr(s_end, '\n', text_end - s_end);
|
||||||
if (*s_end++ == '\n')
|
s = s ? s + 1 : text_end;
|
||||||
break;
|
|
||||||
y_end += line_height;
|
y_end += line_height;
|
||||||
}
|
}
|
||||||
text_end = s_end;
|
text_end = s_end;
|
||||||
}
|
}
|
||||||
|
if (s == text_end)
|
||||||
|
return;
|
||||||
|
|
||||||
// Reserve vertices for remaining worse case (over-reserving is useful and easily amortized)
|
// Reserve vertices for remaining worse case (over-reserving is useful and easily amortized)
|
||||||
const int vtx_count_max = (int)(text_end - s) * 4;
|
const int vtx_count_max = (int)(text_end - s) * 4;
|
||||||
@ -2733,7 +2736,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
|||||||
}
|
}
|
||||||
|
|
||||||
float char_width = 0.0f;
|
float char_width = 0.0f;
|
||||||
if (const ImFontGlyph* glyph = FindGlyph((unsigned short)c))
|
if (const ImFontGlyph* glyph = FindGlyph((ImWchar)c))
|
||||||
{
|
{
|
||||||
char_width = glyph->AdvanceX * scale;
|
char_width = glyph->AdvanceX * scale;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.65
|
// dear imgui, v1.66
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
@ -63,6 +63,7 @@ typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // Flags:
|
|||||||
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
||||||
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for Separator() - internal
|
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for Separator() - internal
|
||||||
typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for SliderBehavior()
|
typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for SliderBehavior()
|
||||||
|
typedef int ImGuiDragFlags; // -> enum ImGuiDragFlags_ // Flags: for DragBehavior()
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// STB libraries
|
// STB libraries
|
||||||
@ -141,6 +142,7 @@ IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count);
|
|||||||
IMGUI_API char* ImStrdup(const char* str);
|
IMGUI_API char* ImStrdup(const char* str);
|
||||||
IMGUI_API const char* ImStrchrRange(const char* str_begin, const char* str_end, char c);
|
IMGUI_API const char* ImStrchrRange(const char* str_begin, const char* str_end, char c);
|
||||||
IMGUI_API int ImStrlenW(const ImWchar* str);
|
IMGUI_API int ImStrlenW(const ImWchar* str);
|
||||||
|
IMGUI_API const char* ImStreolRange(const char* str, const char* str_end); // End end-of-line
|
||||||
IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line
|
IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line
|
||||||
IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);
|
IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);
|
||||||
IMGUI_API void ImStrTrimBlanks(char* str);
|
IMGUI_API void ImStrTrimBlanks(char* str);
|
||||||
@ -248,6 +250,12 @@ enum ImGuiSliderFlags_
|
|||||||
ImGuiSliderFlags_Vertical = 1 << 0
|
ImGuiSliderFlags_Vertical = 1 << 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ImGuiDragFlags_
|
||||||
|
{
|
||||||
|
ImGuiDragFlags_None = 0,
|
||||||
|
ImGuiDragFlags_Vertical = 1 << 0
|
||||||
|
};
|
||||||
|
|
||||||
enum ImGuiColumnsFlags_
|
enum ImGuiColumnsFlags_
|
||||||
{
|
{
|
||||||
// Default: 0
|
// Default: 0
|
||||||
@ -649,7 +657,8 @@ struct ImGuiContext
|
|||||||
int FrameCount;
|
int FrameCount;
|
||||||
int FrameCountEnded;
|
int FrameCountEnded;
|
||||||
int FrameCountRendered;
|
int FrameCountRendered;
|
||||||
ImVector<ImGuiWindow*> Windows;
|
ImVector<ImGuiWindow*> Windows; // Windows, sorted in display order, back to front
|
||||||
|
ImVector<ImGuiWindow*> WindowsFocusOrder; // Windows, sorted in focus order, back to front
|
||||||
ImVector<ImGuiWindow*> WindowsSortBuffer;
|
ImVector<ImGuiWindow*> WindowsSortBuffer;
|
||||||
ImVector<ImGuiWindow*> CurrentWindowStack;
|
ImVector<ImGuiWindow*> CurrentWindowStack;
|
||||||
ImGuiStorage WindowsById;
|
ImGuiStorage WindowsById;
|
||||||
@ -660,7 +669,8 @@ struct ImGuiContext
|
|||||||
ImGuiID HoveredId; // Hovered widget
|
ImGuiID HoveredId; // Hovered widget
|
||||||
bool HoveredIdAllowOverlap;
|
bool HoveredIdAllowOverlap;
|
||||||
ImGuiID HoveredIdPreviousFrame;
|
ImGuiID HoveredIdPreviousFrame;
|
||||||
float HoveredIdTimer;
|
float HoveredIdTimer; // Measure contiguous hovering time
|
||||||
|
float HoveredIdNotActiveTimer; // Measure contiguous hovering time where the item has not been active
|
||||||
ImGuiID ActiveId; // Active widget
|
ImGuiID ActiveId; // Active widget
|
||||||
ImGuiID ActiveIdPreviousFrame;
|
ImGuiID ActiveIdPreviousFrame;
|
||||||
ImGuiID ActiveIdIsAlive; // Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
|
ImGuiID ActiveIdIsAlive; // Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
|
||||||
@ -677,6 +687,7 @@ struct ImGuiContext
|
|||||||
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
|
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
|
||||||
ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation.
|
ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation.
|
||||||
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
||||||
|
ImVec2 LastValidMousePos;
|
||||||
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
||||||
ImVector<ImGuiColorMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
ImVector<ImGuiColorMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
||||||
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
||||||
@ -807,7 +818,7 @@ struct ImGuiContext
|
|||||||
HoveredId = 0;
|
HoveredId = 0;
|
||||||
HoveredIdAllowOverlap = false;
|
HoveredIdAllowOverlap = false;
|
||||||
HoveredIdPreviousFrame = 0;
|
HoveredIdPreviousFrame = 0;
|
||||||
HoveredIdTimer = 0.0f;
|
HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f;
|
||||||
ActiveId = 0;
|
ActiveId = 0;
|
||||||
ActiveIdPreviousFrame = 0;
|
ActiveIdPreviousFrame = 0;
|
||||||
ActiveIdIsAlive = 0;
|
ActiveIdIsAlive = 0;
|
||||||
@ -823,6 +834,7 @@ struct ImGuiContext
|
|||||||
ActiveIdSource = ImGuiInputSource_None;
|
ActiveIdSource = ImGuiInputSource_None;
|
||||||
LastActiveId = 0;
|
LastActiveId = 0;
|
||||||
LastActiveIdTimer = 0.0f;
|
LastActiveIdTimer = 0.0f;
|
||||||
|
LastValidMousePos = ImVec2(0.0f, 0.0f);
|
||||||
MovingWindow = NULL;
|
MovingWindow = NULL;
|
||||||
NextTreeNodeOpenVal = false;
|
NextTreeNodeOpenVal = false;
|
||||||
NextTreeNodeOpenCond = 0;
|
NextTreeNodeOpenCond = 0;
|
||||||
@ -897,13 +909,13 @@ struct ImGuiContext
|
|||||||
// This is going to be exposed in imgui.h when stabilized enough.
|
// This is going to be exposed in imgui.h when stabilized enough.
|
||||||
enum ImGuiItemFlags_
|
enum ImGuiItemFlags_
|
||||||
{
|
{
|
||||||
ImGuiItemFlags_AllowKeyboardFocus = 1 << 0, // true
|
ImGuiItemFlags_NoTabStop = 1 << 0, // false
|
||||||
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
||||||
ImGuiItemFlags_Disabled = 1 << 2, // false // [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211
|
ImGuiItemFlags_Disabled = 1 << 2, // false // [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211
|
||||||
ImGuiItemFlags_NoNav = 1 << 3, // false
|
ImGuiItemFlags_NoNav = 1 << 3, // false
|
||||||
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
||||||
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
||||||
ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus
|
ImGuiItemFlags_Default_ = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
|
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
|
||||||
@ -1111,17 +1123,21 @@ namespace ImGui
|
|||||||
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
||||||
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
||||||
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
|
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
|
||||||
|
IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id);
|
||||||
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
||||||
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
||||||
IMGUI_API void FocusFrontMostActiveWindowIgnoringOne(ImGuiWindow* ignore_window);
|
IMGUI_API void FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window);
|
||||||
IMGUI_API void BringWindowToFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToBack(ImGuiWindow* window);
|
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
|
||||||
|
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
|
||||||
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
||||||
IMGUI_API ImVec2 CalcWindowExpectedSize(ImGuiWindow* window);
|
IMGUI_API ImVec2 CalcWindowExpectedSize(ImGuiWindow* window);
|
||||||
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
||||||
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||||||
IMGUI_API void SetWindowScrollX(ImGuiWindow* window, float new_scroll_x);
|
IMGUI_API void SetWindowScrollX(ImGuiWindow* window, float new_scroll_x);
|
||||||
IMGUI_API void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y);
|
IMGUI_API void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y);
|
||||||
|
IMGUI_API float GetWindowScrollMaxX(ImGuiWindow* window);
|
||||||
|
IMGUI_API float GetWindowScrollMaxY(ImGuiWindow* window);
|
||||||
IMGUI_API ImRect GetWindowAllowedExtentRect(ImGuiWindow* window);
|
IMGUI_API ImRect GetWindowAllowedExtentRect(ImGuiWindow* window);
|
||||||
IMGUI_API void SetCurrentFont(ImFont* font);
|
IMGUI_API void SetCurrentFont(ImFont* font);
|
||||||
inline ImFont* GetDefaultFont() { ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; }
|
inline ImFont* GetDefaultFont() { ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; }
|
||||||
@ -1240,7 +1256,7 @@ namespace ImGui
|
|||||||
|
|
||||||
// Widgets low-level behaviors
|
// Widgets low-level behaviors
|
||||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format, float power);
|
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format, float power, ImGuiDragFlags flags);
|
||||||
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
||||||
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f);
|
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f);
|
||||||
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
||||||
@ -1250,7 +1266,7 @@ namespace ImGui
|
|||||||
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
|
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
|
||||||
// To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).
|
// To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).
|
||||||
// e.g. " extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); "
|
// e.g. " extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); "
|
||||||
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, const T v_min, const T v_max, const char* format, float power);
|
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, const T v_min, const T v_max, const char* format, float power, ImGuiDragFlags flags);
|
||||||
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, const T v_min, const T v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, const T v_min, const T v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
||||||
template<typename T, typename FLOAT_T> IMGUI_API float SliderCalcRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max, float power, float linear_zero_pos);
|
template<typename T, typename FLOAT_T> IMGUI_API float SliderCalcRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max, float power, float linear_zero_pos);
|
||||||
template<typename T, typename SIGNED_T> IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v);
|
template<typename T, typename SIGNED_T> IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.65
|
// dear imgui, v1.66
|
||||||
// (widgets code)
|
// (widgets code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -133,8 +133,9 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|||||||
{
|
{
|
||||||
// Long text!
|
// Long text!
|
||||||
// Perform manual coarse clipping to optimize for long multi-line text
|
// Perform manual coarse clipping to optimize for long multi-line text
|
||||||
// From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
|
// - From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
|
||||||
// We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
|
// - We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
|
||||||
|
// - We use memchr(), pay attention that well optimized versions of those str/mem functions are much faster than a casually written loop.
|
||||||
const char* line = text;
|
const char* line = text;
|
||||||
const float line_height = GetTextLineHeight();
|
const float line_height = GetTextLineHeight();
|
||||||
const ImRect clip_rect = window->ClipRect;
|
const ImRect clip_rect = window->ClipRect;
|
||||||
@ -153,7 +154,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|||||||
int lines_skipped = 0;
|
int lines_skipped = 0;
|
||||||
while (line < text_end && lines_skipped < lines_skippable)
|
while (line < text_end && lines_skipped < lines_skippable)
|
||||||
{
|
{
|
||||||
const char* line_end = strchr(line, '\n');
|
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
line = line_end + 1;
|
line = line_end + 1;
|
||||||
@ -169,15 +170,15 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|||||||
ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));
|
ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));
|
||||||
while (line < text_end)
|
while (line < text_end)
|
||||||
{
|
{
|
||||||
const char* line_end = strchr(line, '\n');
|
|
||||||
if (IsClippedEx(line_rect, 0, false))
|
if (IsClippedEx(line_rect, 0, false))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
||||||
|
if (!line_end)
|
||||||
|
line_end = text_end;
|
||||||
const ImVec2 line_size = CalcTextSize(line, line_end, false);
|
const ImVec2 line_size = CalcTextSize(line, line_end, false);
|
||||||
text_size.x = ImMax(text_size.x, line_size.x);
|
text_size.x = ImMax(text_size.x, line_size.x);
|
||||||
RenderText(pos, line, line_end, false);
|
RenderText(pos, line, line_end, false);
|
||||||
if (!line_end)
|
|
||||||
line_end = text_end;
|
|
||||||
line = line_end + 1;
|
line = line_end + 1;
|
||||||
line_rect.Min.y += line_height;
|
line_rect.Min.y += line_height;
|
||||||
line_rect.Max.y += line_height;
|
line_rect.Max.y += line_height;
|
||||||
@ -188,7 +189,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
|
|||||||
int lines_skipped = 0;
|
int lines_skipped = 0;
|
||||||
while (line < text_end)
|
while (line < text_end)
|
||||||
{
|
{
|
||||||
const char* line_end = strchr(line, '\n');
|
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
line = line_end + 1;
|
line = line_end + 1;
|
||||||
@ -626,7 +627,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu
|
|||||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
RenderNavHighlight(bb, id);
|
RenderNavHighlight(bb, id);
|
||||||
RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding);
|
RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding);
|
||||||
RenderArrow(bb.Min + ImVec2(ImMax(0.0f, size.x - g.FontSize - g.Style.FramePadding.x), ImMax(0.0f, size.y - g.FontSize - g.Style.FramePadding.y)), dir);
|
RenderArrow(bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), dir);
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
@ -838,7 +839,7 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
|
|||||||
|
|
||||||
// Default to using texture ID as ID. User can still push string/integer prefixes.
|
// Default to using texture ID as ID. User can still push string/integer prefixes.
|
||||||
// We could hash the size/uv to create a unique ID but that would prevent the user from animating UV.
|
// We could hash the size/uv to create a unique ID but that would prevent the user from animating UV.
|
||||||
PushID((void*)user_texture_id);
|
PushID((void*)(intptr_t)user_texture_id);
|
||||||
const ImGuiID id = window->GetID("#image");
|
const ImGuiID id = window->GetID("#image");
|
||||||
PopID();
|
PopID();
|
||||||
|
|
||||||
@ -1240,7 +1241,7 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float
|
|||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// [SECTION] Widgets: Combo Box
|
// [SECTION] Widgets: ComboBox
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// - BeginCombo()
|
// - BeginCombo()
|
||||||
// - EndCombo()
|
// - EndCombo()
|
||||||
@ -1705,33 +1706,39 @@ TYPE ImGui::RoundScalarWithFormatT(const char* format, ImGuiDataType data_type,
|
|||||||
|
|
||||||
// This is called by DragBehavior() when the widget is active (held by mouse or being manipulated with Nav controls)
|
// This is called by DragBehavior() when the widget is active (held by mouse or being manipulated with Nav controls)
|
||||||
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
template<typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE>
|
||||||
bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, float power)
|
bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, float power, ImGuiDragFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
const ImGuiAxis axis = (flags & ImGuiDragFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X;
|
||||||
|
const bool is_decimal = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);
|
||||||
|
const bool has_min_max = (v_min != v_max);
|
||||||
|
|
||||||
// Default tweak speed
|
// Default tweak speed
|
||||||
bool has_min_max = (v_min != v_max) && (v_max - v_max < FLT_MAX);
|
if (v_speed == 0.0f && has_min_max && (v_max - v_min < FLT_MAX))
|
||||||
if (v_speed == 0.0f && has_min_max)
|
|
||||||
v_speed = (float)((v_max - v_min) * g.DragSpeedDefaultRatio);
|
v_speed = (float)((v_max - v_min) * g.DragSpeedDefaultRatio);
|
||||||
|
|
||||||
// Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings
|
// Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings
|
||||||
float adjust_delta = 0.0f;
|
float adjust_delta = 0.0f;
|
||||||
if (g.ActiveIdSource == ImGuiInputSource_Mouse && IsMousePosValid() && g.IO.MouseDragMaxDistanceSqr[0] > 1.0f*1.0f)
|
if (g.ActiveIdSource == ImGuiInputSource_Mouse && IsMousePosValid() && g.IO.MouseDragMaxDistanceSqr[0] > 1.0f*1.0f)
|
||||||
{
|
{
|
||||||
adjust_delta = g.IO.MouseDelta.x;
|
adjust_delta = g.IO.MouseDelta[axis];
|
||||||
if (g.IO.KeyAlt)
|
if (g.IO.KeyAlt)
|
||||||
adjust_delta *= 1.0f/100.0f;
|
adjust_delta *= 1.0f / 100.0f;
|
||||||
if (g.IO.KeyShift)
|
if (g.IO.KeyShift)
|
||||||
adjust_delta *= 10.0f;
|
adjust_delta *= 10.0f;
|
||||||
}
|
}
|
||||||
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
||||||
{
|
{
|
||||||
int decimal_precision = (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) ? ImParseFormatPrecision(format, 3) : 0;
|
int decimal_precision = is_decimal ? ImParseFormatPrecision(format, 3) : 0;
|
||||||
adjust_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard|ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 1.0f/10.0f, 10.0f).x;
|
adjust_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 1.0f / 10.0f, 10.0f)[axis];
|
||||||
v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
|
v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
|
||||||
}
|
}
|
||||||
adjust_delta *= v_speed;
|
adjust_delta *= v_speed;
|
||||||
|
|
||||||
|
// For vertical drag we currently assume that Up=higher value (like we do with vertical sliders). This may become a parameter.
|
||||||
|
if (axis == ImGuiAxis_Y)
|
||||||
|
adjust_delta = -adjust_delta;
|
||||||
|
|
||||||
// Clear current value on activation
|
// Clear current value on activation
|
||||||
// Avoid altering values and clamping when we are _already_ past the limits and heading in the same direction, so e.g. if range is 0..255, current value is 300 and we are pushing to the right side, keep the 300.
|
// Avoid altering values and clamping when we are _already_ past the limits and heading in the same direction, so e.g. if range is 0..255, current value is 300 and we are pushing to the right side, keep the 300.
|
||||||
bool is_just_activated = g.ActiveIdIsJustActivated;
|
bool is_just_activated = g.ActiveIdIsJustActivated;
|
||||||
@ -1753,7 +1760,7 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
|
|||||||
TYPE v_cur = *v;
|
TYPE v_cur = *v;
|
||||||
FLOATTYPE v_old_ref_for_accum_remainder = (FLOATTYPE)0.0f;
|
FLOATTYPE v_old_ref_for_accum_remainder = (FLOATTYPE)0.0f;
|
||||||
|
|
||||||
const bool is_power = (power != 1.0f && (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) && has_min_max);
|
const bool is_power = (power != 1.0f && is_decimal && has_min_max && (v_max - v_min < FLT_MAX));
|
||||||
if (is_power)
|
if (is_power)
|
||||||
{
|
{
|
||||||
// Offset + round to user desired precision, with a curve on the v_min..v_max range to get more precision on one side of the range
|
// Offset + round to user desired precision, with a curve on the v_min..v_max range to get more precision on one side of the range
|
||||||
@ -1786,12 +1793,12 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
|
|||||||
if (v_cur == (TYPE)-0)
|
if (v_cur == (TYPE)-0)
|
||||||
v_cur = (TYPE)0;
|
v_cur = (TYPE)0;
|
||||||
|
|
||||||
// Clamp values (handle overflow/wrap-around)
|
// Clamp values (+ handle overflow/wrap-around for integer types)
|
||||||
if (*v != v_cur && has_min_max)
|
if (*v != v_cur && has_min_max)
|
||||||
{
|
{
|
||||||
if (v_cur < v_min || (v_cur > *v && adjust_delta < 0.0f))
|
if (v_cur < v_min || (v_cur > *v && adjust_delta < 0.0f && !is_decimal))
|
||||||
v_cur = v_min;
|
v_cur = v_min;
|
||||||
if (v_cur > v_max || (v_cur < *v && adjust_delta > 0.0f))
|
if (v_cur > v_max || (v_cur < *v && adjust_delta > 0.0f && !is_decimal))
|
||||||
v_cur = v_max;
|
v_cur = v_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1802,7 +1809,7 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format, float power)
|
bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format, float power, ImGuiDragFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.ActiveId == id)
|
if (g.ActiveId == id)
|
||||||
@ -1817,12 +1824,12 @@ bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* v, float v_s
|
|||||||
|
|
||||||
switch (data_type)
|
switch (data_type)
|
||||||
{
|
{
|
||||||
case ImGuiDataType_S32: return DragBehaviorT<ImS32, ImS32, float >(data_type, (ImS32*)v, v_speed, v_min ? *(const ImS32* )v_min : IM_S32_MIN, v_max ? *(const ImS32* )v_max : IM_S32_MAX, format, power);
|
case ImGuiDataType_S32: return DragBehaviorT<ImS32, ImS32, float >(data_type, (ImS32*)v, v_speed, v_min ? *(const ImS32* )v_min : IM_S32_MIN, v_max ? *(const ImS32* )v_max : IM_S32_MAX, format, power, flags);
|
||||||
case ImGuiDataType_U32: return DragBehaviorT<ImU32, ImS32, float >(data_type, (ImU32*)v, v_speed, v_min ? *(const ImU32* )v_min : IM_U32_MIN, v_max ? *(const ImU32* )v_max : IM_U32_MAX, format, power);
|
case ImGuiDataType_U32: return DragBehaviorT<ImU32, ImS32, float >(data_type, (ImU32*)v, v_speed, v_min ? *(const ImU32* )v_min : IM_U32_MIN, v_max ? *(const ImU32* )v_max : IM_U32_MAX, format, power, flags);
|
||||||
case ImGuiDataType_S64: return DragBehaviorT<ImS64, ImS64, double>(data_type, (ImS64*)v, v_speed, v_min ? *(const ImS64* )v_min : IM_S64_MIN, v_max ? *(const ImS64* )v_max : IM_S64_MAX, format, power);
|
case ImGuiDataType_S64: return DragBehaviorT<ImS64, ImS64, double>(data_type, (ImS64*)v, v_speed, v_min ? *(const ImS64* )v_min : IM_S64_MIN, v_max ? *(const ImS64* )v_max : IM_S64_MAX, format, power, flags);
|
||||||
case ImGuiDataType_U64: return DragBehaviorT<ImU64, ImS64, double>(data_type, (ImU64*)v, v_speed, v_min ? *(const ImU64* )v_min : IM_U64_MIN, v_max ? *(const ImU64* )v_max : IM_U64_MAX, format, power);
|
case ImGuiDataType_U64: return DragBehaviorT<ImU64, ImS64, double>(data_type, (ImU64*)v, v_speed, v_min ? *(const ImU64* )v_min : IM_U64_MIN, v_max ? *(const ImU64* )v_max : IM_U64_MAX, format, power, flags);
|
||||||
case ImGuiDataType_Float: return DragBehaviorT<float, float, float >(data_type, (float*)v, v_speed, v_min ? *(const float* )v_min : -FLT_MAX, v_max ? *(const float* )v_max : FLT_MAX, format, power);
|
case ImGuiDataType_Float: return DragBehaviorT<float, float, float >(data_type, (float*)v, v_speed, v_min ? *(const float* )v_min : -FLT_MAX, v_max ? *(const float* )v_max : FLT_MAX, format, power, flags);
|
||||||
case ImGuiDataType_Double: return DragBehaviorT<double,double,double>(data_type, (double*)v, v_speed, v_min ? *(const double*)v_min : -DBL_MAX, v_max ? *(const double*)v_max : DBL_MAX, format, power);
|
case ImGuiDataType_Double: return DragBehaviorT<double,double,double>(data_type, (double*)v, v_speed, v_min ? *(const double*)v_min : -DBL_MAX, v_max ? *(const double*)v_max : DBL_MAX, format, power, flags);
|
||||||
case ImGuiDataType_COUNT: break;
|
case ImGuiDataType_COUNT: break;
|
||||||
}
|
}
|
||||||
IM_ASSERT(0);
|
IM_ASSERT(0);
|
||||||
@ -1880,11 +1887,14 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* v, floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
|
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
|
||||||
|
{
|
||||||
|
FocusableItemUnregister(window);
|
||||||
return InputScalarAsWidgetReplacement(frame_bb, id, label, data_type, v, format);
|
return InputScalarAsWidgetReplacement(frame_bb, id, label, data_type, v, format);
|
||||||
|
}
|
||||||
|
|
||||||
// Actual drag behavior
|
// Actual drag behavior
|
||||||
ItemSize(total_bb, style.FramePadding.y);
|
ItemSize(total_bb, style.FramePadding.y);
|
||||||
const bool value_changed = DragBehavior(id, data_type, v, v_speed, v_min, v_max, format, power);
|
const bool value_changed = DragBehavior(id, data_type, v, v_speed, v_min, v_max, format, power, ImGuiDragFlags_None);
|
||||||
if (value_changed)
|
if (value_changed)
|
||||||
MarkItemEdited(id);
|
MarkItemEdited(id);
|
||||||
|
|
||||||
@ -2076,20 +2086,20 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
|
|
||||||
const bool is_horizontal = (flags & ImGuiSliderFlags_Vertical) == 0;
|
const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X;
|
||||||
const bool is_decimal = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);
|
const bool is_decimal = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double);
|
||||||
const bool is_power = (power != 1.0f) && is_decimal;
|
const bool is_power = (power != 1.0f) && is_decimal;
|
||||||
|
|
||||||
const float grab_padding = 2.0f;
|
const float grab_padding = 2.0f;
|
||||||
const float slider_sz = is_horizontal ? (bb.GetWidth() - grab_padding * 2.0f) : (bb.GetHeight() - grab_padding * 2.0f);
|
const float slider_sz = (bb.Max[axis] - bb.Min[axis]) - grab_padding * 2.0f;
|
||||||
float grab_sz = style.GrabMinSize;
|
float grab_sz = style.GrabMinSize;
|
||||||
SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max);
|
SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max);
|
||||||
if (!is_decimal && v_range >= 0) // v_range < 0 may happen on integer overflows
|
if (!is_decimal && v_range >= 0) // v_range < 0 may happen on integer overflows
|
||||||
grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit
|
grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit
|
||||||
grab_sz = ImMin(grab_sz, slider_sz);
|
grab_sz = ImMin(grab_sz, slider_sz);
|
||||||
const float slider_usable_sz = slider_sz - grab_sz;
|
const float slider_usable_sz = slider_sz - grab_sz;
|
||||||
const float slider_usable_pos_min = (is_horizontal ? bb.Min.x : bb.Min.y) + grab_padding + grab_sz*0.5f;
|
const float slider_usable_pos_min = bb.Min[axis] + grab_padding + grab_sz*0.5f;
|
||||||
const float slider_usable_pos_max = (is_horizontal ? bb.Max.x : bb.Max.y) - grab_padding - grab_sz*0.5f;
|
const float slider_usable_pos_max = bb.Max[axis] - grab_padding - grab_sz*0.5f;
|
||||||
|
|
||||||
// For power curve sliders that cross over sign boundary we want the curve to be symmetric around 0.0f
|
// For power curve sliders that cross over sign boundary we want the curve to be symmetric around 0.0f
|
||||||
float linear_zero_pos; // 0.0->1.0f
|
float linear_zero_pos; // 0.0->1.0f
|
||||||
@ -2120,9 +2130,9 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const float mouse_abs_pos = is_horizontal ? g.IO.MousePos.x : g.IO.MousePos.y;
|
const float mouse_abs_pos = g.IO.MousePos[axis];
|
||||||
clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f;
|
clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f;
|
||||||
if (!is_horizontal)
|
if (axis == ImGuiAxis_Y)
|
||||||
clicked_t = 1.0f - clicked_t;
|
clicked_t = 1.0f - clicked_t;
|
||||||
set_new_value = true;
|
set_new_value = true;
|
||||||
}
|
}
|
||||||
@ -2130,7 +2140,7 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
|||||||
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
|
||||||
{
|
{
|
||||||
const ImVec2 delta2 = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 0.0f, 0.0f);
|
const ImVec2 delta2 = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 0.0f, 0.0f);
|
||||||
float delta = is_horizontal ? delta2.x : -delta2.y;
|
float delta = (axis == ImGuiAxis_X) ? delta2.x : -delta2.y;
|
||||||
if (g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated)
|
if (g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated)
|
||||||
{
|
{
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
@ -2222,10 +2232,10 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
|||||||
|
|
||||||
// Output grab position so it can be displayed by the caller
|
// Output grab position so it can be displayed by the caller
|
||||||
float grab_t = SliderCalcRatioFromValueT<TYPE,FLOATTYPE>(data_type, *v, v_min, v_max, power, linear_zero_pos);
|
float grab_t = SliderCalcRatioFromValueT<TYPE,FLOATTYPE>(data_type, *v, v_min, v_max, power, linear_zero_pos);
|
||||||
if (!is_horizontal)
|
if (axis == ImGuiAxis_Y)
|
||||||
grab_t = 1.0f - grab_t;
|
grab_t = 1.0f - grab_t;
|
||||||
const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
|
const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
|
||||||
if (is_horizontal)
|
if (axis == ImGuiAxis_X)
|
||||||
*out_grab_bb = ImRect(grab_pos - grab_sz*0.5f, bb.Min.y + grab_padding, grab_pos + grab_sz*0.5f, bb.Max.y - grab_padding);
|
*out_grab_bb = ImRect(grab_pos - grab_sz*0.5f, bb.Min.y + grab_padding, grab_pos + grab_sz*0.5f, bb.Max.y - grab_padding);
|
||||||
else
|
else
|
||||||
*out_grab_bb = ImRect(bb.Min.x + grab_padding, grab_pos - grab_sz*0.5f, bb.Max.x - grab_padding, grab_pos + grab_sz*0.5f);
|
*out_grab_bb = ImRect(bb.Min.x + grab_padding, grab_pos - grab_sz*0.5f, bb.Max.x - grab_padding, grab_pos + grab_sz*0.5f);
|
||||||
@ -2311,7 +2321,10 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* v, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
|
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
|
||||||
|
{
|
||||||
|
FocusableItemUnregister(window);
|
||||||
return InputScalarAsWidgetReplacement(frame_bb, id, label, data_type, v, format);
|
return InputScalarAsWidgetReplacement(frame_bb, id, label, data_type, v, format);
|
||||||
|
}
|
||||||
|
|
||||||
ItemSize(total_bb, style.FramePadding.y);
|
ItemSize(total_bb, style.FramePadding.y);
|
||||||
|
|
||||||
@ -2389,10 +2402,12 @@ bool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max
|
|||||||
return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power);
|
return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max)
|
bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max, const char* format)
|
||||||
{
|
{
|
||||||
|
if (format == NULL)
|
||||||
|
format = "%.0f deg";
|
||||||
float v_deg = (*v_rad) * 360.0f / (2*IM_PI);
|
float v_deg = (*v_rad) * 360.0f / (2*IM_PI);
|
||||||
bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, "%.0f deg", 1.0f);
|
bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, format, 1.0f);
|
||||||
*v_rad = v_deg * (2*IM_PI) / 360.0f;
|
*v_rad = v_deg * (2*IM_PI) / 360.0f;
|
||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
@ -2580,8 +2595,8 @@ int ImParseFormatPrecision(const char* fmt, int default_precision)
|
|||||||
return (precision == INT_MAX) ? default_precision : precision;
|
return (precision == INT_MAX) ? default_precision : precision;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create text input in place of a slider (when CTRL+Clicking on slider)
|
// Create text input in place of an active drag/slider (used when doing a CTRL+Click on drag/slider widgets)
|
||||||
// FIXME: Logic is messy and confusing.
|
// FIXME: Logic is awkward and confusing. This should be reworked to facilitate using in other situations.
|
||||||
bool ImGui::InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* data_ptr, const char* format)
|
bool ImGui::InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* data_ptr, const char* format)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -2590,9 +2605,8 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const c
|
|||||||
// Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen)
|
// Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen)
|
||||||
// On the first frame, g.ScalarAsInputTextId == 0, then on subsequent frames it becomes == id
|
// On the first frame, g.ScalarAsInputTextId == 0, then on subsequent frames it becomes == id
|
||||||
SetActiveID(g.ScalarAsInputTextId, window);
|
SetActiveID(g.ScalarAsInputTextId, window);
|
||||||
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
|
||||||
SetHoveredID(0);
|
SetHoveredID(0);
|
||||||
FocusableItemUnregister(window);
|
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||||
|
|
||||||
char fmt_buf[32];
|
char fmt_buf[32];
|
||||||
char data_buf[32];
|
char data_buf[32];
|
||||||
@ -2843,7 +2857,7 @@ static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* t
|
|||||||
if (c == '\r')
|
if (c == '\r')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const float char_width = font->GetCharAdvance((unsigned short)c) * scale;
|
const float char_width = font->GetCharAdvance((ImWchar)c) * scale;
|
||||||
line_width += char_width;
|
line_width += char_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2904,7 +2918,7 @@ static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n)
|
|||||||
obj->CurLenA -= ImTextCountUtf8BytesFromStr(dst, dst + n);
|
obj->CurLenA -= ImTextCountUtf8BytesFromStr(dst, dst + n);
|
||||||
obj->CurLenW -= n;
|
obj->CurLenW -= n;
|
||||||
|
|
||||||
// Offset remaining text
|
// Offset remaining text (FIXME-OPT: Use memmove)
|
||||||
const ImWchar* src = obj->TextW.Data + pos + n;
|
const ImWchar* src = obj->TextW.Data + pos + n;
|
||||||
while (ImWchar c = *src++)
|
while (ImWchar c = *src++)
|
||||||
*dst++ = c;
|
*dst++ = c;
|
||||||
@ -3092,7 +3106,7 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
// This is so we can easily call InputText() on static arrays using ARRAYSIZE() and to match
|
// This is so we can easily call InputText() on static arrays using ARRAYSIZE() and to match
|
||||||
// Note that in std::string world, capacity() would omit 1 byte used by the zero-terminator.
|
// Note that in std::string world, capacity() would omit 1 byte used by the zero-terminator.
|
||||||
// - When active, hold on a privately held copy of the text (and apply back to 'buf'). So changing 'buf' while the InputText is active has no effect.
|
// - When active, hold on a privately held copy of the text (and apply back to 'buf'). So changing 'buf' while the InputText is active has no effect.
|
||||||
// - If you want to use ImGui::InputText() with std::string, see misc/stl/imgui_stl.h
|
// - If you want to use ImGui::InputText() with std::string, see misc/cpp/imgui_stdlib.h
|
||||||
// (FIXME: Rather messy function partly because we are doing UTF8 > u16 > UTF8 conversions on the go to more easily handle stb_textedit calls. Ideally we should stay in UTF-8 all the time. See https://github.com/nothings/stb/issues/188)
|
// (FIXME: Rather messy function partly because we are doing UTF8 > u16 > UTF8 conversions on the go to more easily handle stb_textedit calls. Ideally we should stay in UTF-8 all the time. See https://github.com/nothings/stb/issues/188)
|
||||||
bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* callback_user_data)
|
bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* callback_user_data)
|
||||||
{
|
{
|
||||||
@ -3402,7 +3416,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
{
|
{
|
||||||
// Filter pasted buffer
|
// Filter pasted buffer
|
||||||
const int clipboard_len = (int)strlen(clipboard);
|
const int clipboard_len = (int)strlen(clipboard);
|
||||||
ImWchar* clipboard_filtered = (ImWchar*)ImGui::MemAlloc((clipboard_len+1) * sizeof(ImWchar));
|
ImWchar* clipboard_filtered = (ImWchar*)MemAlloc((clipboard_len+1) * sizeof(ImWchar));
|
||||||
int clipboard_filtered_len = 0;
|
int clipboard_filtered_len = 0;
|
||||||
for (const char* s = clipboard; *s; )
|
for (const char* s = clipboard; *s; )
|
||||||
{
|
{
|
||||||
@ -3420,7 +3434,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
stb_textedit_paste(&edit_state, &edit_state.StbState, clipboard_filtered, clipboard_filtered_len);
|
stb_textedit_paste(&edit_state, &edit_state.StbState, clipboard_filtered, clipboard_filtered_len);
|
||||||
edit_state.CursorFollow = true;
|
edit_state.CursorFollow = true;
|
||||||
}
|
}
|
||||||
ImGui::MemFree(clipboard_filtered);
|
MemFree(clipboard_filtered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3615,6 +3629,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
// In multi-line mode, we never exit the loop until all lines are counted, so add one extra to the searches_remaining counter.
|
// In multi-line mode, we never exit the loop until all lines are counted, so add one extra to the searches_remaining counter.
|
||||||
searches_remaining += is_multiline ? 1 : 0;
|
searches_remaining += is_multiline ? 1 : 0;
|
||||||
int line_count = 0;
|
int line_count = 0;
|
||||||
|
//for (const ImWchar* s = text_begin; (s = (const ImWchar*)wcschr((const wchar_t*)s, (wchar_t)'\n')) != NULL; s++) // FIXME-OPT: Could use this when wchar_t are 16-bits
|
||||||
for (const ImWchar* s = text_begin; *s != 0; s++)
|
for (const ImWchar* s = text_begin; *s != 0; s++)
|
||||||
if (*s == '\n')
|
if (*s == '\n')
|
||||||
{
|
{
|
||||||
@ -3689,6 +3704,8 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
break;
|
break;
|
||||||
if (rect_pos.y < clip_rect.y)
|
if (rect_pos.y < clip_rect.y)
|
||||||
{
|
{
|
||||||
|
//p = (const ImWchar*)wmemchr((const wchar_t*)p, '\n', text_selected_end - p); // FIXME-OPT: Could use this when wchar_t are 16-bits
|
||||||
|
//p = p ? p + 1 : text_selected_end;
|
||||||
while (p < text_selected_end)
|
while (p < text_selected_end)
|
||||||
if (*p++ == '\n')
|
if (*p++ == '\n')
|
||||||
break;
|
break;
|
||||||
@ -3696,7 +3713,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true);
|
ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true);
|
||||||
if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((unsigned short)' ') * 0.50f); // So we can see selected empty lines
|
if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines
|
||||||
ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos +ImVec2(rect_size.x, bg_offy_dn));
|
ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos +ImVec2(rect_size.x, bg_offy_dn));
|
||||||
rect.ClipWith(clip_rect);
|
rect.ClipWith(clip_rect);
|
||||||
if (rect.Overlaps(clip_rect))
|
if (rect.Overlaps(clip_rect))
|
||||||
@ -3921,7 +3938,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
if (label != label_display_end)
|
if (label != label_display_end)
|
||||||
{
|
{
|
||||||
TextUnformatted(label, label_display_end);
|
TextUnformatted(label, label_display_end);
|
||||||
Separator();
|
Spacing();
|
||||||
}
|
}
|
||||||
ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;
|
ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;
|
||||||
ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
||||||
@ -4527,38 +4544,38 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
|||||||
{
|
{
|
||||||
bool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask);
|
bool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask);
|
||||||
bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);
|
bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);
|
||||||
if ((!allow_opt_picker && !allow_opt_alpha_bar) || !ImGui::BeginPopup("context"))
|
if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup("context"))
|
||||||
return;
|
return;
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (allow_opt_picker)
|
if (allow_opt_picker)
|
||||||
{
|
{
|
||||||
ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (ImGui::GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function
|
ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function
|
||||||
ImGui::PushItemWidth(picker_size.x);
|
PushItemWidth(picker_size.x);
|
||||||
for (int picker_type = 0; picker_type < 2; picker_type++)
|
for (int picker_type = 0; picker_type < 2; picker_type++)
|
||||||
{
|
{
|
||||||
// Draw small/thumbnail version of each picker type (over an invisible button for selection)
|
// Draw small/thumbnail version of each picker type (over an invisible button for selection)
|
||||||
if (picker_type > 0) ImGui::Separator();
|
if (picker_type > 0) Separator();
|
||||||
ImGui::PushID(picker_type);
|
PushID(picker_type);
|
||||||
ImGuiColorEditFlags picker_flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoOptions|ImGuiColorEditFlags_NoLabel|ImGuiColorEditFlags_NoSidePreview|(flags & ImGuiColorEditFlags_NoAlpha);
|
ImGuiColorEditFlags picker_flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoOptions|ImGuiColorEditFlags_NoLabel|ImGuiColorEditFlags_NoSidePreview|(flags & ImGuiColorEditFlags_NoAlpha);
|
||||||
if (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar;
|
if (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar;
|
||||||
if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel;
|
if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel;
|
||||||
ImVec2 backup_pos = ImGui::GetCursorScreenPos();
|
ImVec2 backup_pos = GetCursorScreenPos();
|
||||||
if (ImGui::Selectable("##selectable", false, 0, picker_size)) // By default, Selectable() is closing popup
|
if (Selectable("##selectable", false, 0, picker_size)) // By default, Selectable() is closing popup
|
||||||
g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask);
|
g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask);
|
||||||
ImGui::SetCursorScreenPos(backup_pos);
|
SetCursorScreenPos(backup_pos);
|
||||||
ImVec4 dummy_ref_col;
|
ImVec4 dummy_ref_col;
|
||||||
memcpy(&dummy_ref_col.x, ref_col, sizeof(float) * (picker_flags & ImGuiColorEditFlags_NoAlpha ? 3 : 4));
|
memcpy(&dummy_ref_col.x, ref_col, sizeof(float) * (picker_flags & ImGuiColorEditFlags_NoAlpha ? 3 : 4));
|
||||||
ImGui::ColorPicker4("##dummypicker", &dummy_ref_col.x, picker_flags);
|
ColorPicker4("##dummypicker", &dummy_ref_col.x, picker_flags);
|
||||||
ImGui::PopID();
|
PopID();
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
PopItemWidth();
|
||||||
}
|
}
|
||||||
if (allow_opt_alpha_bar)
|
if (allow_opt_alpha_bar)
|
||||||
{
|
{
|
||||||
if (allow_opt_picker) ImGui::Separator();
|
if (allow_opt_picker) Separator();
|
||||||
ImGui::CheckboxFlags("Alpha Bar", (unsigned int*)&g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar);
|
CheckboxFlags("Alpha Bar", (unsigned int*)&g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar);
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -4961,7 +4978,7 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
|
|||||||
// - Selectable()
|
// - Selectable()
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
// Tip: pass an empty label (e.g. "##dummy") then you can use the space to draw other text or image.
|
// Tip: pass a non-visible label (e.g. "##dummy") then you can use the space to draw other text or image.
|
||||||
// But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID or use ##unique_id.
|
// But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID or use ##unique_id.
|
||||||
bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags flags, const ImVec2& size_arg)
|
bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags flags, const ImVec2& size_arg)
|
||||||
{
|
{
|
||||||
@ -5072,9 +5089,9 @@ bool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags
|
|||||||
// - ListBoxFooter()
|
// - ListBoxFooter()
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
// FIXME: Rename to BeginListBox()
|
// FIXME: In principle this function should be called BeginListBox(). We should rename it after re-evaluating if we want to keep the same signature.
|
||||||
// Helper to calculate the size of a listbox and display a label on the right.
|
// Helper to calculate the size of a listbox and display a label on the right.
|
||||||
// Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an empty label "##empty"
|
// Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an non-visible label e.g. "##empty"
|
||||||
bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
|
bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
@ -5100,24 +5117,26 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Rename to BeginListBox()
|
// FIXME: In principle this function should be called EndListBox(). We should rename it after re-evaluating if we want to keep the same signature.
|
||||||
bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items)
|
bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items)
|
||||||
{
|
{
|
||||||
// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
|
// Size default to hold ~7.25 items.
|
||||||
// We don't add +0.40f if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.
|
// We add +25% worth of item height to allow the user to see at a glance if there are more items up/down, without looking at the scrollbar.
|
||||||
|
// We don't add this extra bit if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.
|
||||||
// I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution.
|
// I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution.
|
||||||
if (height_in_items < 0)
|
if (height_in_items < 0)
|
||||||
height_in_items = ImMin(items_count, 7);
|
height_in_items = ImMin(items_count, 7);
|
||||||
float height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00f);
|
const ImGuiStyle& style = GetStyle();
|
||||||
|
float height_in_items_f = (height_in_items < items_count) ? (height_in_items + 0.25f) : (height_in_items + 0.00f);
|
||||||
|
|
||||||
// We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild().
|
// We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild().
|
||||||
ImVec2 size;
|
ImVec2 size;
|
||||||
size.x = 0.0f;
|
size.x = 0.0f;
|
||||||
size.y = GetTextLineHeightWithSpacing() * height_in_items_f + GetStyle().ItemSpacing.y;
|
size.y = GetTextLineHeightWithSpacing() * height_in_items_f + style.FramePadding.y * 2.0f;
|
||||||
return ListBoxHeader(label, size);
|
return ListBoxHeader(label, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Rename to EndListBox()
|
// FIXME: In principle this function should be called EndListBox(). We should rename it after re-evaluating if we want to keep the same signature.
|
||||||
void ImGui::ListBoxFooter()
|
void ImGui::ListBoxFooter()
|
||||||
{
|
{
|
||||||
ImGuiWindow* parent_window = GetCurrentWindow()->ParentWindow;
|
ImGuiWindow* parent_window = GetCurrentWindow()->ParentWindow;
|
||||||
@ -5448,7 +5467,7 @@ void ImGui::EndMainMenuBar()
|
|||||||
// When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
|
// When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.CurrentWindow == g.NavWindow && g.NavLayer == 0)
|
if (g.CurrentWindow == g.NavWindow && g.NavLayer == 0)
|
||||||
FocusFrontMostActiveWindowIgnoringOne(g.NavWindow);
|
FocusPreviousWindowIgnoringOne(g.NavWindow);
|
||||||
|
|
||||||
End();
|
End();
|
||||||
}
|
}
|
||||||
@ -5547,7 +5566,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|||||||
// Menu inside an horizontal menu bar
|
// Menu inside an horizontal menu bar
|
||||||
// Selectable extend their highlight by half ItemSpacing in each direction.
|
// Selectable extend their highlight by half ItemSpacing in each direction.
|
||||||
// For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
|
// For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
|
||||||
popup_pos = ImVec2(pos.x - window->WindowPadding.x, pos.y - style.FramePadding.y + window->MenuBarHeight());
|
popup_pos = ImVec2(pos.x - 1.0f - (float)(int)(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight());
|
||||||
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
|
||||||
PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
||||||
float w = label_size.x;
|
float w = label_size.x;
|
||||||
|
18
misc/README.txt
Normal file
18
misc/README.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
misc/cpp/
|
||||||
|
InputText() wrappers for C++ standard library (STL) type: std::string.
|
||||||
|
This is also an example of how you may wrap your own similar types.
|
||||||
|
|
||||||
|
misc/fonts/
|
||||||
|
Fonts loading/merging instructions (e.g. How to handle glyph ranges, how to merge icons fonts).
|
||||||
|
Command line tool "binary_to_compressed_c" to create compressed arrays to embed data in source code.
|
||||||
|
Suggested fonts and links.
|
||||||
|
|
||||||
|
misc/freetype/
|
||||||
|
Font atlas builder/rasterizer using FreeType instead of stb_truetype.
|
||||||
|
Benefit from better FreeType rasterization, in particular for small fonts.
|
||||||
|
|
||||||
|
misc/natvis/
|
||||||
|
Natvis file to describe dear imgui types in the Visual Studio debugger.
|
||||||
|
With this, types like ImVector<> will be displayed nicely in the debugger.
|
||||||
|
You can include this file a Visual Studio project file, or install it in Visual Studio folder.
|
10
misc/cpp/README.txt
Normal file
10
misc/cpp/README.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
imgui_stdlib.h + imgui_stdlib.cpp
|
||||||
|
InputText() wrappers for C++ standard library (STL) type: std::string.
|
||||||
|
This is also an example of how you may wrap your own similar types.
|
||||||
|
|
||||||
|
imgui_scoped.h
|
||||||
|
[Experimental, not currently in main repository]
|
||||||
|
Additional header file with some RAII-style wrappers for common ImGui functions.
|
||||||
|
Try by merging: https://github.com/ocornut/imgui/pull/2197
|
||||||
|
Discuss at: https://github.com/ocornut/imgui/issues/2096
|
@ -1,4 +1,4 @@
|
|||||||
// imgui_stl.cpp
|
// imgui_stdlib.cpp
|
||||||
// Wrappers for C++ standard library (STL) types (std::string, etc.)
|
// Wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||||
// This is also an example of how you may wrap your own similar types.
|
// This is also an example of how you may wrap your own similar types.
|
||||||
|
|
||||||
@ -6,8 +6,11 @@
|
|||||||
// - std::string support is only guaranteed to work from C++11.
|
// - std::string support is only guaranteed to work from C++11.
|
||||||
// If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture)
|
// If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture)
|
||||||
|
|
||||||
|
// Changelog:
|
||||||
|
// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_stl.h"
|
#include "imgui_stdlib.h"
|
||||||
|
|
||||||
struct InputTextCallback_UserData
|
struct InputTextCallback_UserData
|
||||||
{
|
{
|
||||||
@ -22,6 +25,7 @@ static int InputTextCallback(ImGuiInputTextCallbackData* data)
|
|||||||
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
||||||
{
|
{
|
||||||
// Resize string callback
|
// Resize string callback
|
||||||
|
// If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want.
|
||||||
std::string* str = user_data->Str;
|
std::string* str = user_data->Str;
|
||||||
IM_ASSERT(data->Buf == str->c_str());
|
IM_ASSERT(data->Buf == str->c_str());
|
||||||
str->resize(data->BufTextLen);
|
str->resize(data->BufTextLen);
|
@ -1,4 +1,4 @@
|
|||||||
// imgui_stl.h
|
// imgui_stdlib.h
|
||||||
// Wrappers for C++ standard library (STL) types (std::string, etc.)
|
// Wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||||
// This is also an example of how you may wrap your own similar types.
|
// This is also an example of how you may wrap your own similar types.
|
||||||
|
|
@ -1,9 +1,11 @@
|
|||||||
|
|
||||||
The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' (by Tristan Grimmer) that is used by default.
|
The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' (by Tristan Grimmer),
|
||||||
We embed the font in source code so you can use Dear ImGui without any file system access.
|
a 13 pixels high, pixel-perfect font used by default.
|
||||||
|
We embed it font in source code so you can use Dear ImGui without any file system access.
|
||||||
|
|
||||||
You may also load external .TTF/.OTF files.
|
You may also load external .TTF/.OTF files.
|
||||||
The files in this folder are suggested fonts, provided as a convenience.
|
The files in this folder are suggested fonts, provided as a convenience.
|
||||||
(Note: .OTF support in stb_truetype.h currently doesn't appear to load every font)
|
(Note: .OTF support in imstb_truetype.h currently doesn't appear to load every font)
|
||||||
|
|
||||||
Fonts are rasterized in a single texture at the time of calling either of io.Fonts->GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build().
|
Fonts are rasterized in a single texture at the time of calling either of io.Fonts->GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build().
|
||||||
Also read dear imgui FAQ in imgui.cpp!
|
Also read dear imgui FAQ in imgui.cpp!
|
||||||
@ -11,6 +13,7 @@ Also read dear imgui FAQ in imgui.cpp!
|
|||||||
If you have other loading/merging/adding fonts, you can post on the Dear ImGui "Getting Started" forum:
|
If you have other loading/merging/adding fonts, you can post on the Dear ImGui "Getting Started" forum:
|
||||||
https://discourse.dearimgui.org/c/getting-started
|
https://discourse.dearimgui.org/c/getting-started
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
INDEX:
|
INDEX:
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
@ -29,32 +32,33 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
README FIRST / FAQ
|
README FIRST / FAQ
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
- You can use the style editor ImGui::ShowStyleEditor() to browse your fonts and understand what's going on if you have an issue.
|
- You can use the style editor ImGui::ShowStyleEditor() to browse your fonts and understand what's going on if you have an issue.
|
||||||
- Make sure your font ranges data are persistent (available during the call to GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build().
|
- Make sure your font ranges data are persistent (available during the call to GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build().
|
||||||
- Use C++11 u8"my text" syntax to encode literal strings as UTF-8. e.g.:
|
- Use C++11 u8"my text" syntax to encode literal strings as UTF-8. e.g.:
|
||||||
u8"hello"
|
u8"hello"
|
||||||
u8"こんにちは" // this will be encoded as UTF-8
|
u8"こんにちは" // this will be encoded as UTF-8
|
||||||
- If you want to include a backslash \ character in your string literal, you need to double them e.g. "folder\\filename".
|
- If you want to include a backslash \ character in your string literal, you need to double them e.g. "folder\\filename".
|
||||||
- Please use the Discourse forum (https://discourse.dearimgui.org) and not the Github issue tracker.
|
- Please use the Discourse forum (https://discourse.dearimgui.org) and not the Github issue tracker for basic font loading questions.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
USING ICONS
|
USING ICONS
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
Using an icon font (such as FontAwesome: http://fontawesome.io) is an easy and practical way to use icons in your ImGui application.
|
Using an icon font (such as FontAwesome: http://fontawesome.io or OpenFontIcons. https://github.com/traverseda/OpenFontIcons)
|
||||||
A common pattern is to merge the icon font within your main font, so you can embed icons directly from your strings without
|
is an easy and practical way to use icons in your Dear ImGui application.
|
||||||
having to change fonts back and forth.
|
A common pattern is to merge the icon font within your main font, so you can embed icons directly from your strings without
|
||||||
|
having to change fonts back and forth.
|
||||||
|
|
||||||
To refer to the icon UTF-8 codepoints from your C++ code, you may use those headers files created by Juliette Foucaut:
|
To refer to the icon UTF-8 codepoints from your C++ code, you may use those headers files created by Juliette Foucaut:
|
||||||
https://github.com/juliettef/IconFontCppHeaders
|
https://github.com/juliettef/IconFontCppHeaders
|
||||||
|
|
||||||
The C++11 version of those files uses the u8"" utf-8 encoding syntax + \u
|
The C++11 version of those files uses the u8"" utf-8 encoding syntax + \u
|
||||||
#define ICON_FA_SEARCH u8"\uf002"
|
#define ICON_FA_SEARCH u8"\uf002"
|
||||||
The pre-C++11 version has the values directly encoded as utf-8:
|
The pre-C++11 version has the values directly encoded as utf-8:
|
||||||
#define ICON_FA_SEARCH "\xEF\x80\x82"
|
#define ICON_FA_SEARCH "\xEF\x80\x82"
|
||||||
|
|
||||||
Example:
|
Example Setup:
|
||||||
|
|
||||||
// Merge icons into default tool font
|
// Merge icons into default tool font
|
||||||
#include "IconsFontAwesome.h"
|
#include "IconsFontAwesome.h"
|
||||||
@ -67,23 +71,27 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
||||||
io.Fonts->AddFontFromFileTTF("fonts/fontawesome-webfont.ttf", 13.0f, &config, icon_ranges);
|
io.Fonts->AddFontFromFileTTF("fonts/fontawesome-webfont.ttf", 13.0f, &config, icon_ranges);
|
||||||
|
|
||||||
// Usage, e.g.
|
Example Usage:
|
||||||
ImGui::Button(ICON_FA_SEARCH " Search"); // C string literals can be concatenated at compilation time, this is the same as "A" "B" becoming "AB"
|
|
||||||
ImGui::Text("%s among %d items", ICON_FA_SEARCH, count);
|
|
||||||
|
|
||||||
See Links below for other icons fonts and related tools.
|
// Usage, e.g.
|
||||||
|
ImGui::Text("%s among %d items", ICON_FA_SEARCH, count);
|
||||||
|
ImGui::Button(ICON_FA_SEARCH " Search");
|
||||||
|
// C string _literals_ can be concatenated at compilation time, e.g. "hello" " world"
|
||||||
|
// ICON_FA_SEARCH is defined as a string literal so this is the same as "A" "B" becoming "AB"
|
||||||
|
|
||||||
|
See Links below for other icons fonts and related tools.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
FONTS LOADING INSTRUCTIONS
|
FONTS LOADING INSTRUCTIONS
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
Load default font:
|
Load default font:
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.Fonts->AddFontDefault();
|
io.Fonts->AddFontDefault();
|
||||||
|
|
||||||
Load .TTF/.OTF file with:
|
Load .TTF/.OTF file with:
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImFont* font1 = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
|
ImFont* font1 = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
|
||||||
@ -95,7 +103,7 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
ImGui::Text("Hello with another font");
|
ImGui::Text("Hello with another font");
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
|
|
||||||
For advanced options create a ImFontConfig structure and pass it to the AddFont function (it will be copied internally):
|
For advanced options create a ImFontConfig structure and pass it to the AddFont function (it will be copied internally):
|
||||||
|
|
||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.OversampleH = 3;
|
config.OversampleH = 3;
|
||||||
@ -103,13 +111,13 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
config.GlyphExtraSpacing.x = 1.0f;
|
config.GlyphExtraSpacing.x = 1.0f;
|
||||||
ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, &config);
|
ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, &config);
|
||||||
|
|
||||||
If you have very large number of glyphs or multiple fonts, the texture may become too big for your graphics API.
|
If you have very large number of glyphs or multiple fonts, the texture may become too big for your graphics API.
|
||||||
The typical result of failing to upload a texture is if every glyphs appears as white rectangles.
|
The typical result of failing to upload a texture is if every glyphs appears as white rectangles.
|
||||||
In particular, using a large range such as GetGlyphRangesChineseSimplifiedCommon() is not recommended unless you
|
In particular, using a large range such as GetGlyphRangesChineseSimplifiedCommon() is not recommended unless you
|
||||||
set OversampleH/OversampleV to 1 and use a small font size.
|
set OversampleH/OversampleV to 1 and use a small font size.
|
||||||
Mind the fact that some graphics drivers have texture size limitation.
|
Mind the fact that some graphics drivers have texture size limitation.
|
||||||
If you are building a PC application, mind the fact that your users may use hardware with lower limitations than yours.
|
If you are building a PC application, mind the fact that your users may use hardware with lower limitations than yours.
|
||||||
Some solutions:
|
Some solutions:
|
||||||
|
|
||||||
- 1) Reduce glyphs ranges by calculating them from source localization data. You can use ImFont::GlyphRangesBuilder for this purpose,
|
- 1) Reduce glyphs ranges by calculating them from source localization data. You can use ImFont::GlyphRangesBuilder for this purpose,
|
||||||
this will be the biggest win.
|
this will be the biggest win.
|
||||||
@ -117,21 +125,22 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
- 3) Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function).
|
- 3) Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function).
|
||||||
- 4) Set io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; to disable rounding the texture height to the next power of two.
|
- 4) Set io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; to disable rounding the texture height to the next power of two.
|
||||||
|
|
||||||
Combine two fonts into one:
|
Combine two fonts into one:
|
||||||
|
|
||||||
// Load a first font
|
// Load a first font
|
||||||
ImFont* font = io.Fonts->AddFontDefault();
|
ImFont* font = io.Fonts->AddFontDefault();
|
||||||
|
|
||||||
// Add character ranges and merge into the previous font
|
// Add character ranges and merge into the previous font
|
||||||
// The ranges array is not copied by the AddFont* functions and is used lazily
|
// The ranges array is not copied by the AddFont* functions and is used lazily
|
||||||
// so ensure it is available for duration of font usage
|
// so ensure it is available at the time of building or calling GetTexDataAsRGBA32().
|
||||||
static const ImWchar icons_ranges[] = { 0xf000, 0xf3ff, 0 }; // will not be copied by AddFont* so keep in scope.
|
static const ImWchar icons_ranges[] = { 0xf000, 0xf3ff, 0 }; // Will not be copied by AddFont* so keep in scope.
|
||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.MergeMode = true;
|
config.MergeMode = true;
|
||||||
io.Fonts->AddFontFromFileTTF("DroidSans.ttf", 18.0f, &config, io.Fonts->GetGlyphRangesJapanese());
|
io.Fonts->AddFontFromFileTTF("DroidSans.ttf", 18.0f, &config, io.Fonts->GetGlyphRangesJapanese());
|
||||||
io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 18.0f, &config, icons_ranges);
|
io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 18.0f, &config, icons_ranges);
|
||||||
|
io.Fonts->Build();
|
||||||
|
|
||||||
Add a fourth parameter to bake specific font ranges only:
|
Add a fourth parameter to bake specific font ranges only:
|
||||||
|
|
||||||
// Basic Latin, Extended Latin
|
// Basic Latin, Extended Latin
|
||||||
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesDefault());
|
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesDefault());
|
||||||
@ -142,8 +151,8 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
// Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
|
// Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
|
||||||
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesJapanese());
|
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||||
|
|
||||||
See "BUILDING CUSTOM GLYPH RANGES" section to create your own ranges.
|
See "BUILDING CUSTOM GLYPH RANGES" section to create your own ranges.
|
||||||
Offset font vertically by altering the io.Font->DisplayOffset value:
|
Offset font vertically by altering the io.Font->DisplayOffset value:
|
||||||
|
|
||||||
ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
|
ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
|
||||||
font->DisplayOffset.y = 1; // Render 1 pixel down
|
font->DisplayOffset.y = 1; // Render 1 pixel down
|
||||||
@ -153,20 +162,23 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
FREETYPE RASTERIZER, SMALL FONT SIZES
|
FREETYPE RASTERIZER, SMALL FONT SIZES
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
Dear Imgui uses stb_truetype.h to rasterize fonts (with optional oversampling).
|
Dear ImGui uses imstb_truetype.h to rasterize fonts (with optional oversampling).
|
||||||
This technique and implementation are not ideal for fonts rendered at _small sizes_, which may appear a little blurry.
|
This technique and its implementation are not ideal for fonts rendered at _small sizes_, which may appear a
|
||||||
There is an implementation of the ImFontAtlas builder using FreeType that you can use in the misc/freetype/ folder.
|
little blurry or hard to read.
|
||||||
|
|
||||||
FreeType supports auto-hinting which tends to improve the readability of small fonts.
|
There is an implementation of the ImFontAtlas builder using FreeType that you can use in the misc/freetype/ folder.
|
||||||
Note that this code currently creates textures that are unoptimally too large (could be fixed with some work)
|
|
||||||
|
FreeType supports auto-hinting which tends to improve the readability of small fonts.
|
||||||
|
Note that this code currently creates textures that are unoptimally too large (could be fixed with some work).
|
||||||
|
Also note that correct sRGB space blending will have an important effect on your font rendering quality.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
BUILDING CUSTOM GLYPH RANGES
|
BUILDING CUSTOM GLYPH RANGES
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
You can use the ImFontAtlas::GlyphRangesBuilder helper to create glyph ranges based on text input.
|
You can use the ImFontAtlas::GlyphRangesBuilder helper to create glyph ranges based on text input.
|
||||||
For example: for a game where your script is known, if you can feed your entire script to it and only build the characters the game needs.
|
For example: for a game where your script is known, if you can feed your entire script to it and only build the characters the game needs.
|
||||||
|
|
||||||
ImVector<ImWchar> ranges;
|
ImVector<ImWchar> ranges;
|
||||||
ImFontAtlas::GlyphRangesBuilder builder;
|
ImFontAtlas::GlyphRangesBuilder builder;
|
||||||
@ -174,21 +186,23 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
builder.AddChar(0x7262); // Add a specific character
|
builder.AddChar(0x7262); // Add a specific character
|
||||||
builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges
|
builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges
|
||||||
builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted)
|
builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted)
|
||||||
|
|
||||||
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, ranges.Data);
|
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, ranges.Data);
|
||||||
|
io.Fonts->Build(); // Build the atlas while 'ranges' is still in scope and not deleted.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
EMBEDDING FONTS IN SOURCE CODE
|
EMBEDDING FONTS IN SOURCE CODE
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
Compile and use 'binary_to_compressed_c.cpp' to create a compressed C style array that you can embed in source code.
|
Compile and use 'binary_to_compressed_c.cpp' to create a compressed C style array that you can embed in source code.
|
||||||
See the documentation in binary_to_compressed_c.cpp for instruction on how to use the tool.
|
See the documentation in binary_to_compressed_c.cpp for instruction on how to use the tool.
|
||||||
You may find a precompiled version binary_to_compressed_c.exe for Windows instead of demo binaries package (see README).
|
You may find a precompiled version binary_to_compressed_c.exe for Windows instead of demo binaries package (see README).
|
||||||
The tool optionally used Base85 encoding to reduce the size of _source code_ but the read-only arrays will be about 20% bigger.
|
The tool optionally used Base85 encoding to reduce the size of _source code_ but the read-only arrays will be about 20% bigger.
|
||||||
|
|
||||||
Then load the font with:
|
Then load the font with:
|
||||||
ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels, ...);
|
ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels, ...);
|
||||||
or:
|
or:
|
||||||
ImFont* font = io.Fonts->AddFontFromMemoryCompressedBase85TTF(compressed_data_base85, size_pixels, ...);
|
ImFont* font = io.Fonts->AddFontFromMemoryCompressedBase85TTF(compressed_data_base85, size_pixels, ...);
|
||||||
|
|
||||||
|
|
||||||
@ -196,78 +210,101 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
CREDITS/LICENSES FOR FONTS INCLUDED IN THIS FOLDER
|
CREDITS/LICENSES FOR FONTS INCLUDED IN THIS FOLDER
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
Roboto-Medium.ttf
|
Roboto-Medium.ttf
|
||||||
|
|
||||||
Apache License 2.0
|
Apache License 2.0
|
||||||
by Christian Robertson
|
by Christian Robertson
|
||||||
https://fonts.google.com/specimen/Roboto
|
https://fonts.google.com/specimen/Roboto
|
||||||
|
|
||||||
Cousine-Regular.ttf
|
Cousine-Regular.ttf
|
||||||
|
|
||||||
by Steve Matteson
|
by Steve Matteson
|
||||||
Digitized data copyright (c) 2010 Google Corporation.
|
Digitized data copyright (c) 2010 Google Corporation.
|
||||||
Licensed under the SIL Open Font License, Version 1.1
|
Licensed under the SIL Open Font License, Version 1.1
|
||||||
https://fonts.google.com/specimen/Cousine
|
https://fonts.google.com/specimen/Cousine
|
||||||
|
|
||||||
DroidSans.ttf
|
DroidSans.ttf
|
||||||
|
|
||||||
Copyright (c) Steve Matteson
|
Copyright (c) Steve Matteson
|
||||||
Apache License, version 2.0
|
Apache License, version 2.0
|
||||||
https://www.fontsquirrel.com/fonts/droid-sans
|
https://www.fontsquirrel.com/fonts/droid-sans
|
||||||
|
|
||||||
ProggyClean.ttf
|
ProggyClean.ttf
|
||||||
|
|
||||||
Copyright (c) 2004, 2005 Tristan Grimmer
|
Copyright (c) 2004, 2005 Tristan Grimmer
|
||||||
MIT License
|
MIT License
|
||||||
recommended loading setting in ImGui: Size = 13.0, DisplayOffset.Y = +1
|
recommended loading setting in ImGui: Size = 13.0, DisplayOffset.Y = +1
|
||||||
http://www.proggyfonts.net/
|
http://www.proggyfonts.net/
|
||||||
|
|
||||||
ProggyTiny.ttf
|
ProggyTiny.ttf
|
||||||
Copyright (c) 2004, 2005 Tristan Grimmer
|
Copyright (c) 2004, 2005 Tristan Grimmer
|
||||||
MIT License
|
MIT License
|
||||||
recommended loading setting in ImGui: Size = 10.0, DisplayOffset.Y = +1
|
recommended loading setting in ImGui: Size = 10.0, DisplayOffset.Y = +1
|
||||||
http://www.proggyfonts.net/
|
http://www.proggyfonts.net/
|
||||||
|
|
||||||
Karla-Regular.ttf
|
Karla-Regular.ttf
|
||||||
Copyright (c) 2012, Jonathan Pinhorn
|
Copyright (c) 2012, Jonathan Pinhorn
|
||||||
SIL OPEN FONT LICENSE Version 1.1
|
SIL OPEN FONT LICENSE Version 1.1
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
LINKS, OTHER FONTS
|
FONTS LINKS
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
(Icons) Icon fonts
|
ICON FONTS
|
||||||
https://fortawesome.github.io/Font-Awesome/
|
|
||||||
https://github.com/SamBrishes/kenney-icon-font
|
|
||||||
https://design.google.com/icons/
|
|
||||||
You can use https://github.com/juliettef/IconFontCppHeaders for C/C++ header files with name #define to access icon codepoint in source code.
|
|
||||||
|
|
||||||
(Icons) IcoMoon - Custom Icon font builder
|
C/C++ header for icon fonts (#define with code points to use in source code string literals)
|
||||||
|
https://github.com/juliettef/IconFontCppHeaders
|
||||||
|
|
||||||
|
FontAwesome
|
||||||
|
https://fortawesome.github.io/Font-Awesome
|
||||||
|
|
||||||
|
OpenFontIcons
|
||||||
|
https://github.com/traverseda/OpenFontIcons
|
||||||
|
|
||||||
|
Google Icon Fonts
|
||||||
|
https://design.google.com/icons/
|
||||||
|
|
||||||
|
Kenney Icon Font (Game Controller Icons)
|
||||||
|
https://github.com/nicodinh/kenney-icon-font
|
||||||
|
|
||||||
|
IcoMoon - Custom Icon font builder
|
||||||
https://icomoon.io/app
|
https://icomoon.io/app
|
||||||
|
|
||||||
(Regular) Open Sans Fonts
|
REGULAR FONTS
|
||||||
https://fonts.google.com/specimen/Open+Sans
|
|
||||||
|
|
||||||
(Regular) Google Noto Fonts (worldwide languages)
|
Google Noto Fonts (worldwide languages)
|
||||||
https://www.google.com/get/noto/
|
https://www.google.com/get/noto/
|
||||||
|
|
||||||
(Monospace) Typefaces for source code beautification
|
Open Sans Fonts
|
||||||
https://github.com/chrissimpkins/codeface
|
https://fonts.google.com/specimen/Open+Sans
|
||||||
|
|
||||||
(Monospace) Programmation fonts
|
(Japanese) M+ fonts by Coji Morishita are free
|
||||||
http://s9w.github.io/font_compare/
|
|
||||||
|
|
||||||
(Monospace) Proggy Programming Fonts
|
|
||||||
http://upperbounds.net
|
|
||||||
|
|
||||||
(Monospace) Inconsolata
|
|
||||||
http://www.levien.com/type/myfonts/inconsolata.html
|
|
||||||
|
|
||||||
(Monospace) Adobe Source Code Pro: Monospaced font family for user interface and coding environments
|
|
||||||
https://github.com/adobe-fonts/source-code-pro
|
|
||||||
|
|
||||||
(Monospace) Monospace/Fixed Width Programmer's Fonts
|
|
||||||
http://www.lowing.org/fonts/
|
|
||||||
|
|
||||||
(Japanese) M+ fonts by Coji Morishita are free and include most useful Kanjis you would need.
|
|
||||||
http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html
|
http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html
|
||||||
|
|
||||||
Or use Arial Unicode or other Unicode fonts provided with Windows for full characters coverage (not sure of their licensing).
|
MONOSPACE FONTS
|
||||||
|
|
||||||
|
(Pixel Perfect) Proggy Fonts, by Tristan Grimmer
|
||||||
|
http://www.proggyfonts.net or http://upperbounds.net
|
||||||
|
|
||||||
|
(Pixel Perfect) Sweet16, Sweet16 Mono, by Martin Sedlak (Latin + Supplemental + Extended A)
|
||||||
|
https://github.com/kmar/Sweet16Font
|
||||||
|
Also include .inl file to use directly in dear imgui.
|
||||||
|
|
||||||
|
Typefaces for source code beautification
|
||||||
|
https://github.com/chrissimpkins/codeface
|
||||||
|
|
||||||
|
Programmation fonts
|
||||||
|
http://s9w.github.io/font_compare/
|
||||||
|
|
||||||
|
Inconsolata
|
||||||
|
http://www.levien.com/type/myfonts/inconsolata.html
|
||||||
|
|
||||||
|
Adobe Source Code Pro: Monospaced font family for user interface and coding environments
|
||||||
|
https://github.com/adobe-fonts/source-code-pro
|
||||||
|
|
||||||
|
Monospace/Fixed Width Programmer's Fonts
|
||||||
|
http://www.lowing.org/fonts/
|
||||||
|
|
||||||
|
|
||||||
|
Or use Arial Unicode or other Unicode fonts provided with Windows for full characters coverage (not sure of their licensing).
|
||||||
|
@ -337,7 +337,7 @@ bool ImGuiFreeType::BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags)
|
|||||||
{
|
{
|
||||||
for (uint32_t codepoint = in_range[0]; codepoint <= in_range[1]; ++codepoint)
|
for (uint32_t codepoint = in_range[0]; codepoint <= in_range[1]; ++codepoint)
|
||||||
{
|
{
|
||||||
if (cfg.MergeMode && dst_font->FindGlyphNoFallback((unsigned short)codepoint))
|
if (cfg.MergeMode && dst_font->FindGlyphNoFallback((ImWchar)codepoint))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FT_Glyph ft_glyph = NULL;
|
FT_Glyph ft_glyph = NULL;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Natvis file to describe types in Visual Studio debugger.
|
Natvis file to describe dear imgui types in the Visual Studio debugger.
|
||||||
You can include this in a project file, or install in Visual Studio folder.
|
With this, types like ImVector<> will be displayed nicely in the debugger.
|
||||||
|
You can include this file a Visual Studio project file, or install it in Visual Studio folder.
|
||||||
|
Reference in New Issue
Block a user