mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 06:46:36 +00:00
Merge branch 'refs/heads/master' into docking
# Conflicts: # docs/CHANGELOG.txt # examples/imgui_impl_glfw.cpp # examples/imgui_impl_sdl.cpp # examples/imgui_impl_win32.cpp # imgui.cpp # imgui_internal.h # imgui_widgets.cpp
This commit is contained in:
commit
992736dc5d
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@ -44,6 +44,9 @@ jobs:
|
||||
- name: Build example_null (extra warnings)
|
||||
run: mingw32-make -C examples/example_null EXTRA_WARNINGS=1
|
||||
|
||||
- name: Build example_null (unity build)
|
||||
run: mingw32-make -C examples/example_null UNITY_BUILD=1
|
||||
|
||||
- name: Build Win32 example_glfw_opengl2
|
||||
shell: cmd
|
||||
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
|
||||
@ -151,10 +154,30 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libglfw3-dev libsdl2-dev
|
||||
sudo apt-get install -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib
|
||||
|
||||
- name: Build example_null (extra warnings)
|
||||
run: make -C examples/example_null EXTRA_WARNINGS=1
|
||||
- name: Build example_null (extra warnings, gcc 32-bit)
|
||||
run: |
|
||||
make -C examples/example_null clean
|
||||
CXXFLAGS="$CXXFLAGS -m32" make -C examples/example_null EXTRA_WARNINGS=1
|
||||
|
||||
- name: Build example_null (extra warnings, gcc 64-bit)
|
||||
run: |
|
||||
make -C examples/example_null clean
|
||||
CXXFLAGS="$CXXFLAGS -m64" make -C examples/example_null EXTRA_WARNINGS=1
|
||||
|
||||
- name: Build example_null (extra warnings, clang 32-bit)
|
||||
run: |
|
||||
make -C examples/example_null clean
|
||||
CXXFLAGS="$CXXFLAGS -m32" CXX=clang++ make -C examples/example_null EXTRA_WARNINGS=1
|
||||
|
||||
- name: Build example_null (extra warnings, clang 64-bit)
|
||||
run: |
|
||||
make -C examples/example_null clean
|
||||
CXXFLAGS="$CXXFLAGS -m64" CXX=clang++ make -C examples/example_null EXTRA_WARNINGS=1
|
||||
|
||||
- name: Build example_null (unity build)
|
||||
run: make -C examples/example_null UNITY_BUILD=1
|
||||
|
||||
- name: Build example_glfw_opengl2
|
||||
run: make -C examples/example_glfw_opengl2
|
||||
@ -185,6 +208,9 @@ jobs:
|
||||
- name: Build example_null (extra warnings)
|
||||
run: make -C examples/example_null EXTRA_WARNINGS=1
|
||||
|
||||
- name: Build example_null (unity build)
|
||||
run: make -C examples/example_null UNITY_BUILD=1
|
||||
|
||||
- name: Build example_glfw_opengl2
|
||||
run: make -C examples/example_glfw_opengl2
|
||||
|
||||
|
@ -98,6 +98,54 @@ Other changes:
|
||||
to make the examples main.cpp easier to read.
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.75 WIP (In Progress)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Breaking Changes:
|
||||
- Removed redirecting functions/enums names that were marked obsolete in 1.53 (December 2017):
|
||||
- ShowTestWindow() -> use ShowDemoWindow()
|
||||
- IsRootWindowFocused() -> use IsWindowFocused(ImGuiFocusedFlags_RootWindow)
|
||||
- IsRootWindowOrAnyChildFocused() -> use IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows)
|
||||
- SetNextWindowContentWidth(w) -> use SetNextWindowContentSize(ImVec2(w, 0.0f)
|
||||
- GetItemsLineHeightWithSpacing() -> use GetFrameHeightWithSpacing()
|
||||
- ImGuiCol_ChildWindowBg -> use ImGuiCol_ChildBg
|
||||
- ImGuiStyleVar_ChildWindowRounding -> use ImGuiStyleVar_ChildRounding
|
||||
- ImGuiTreeNodeFlags_AllowOverlapMode -> use ImGuiTreeNodeFlags_AllowItemOverlap
|
||||
- IMGUI_DISABLE_TEST_WINDOWS -> use IMGUI_DISABLE_DEMO_WINDOWS
|
||||
If you were still using the old names, while you are cleaning up, considering enabling
|
||||
IMGUI_DISABLE_OBSOLETE_FUNCTIONS in imconfig.h even temporarily to have a pass at finding
|
||||
and removing up old API calls, if any remaining.
|
||||
- Removed implicit default parameter to IsMouseDragging(int button = 0) to be consistent
|
||||
with other mouse functions (none of the other functions have it).
|
||||
- Obsoleted calling ImDrawList::PrimReserve() with a negative count (which was vaguely
|
||||
documented and rarely if ever used). Instead we added an explicit PrimUnreserve() API
|
||||
which can be implemented faster. Also clarified pre-existing constraints which weren't
|
||||
documented (can only unreserve from the last reserve call). If you suspect you ever
|
||||
used that feature before, #define IMGUI_DEBUG_PARANOID in imconfig.h to catch existing
|
||||
calls. [@ShironekoBen]
|
||||
- imgui_internal.h: changed ImRect() default constructor initializes all fields to 0.0f instead
|
||||
of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by
|
||||
adding multiple points into it, you may need to fix your initial value.
|
||||
|
||||
Other Changes:
|
||||
- Inputs: Added ImGuiMouseButton enum for convenience (e.g. ImGuiMouseButton_Right=1).
|
||||
We forever guarantee that the existing value will not changes so existing code is free to use 0/1/2.
|
||||
- Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups]
|
||||
- ImDrawList: Add AddNgon(), AddNgonFilled() API with a guarantee on the explicit segment count.
|
||||
In the current branch they are essentially the same as AddCircle(), AddCircleFilled() but as
|
||||
we will rework the circle rendering functions to use textures and automatic segment count
|
||||
selection, those new api can fill a gap. [@ShironekoBen]
|
||||
- Backends: GLFW, SDL, Win32, OSX, Allegro: Added support for ImGuiMouseCursor_NotAllowed. [@rokups]
|
||||
- Backends: GLFW: Added support for the missing mouse cursors newly added in GLFW 3.4+. [@rokups]
|
||||
- Examples: Explicitly adding -DIMGUI_IMPL_OPENGL_LOADER_GL3W to Makefile to match linking
|
||||
settings (otherwise if another loader such as Glew is accessible, the opengl3 backend might
|
||||
automatically use it). [#2919, #2798]
|
||||
- Examples: Metal: Wrapped main loop in @autoreleasepool block to ensure allocations get freed
|
||||
even if underlying system event loop gets paused due to app nap (#2910, #2917). [@bear24rw]
|
||||
>>>>>>> refs/heads/master
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.74 (Released 2019-11-25)
|
||||
-----------------------------------------------------------------------
|
||||
|
56
docs/FAQ.md
56
docs/FAQ.md
@ -21,7 +21,8 @@ or view this file with any Markdown viewer.
|
||||
| [Why using C++ (as opposed to C)?](#q-why-using-c-as-opposed-to-c) |
|
||||
| **Q&A: Integration** |
|
||||
| [How can I tell whether to dispatch mouse/keyboard to Dear ImGui or to my application?](#q-how-can-i-tell-whether-to-dispatch-mousekeyboard-to-dear-imgui-or-to-my-application) |
|
||||
| [How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)](#q-how-can-i-use-this-without-a-mouse-without-a-keyboard-or-without-a-screen-gamepad-input-share-remote-display) |
|
||||
| [How can I enable keyboard or gamepad controls?](#q-how-can-i-enable-keyboard-or-gamepad-controls) |
|
||||
| [How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)](#q-how-can-i-use-this-on-a-machine-without-mouse-keyboard-or-screen-input-share-remote-display) |
|
||||
| [I integrated Dear ImGui in my engine and the text or lines are blurry..](#q-i-integrated-dear-imgui-in-my-engine-and-the-text-or-lines-are-blurry) |
|
||||
| [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around..](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) |
|
||||
| **Q&A: Usage** |
|
||||
@ -44,11 +45,11 @@ or view this file with any Markdown viewer.
|
||||
### Q: Where is the documentation?
|
||||
|
||||
**This library is poorly documented at the moment and expects of the user to be acquainted with C/C++.**
|
||||
- Run the examples/ and explore them.
|
||||
- See demo code in [imgui_demo.cpp](https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp) and particularly the `ImGui::ShowDemoWindow()` function.
|
||||
- The demo covers most features of Dear ImGui, so you can read the code and see its output.
|
||||
- Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the [examples/](https://github.com/ocornut/imgui/blob/master/examples/) folder to explain how to integrate Dear ImGui with your own engine/application. You can run those applications and explore them.
|
||||
- See demo code in [imgui_demo.cpp](https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp) and particularly the `ImGui::ShowDemoWindow()` function. The demo covers most features of Dear ImGui, so you can read the code and see its output.
|
||||
- See documentation and comments at the top of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp) + general API comments in [imgui.h](https://github.com/ocornut/imgui/blob/master/imgui.h).
|
||||
- Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the [examples/](https://github.com/ocornut/imgui/blob/master/examples/) folder to explain how to integrate Dear ImGui with your own engine/application.
|
||||
- The [Wiki](https://github.com/ocornut/imgui/wiki) has many resources and links.
|
||||
- The [Glossary](https://github.com/ocornut/imgui/wiki/Glossary) page may be useful.
|
||||
- Your programming IDE is your friend, find the type or function declaration to find comments associated to it.
|
||||
|
||||
---
|
||||
@ -66,7 +67,7 @@ Many projects are using this branch and it is kept in sync with master regularly
|
||||
|
||||
### Q: Why the names "Dear ImGui" vs "ImGui"?
|
||||
|
||||
**TL;DR: Please try to refer to this library as "Dear ImGui".**
|
||||
**TL;DR: Please refer to this library as "Dear ImGui".**
|
||||
|
||||
The library started its life as "ImGui" due to the fact that I didn't give it a proper name when when I released 1.0, and had no particular expectation that it would take off. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations (e.g. Unity uses it own implementation of the IMGUI paradigm). To reduce the ambiguity without affecting existing code bases, I have decided on an alternate, longer name "Dear ImGui" that people can use to refer to this specific library.
|
||||
|
||||
@ -128,16 +129,24 @@ e.g. `if (ImGui::GetIO().WantCaptureMouse) { ... }`
|
||||
|
||||
---
|
||||
|
||||
### Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)
|
||||
- You can control Dear ImGui with a gamepad. Read about navigation in "Using gamepad/keyboard navigation controls".
|
||||
(short version: map gamepad inputs into the io.NavInputs[] array + set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad`).
|
||||
- You can share your computer mouse seamlessly with your console/tablet/phone using [Synergy](https://symless.com/synergy)
|
||||
### Q: How can I enable keyboard or gamepad controls?
|
||||
- The gamepad/keyboard navigation is fairly functional and keeps being improved. The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable. Gamepad support is particularly useful to use Dear ImGui on a game console (e.g. PS4, Switch, XB1) without a mouse connected!
|
||||
- Keyboard: set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard` to enable.
|
||||
- Gamepad: set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad` to enable (with a supporting back-end).
|
||||
- See [Control Sheets for Gamepads](http://www.dearimgui.org/controls_sheets) (reference PNG/PSD for for PS4, XB1, Switch gamepads).
|
||||
- See `USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS` section of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp) for more details.
|
||||
|
||||
---
|
||||
|
||||
### Q: How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)
|
||||
- You can share your computer mouse seamlessly with your console/tablet/phone using solutions such as [Synergy](https://symless.com/synergy)
|
||||
This is the preferred solution for developer productivity.
|
||||
In particular, the [micro-synergy-client repository](https://github.com/symless/micro-synergy-client) has simple
|
||||
and portable source code (uSynergy.c/.h) for a small embeddable client that you can use on any platform to connect
|
||||
to your host computer, based on the Synergy 1.x protocol. Make sure you download the Synergy 1 server on your computer.
|
||||
Console SDK also sometimes provide equivalent tooling or wrapper for Synergy-like protocols.
|
||||
- You may also use a third party solution such as [Remote ImGui](https://github.com/JordiRos/remoteimgui) or [imgui-ws](https://github.com/ggerganov/imgui-ws) which sends the vertices to render over the local network, allowing you to use Dear ImGui even on a screen-less machine. See Wiki index for most details.
|
||||
- Game console users: consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.
|
||||
- You may also use a third party solution such as [Remote ImGui](https://github.com/JordiRos/remoteimgui) or [imgui-ws](https://github.com/ggerganov/imgui-ws) which sends the vertices to render over the local network, allowing you to use Dear ImGui even on a screen-less machine. See [Wiki](https://github.com/ocornut/imgui/wiki) index for most details.
|
||||
- For touch inputs, you can increase the hit box of widgets (via the `style.TouchPadding` setting) to accommodate
|
||||
for the lack of precision of touch inputs, but it is recommended you use a mouse or gamepad to allow optimizing
|
||||
for screen real-estate and precision.
|
||||
@ -283,7 +292,7 @@ node open/closed state differently. See what makes more sense in your situation!
|
||||
### Q: How can I display an image? What is ImTextureID, how does it work?
|
||||
|
||||
Short explanation:
|
||||
- Please read Wiki entry for examples: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
|
||||
- Refer to [Image Loading and Displaying Examples](https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples) on the [Wiki](https://github.com/ocornut/imgui/wiki).
|
||||
- You may use functions such as `ImGui::Image()`, `ImGui::ImageButton()` or lower-level `ImDrawList::AddImage()` to emit draw calls that will use your own textures.
|
||||
- Actual textures are identified in a way that is up to the user/engine. Those identifiers are stored and passed as ImTextureID (void*) value.
|
||||
- Loading image files from the disk and turning them into a texture is not within the scope of Dear ImGui (for a good reason).
|
||||
@ -301,15 +310,18 @@ Dear ImGui doesn't know or understand what you are storing in ImTextureID, it me
|
||||
OpenGL:
|
||||
- ImTextureID = GLuint
|
||||
- See ImGui_ImplOpenGL3_RenderDrawData() function in imgui_impl_opengl3.cpp
|
||||
|
||||
```
|
||||
```
|
||||
DirectX9:
|
||||
- ImTextureID = LPDIRECT3DTEXTURE9
|
||||
- See ImGui_ImplDX9_RenderDrawData() function in imgui_impl_dx9.cpp
|
||||
|
||||
```
|
||||
```
|
||||
DirectX11:
|
||||
- ImTextureID = ID3D11ShaderResourceView*
|
||||
- See ImGui_ImplDX11_RenderDrawData() function in imgui_impl_dx11.cpp
|
||||
|
||||
```
|
||||
```
|
||||
DirectX12:
|
||||
- ImTextureID = D3D12_GPU_DESCRIPTOR_HANDLE
|
||||
- See ImGui_ImplDX12_RenderDrawData() function in imgui_impl_dx12.cpp
|
||||
@ -337,7 +349,7 @@ Once you understand this design you will understand that loading image files and
|
||||
This is by design and is actually a good thing, because it means your code has full control over your data types and how you display them.
|
||||
If you want to display an image file (e.g. PNG file) into the screen, please refer to documentation and tutorials for the graphics API you are using.
|
||||
|
||||
Refer to the Wiki to find simplified examples for loading textures with OpenGL, DirectX9 and DirectX11: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
|
||||
Refer to [Image Loading and Displaying Examples](https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples) on the [Wiki](https://github.com/ocornut/imgui/wiki) to find simplified examples for loading textures with OpenGL, DirectX9 and DirectX11.
|
||||
|
||||
C/C++ tip: a void* is pointer-sized storage. You may safely store any pointer or integer into it by casting your value to ImTextureID / void*, and vice-versa.
|
||||
Because both end-points (user code and rendering function) are under your control, you know exactly what is stored inside the ImTextureID / void*.
|
||||
@ -442,7 +454,7 @@ New programmers: remember that in C/C++ and most programming languages if you wa
|
||||
backslash \ within a string literal, you need to write it double backslash "\\":
|
||||
|
||||
```c
|
||||
io.Fonts->AddFontFromFileTTF("MyFolder\MyFont.ttf", size); // WRONG (you are escape the M here!)
|
||||
io.Fonts->AddFontFromFileTTF("MyFolder\MyFont.ttf", size); // WRONG (you are escaping the M here!)
|
||||
io.Fonts->AddFontFromFileTTF("MyFolder\\MyFont.ttf", size; // CORRECT
|
||||
io.Fonts->AddFontFromFileTTF("MyFolder/MyFont.ttf", size); // ALSO CORRECT
|
||||
```
|
||||
@ -452,7 +464,7 @@ io.Fonts->AddFontFromFileTTF("MyFolder/MyFont.ttf", size); // ALSO CORRECT
|
||||
### Q: How can I easily use icons in my application?
|
||||
The most convenient and practical way is to merge an icon font such as FontAwesome inside you
|
||||
main font. Then you can refer to icons within your strings.
|
||||
You may want to see ImFontConfig::GlyphMinAdvanceX to make your icon look monospace to facilitate alignment.
|
||||
You may want to see `ImFontConfig::GlyphMinAdvanceX` to make your icon look monospace to facilitate alignment.
|
||||
(Read the [docs/FONTS.txt](https://github.com/ocornut/imgui/blob/master/docs/FONTS.txt) file for more details about icons font loading.)
|
||||
With some extra effort, you may use colorful icon by registering custom rectangle space inside the font atlas,
|
||||
and copying your own graphics data into it. See docs/FONTS.txt about using the AddCustomRectFontGlyph API.
|
||||
@ -513,7 +525,7 @@ by using the u8"hello" syntax. Specifying literal in your source code using a lo
|
||||
(such as CP-923 for Japanese or CP-1251 for Cyrillic) will NOT work!
|
||||
Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8.
|
||||
|
||||
Text input: it is up to your application to pass the right character code by calling io.AddInputCharacter().
|
||||
Text input: it is up to your application to pass the right character code by calling `io.AddInputCharacter()`.
|
||||
The applications in examples/ are doing that.
|
||||
Windows: you can use the WM_CHAR or WM_UNICHAR or WM_IME_CHAR message (depending if your app is built using Unicode or MultiByte mode).
|
||||
You may also use MultiByteToWideChar() or ToUnicode() to retrieve Unicode codepoints from MultiByte characters or keyboard state.
|
||||
@ -529,8 +541,8 @@ the default implementation of io.ImeSetInputScreenPosFn() to set your Microsoft
|
||||
- Businesses: convince your company to fund development via support contracts/sponsoring! This is among the most useful thing you can do for Dear ImGui. With increased funding we will be able to hire more people working on this project.
|
||||
- Individuals: you can also become a [Patron](http://www.patreon.com/imgui) or donate on PayPal! See README.
|
||||
- Disclose your usage of dear imgui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
||||
You may post screenshot or links in the [gallery threads](https://github.com/ocornut/imgui/issues/2847). Visuals are ideal as they inspire other programmers.
|
||||
But even without visuals, disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions.
|
||||
- If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues or sometimes incomplete pR.
|
||||
You may post screenshot or links in the [gallery threads](https://github.com/ocornut/imgui/issues/2847). Visuals are ideal as they inspire other programmers. Disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions.
|
||||
- If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues or sometimes incomplete PR.
|
||||
|
||||
##### [Return to Index](#index)
|
||||
|
||||
|
@ -126,7 +126,7 @@ Also see [Wiki](https://github.com/ocornut/imgui/wiki) for more links and ideas.
|
||||
|
||||
### Upcoming Changes
|
||||
|
||||
Some of the goals for 2019+ are:
|
||||
Some of the goals for 2019-2020 are:
|
||||
- Finish work on docking, tabs. (see [#2109](https://github.com/ocornut/imgui/issues/2109), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch looking for feedback)
|
||||
- Finish work on multiple viewports / multiple OS windows. (see [#1542](https://github.com/ocornut/imgui/issues/1542), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch looking for feedback)
|
||||
- Finish work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787))
|
||||
|
@ -8,6 +8,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- doc/test: add a proper documentation+regression testing system (#435)
|
||||
- doc/test: checklist app to verify binding/integration of imgui (test inputs, rendering, callback, etc.).
|
||||
- doc/tips: tips of the day: website? applet in imgui_club?
|
||||
- doc/wiki: work on the wiki https://github.com/ocornut/imgui/wiki
|
||||
|
||||
- window: preserve/restore relative focus ordering (persistent or not) (#2304) -> also see docking reference to same #.
|
||||
- window: calling SetNextWindowSize() every frame with <= 0 doesn't do anything, may be useful to allow (particularly when used for a single axis). (#690)
|
||||
@ -27,6 +28,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
||||
- window: investigate better auto-positioning for new windows.
|
||||
- window: top most window flag? (#2574)
|
||||
- window: the size_on_first_use path of Begin() can probably be removed
|
||||
- window/opt: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate. -> this may require enforcing that it is illegal to submit contents if Begin returns false.
|
||||
- window/child: the first draw command of a child window could be moved into the current draw command of the parent window (unless child+tooltip?).
|
||||
- window/child: border could be emitted in parent as well.
|
||||
@ -58,7 +60,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- main: find a way to preserve relative orders of multiple reappearing windows (so an app toggling between "modes" e.g. fullscreen vs all tools) won't lose relative ordering.
|
||||
- main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
|
||||
- main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
||||
- main: rename the main "Debug" window to avoid ID collision with user who may want to use "Debug" with specific flags.
|
||||
|
||||
- widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc. (#395)
|
||||
- widgets: clean up widgets internal toward exposing everything and stabilizing imgui_internals.h.
|
||||
@ -301,7 +302,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- drag and drop: (#143) "both an in-process pointer and a promise to generate a serialized version, for whether the drag ends inside or outside the same process"
|
||||
- drag and drop: feedback when hovering a region blocked by modal (mouse cursor "NO"?)
|
||||
|
||||
- node/graph editor (#306)
|
||||
- node/graph editors (#306) (also see https://github.com/ocornut/imgui/wiki#node-editors)
|
||||
- pie menus patterns (#434)
|
||||
- markup: simple markup language for color change? (#902)
|
||||
|
||||
@ -329,12 +330,15 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- font: add support for kerning, probably optional. A) perhaps default to (32..128)^2 matrix ~ 9K entries = 36KB, then hash for non-ascii?. B) or sparse lookup into per-char list?
|
||||
- font: add a simpler CalcTextSizeA() api? current one ok but not welcome if user needs to call it directly (without going through ImGui::CalcTextSize)
|
||||
- font: fix AddRemapChar() to work before atlas has been built.
|
||||
- font: what would it take to support codepoint higher than 0xFFFF? (smileys, etc.) (#2538, #2541)
|
||||
- font: support for unicode codepoints higher than 0xFFFF? (pr #2815)
|
||||
- font: (api breaking) remove "TTF" from symbol names. also because it now supports OTF.
|
||||
- font/opt: Considering storing standalone AdvanceX table as 16-bit fixed point integer?
|
||||
- font/opt: Glyph currently 40 bytes (2+9*4). Consider storing UV as 16 bits integer? (->32 bytes). X0/Y0/X1/Y1 as 16 fixed-point integers? Or X0/Y0 as float and X1/Y1 as fixed8_8?
|
||||
|
||||
- nav: some features such as PageUp/Down/Home/End should probably work without ImGuiConfigFlags_NavEnableKeyboard? (where do we draw the line?)
|
||||
! nav: never clear NavId on some setup (e.g. gamepad centric)
|
||||
- nav: restore NavId on reappearing non-child window.
|
||||
- nav: code to focus child-window on restoring NavId appears to have issue (to investigate)
|
||||
- nav: configuration flag to disable global shortcuts (currently only CTRL-Tab) ?
|
||||
- nav: Home/End behavior when navigable item is not fully visible at the edge of scrolling? should be backtrack to keep item into view?
|
||||
- nav: NavScrollToBringItemIntoView() with item bigger than view should focus top-right? Repro: using Nav in "About Window"
|
||||
@ -382,7 +386,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- inputs: support track pad style scrolling & slider edit.
|
||||
- inputs/io: backspace and arrows in the context of a text input could use system repeat rate.
|
||||
- inputs/io: clarify/standardize/expose repeat rate and repeat delays (#1808)
|
||||
- inputs: add mouse cursor for unavailable/no? IDC_NO/SDL_SYSTEM_CURSOR_NO.
|
||||
- inputs/scrolling: support for smooth scrolling (#2462, #2569)
|
||||
|
||||
- misc: idle: expose "woken up" boolean (set by inputs) and/or animation time (for cursor blink) for back-end to be able stop refreshing easily.
|
||||
@ -395,9 +398,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- misc: possible compile-time support for string view/range instead of char* would e.g. facilitate usage with Rust (#683)
|
||||
- misc: possible compile-time support for wchar_t instead of char*?
|
||||
|
||||
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
||||
- emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
|
||||
|
||||
- remote: make a system like RemoteImGui first-class citizen/project (#75)
|
||||
|
||||
- demo: find a way to demonstrate textures in the examples application, as it such a common issue for new users.
|
||||
@ -406,14 +406,19 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- demo: add virtual scrolling example?
|
||||
- demo: demonstrate Plot offset
|
||||
- demo: window size constraint: square demo is broken when resizing from edges (#1975), would need to rework the callback system to solve this
|
||||
|
||||
- examples: window minimize, maximize (#583)
|
||||
- examples: provide a zero frame-rate/idle example.
|
||||
- examples: apple: example_apple should be using modern GL3.
|
||||
- examples: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // issue: DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
||||
- examples: opengl: rename imgui_impl_opengl2 to impl_opengl_legacy and imgui_impl_opengl3 to imgui_impl_opengl? (#1900)
|
||||
- examples: opengl: could use a single vertex buffer and glBufferSubData for uploads?
|
||||
- examples: opengl: explicitly disable GL_STENCIL_TEST in bindings.
|
||||
- examples: vulkan: viewport: support for synchronized swapping of multiple swap chains.
|
||||
- backends: apple: example_apple should be using modern GL3.
|
||||
- backends: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // issue: DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
||||
- backends: opengl: rename imgui_impl_opengl2 to impl_opengl_legacy and imgui_impl_opengl3 to imgui_impl_opengl? (#1900)
|
||||
- backends: opengl: could use a single vertex buffer and glBufferSubData for uploads?
|
||||
- backends: opengl: explicitly disable GL_STENCIL_TEST in bindings.
|
||||
- backends: opengl: consider gl_lite loader https://github.com/ApoorvaJ/Papaya/blob/3808e39b0f45d4ca4972621c847586e4060c042a/src/libs/gl_lite.h
|
||||
- backends: vulkan: viewport: support for synchronized swapping of multiple swap chains.
|
||||
- backends: bgfx: https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
||||
- backends: mscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
|
||||
|
||||
- optimization: replace vsnprintf with stb_printf? or enable the defines/infrastructure to allow it (#1038)
|
||||
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
||||
- optimization: add a flag to disable most of rendering, for the case where the user expect to skip it (#335)
|
||||
|
@ -1,5 +1,5 @@
|
||||
-----------------------------------------------------------------------
|
||||
dear imgui, v1.74
|
||||
dear imgui, v1.75 WIP
|
||||
-----------------------------------------------------------------------
|
||||
examples/README.txt
|
||||
(This is the README file for the examples/ folder. See docs/ for more documentation)
|
||||
|
@ -81,6 +81,8 @@ int main(int, char**)
|
||||
|
||||
// Main loop
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
// Poll and handle events (inputs, window resize, etc.)
|
||||
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
||||
@ -154,6 +156,7 @@ int main(int, char**)
|
||||
[commandBuffer presentDrawable:drawable];
|
||||
[commandBuffer commit];
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
ImGui_ImplMetal_Shutdown();
|
||||
|
@ -52,7 +52,7 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
||||
ECHO_MESSAGE = "MinGW"
|
||||
LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32
|
||||
|
||||
CXXFLAGS += -I../libs/gl3w `pkg-config --cflags glfw3`
|
||||
CXXFLAGS += `pkg-config --cflags glfw3`
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
|
@ -31,7 +31,7 @@ LIBS =
|
||||
|
||||
## Using OpenGL loader: gl3w [default]
|
||||
SOURCES += ../libs/gl3w/GL/gl3w.c
|
||||
CXXFLAGS += -I../libs/gl3w
|
||||
CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||
|
||||
## Using OpenGL loader: glew
|
||||
## (This assumes a system-wide installation)
|
||||
|
@ -4,13 +4,18 @@
|
||||
#
|
||||
|
||||
EXE = example_null
|
||||
SOURCES = main.cpp
|
||||
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
|
||||
EXTRA_WARNINGS ?= 0
|
||||
UNITY_BUILD ?= 0
|
||||
ifeq ($(UNITY_BUILD), 1)
|
||||
SOURCES = unity_build.cpp
|
||||
else
|
||||
SOURCES = main.cpp
|
||||
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
|
||||
endif
|
||||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
||||
UNAME_S := $(shell uname -s)
|
||||
EXTRA_WARNINGS ?= 0
|
||||
|
||||
CXXFLAGS = -I../ -I../../
|
||||
CXXFLAGS += -I../ -I../../
|
||||
CXXFLAGS += -g -Wall -Wformat
|
||||
LIBS =
|
||||
|
||||
@ -60,10 +65,6 @@ endif
|
||||
%.o:../../%.cpp
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
%.o:../libs/gl3w/GL/%.c
|
||||
# %.o:../libs/glad/src/%.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
all: $(EXE)
|
||||
@echo Build complete for $(ECHO_MESSAGE)
|
||||
|
||||
|
6
examples/example_null/unity_build.cpp
Normal file
6
examples/example_null/unity_build.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
// Unity build test - build this example as a single compilation unit.
|
||||
#include "main.cpp"
|
||||
#include "../../imgui.cpp"
|
||||
#include "../../imgui_demo.cpp"
|
||||
#include "../../imgui_draw.cpp"
|
||||
#include "../../imgui_widgets.cpp"
|
@ -31,7 +31,7 @@ LIBS =
|
||||
|
||||
## Using OpenGL loader: gl3w [default]
|
||||
SOURCES += ../libs/gl3w/GL/gl3w.c
|
||||
CXXFLAGS += -I../libs/gl3w
|
||||
CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||
|
||||
## Using OpenGL loader: glew
|
||||
## (This assumes a system-wide installation)
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||
// 2019-05-11: Inputs: Don't filter character value from ALLEGRO_EVENT_KEY_CHAR before calling AddInputCharacter().
|
||||
// 2019-04-30: Renderer: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||
@ -390,6 +391,7 @@ static void ImGui_ImplAllegro5_UpdateMouseCursor()
|
||||
case ImGuiMouseCursor_ResizeEW: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E; break;
|
||||
case ImGuiMouseCursor_ResizeNESW: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE; break;
|
||||
case ImGuiMouseCursor_ResizeNWSE: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW; break;
|
||||
case ImGuiMouseCursor_NotAllowed: cursor_id = ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE; break;
|
||||
}
|
||||
al_set_system_mouse_cursor(g_Display, cursor_id);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
|
||||
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
|
||||
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2019-12-05: Inputs: Added support for new mouse cursors added in GLFW 3.4+ (resizing cursors, not allowed cursor).
|
||||
// 2019-10-18: Misc: Previously installed user callbacks are now restored on shutdown.
|
||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||
// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
|
||||
@ -55,6 +56,11 @@
|
||||
#define GLFW_HAS_FOCUS_WINDOW (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwFocusWindow
|
||||
#define GLFW_HAS_FOCUS_ON_SHOW (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ GLFW_FOCUS_ON_SHOW
|
||||
#define GLFW_HAS_MONITOR_WORK_AREA (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorWorkarea
|
||||
#ifdef GLFW_RESIZE_NESW_CURSOR // Let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
|
||||
#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
|
||||
#else
|
||||
#define GLFW_HAS_NEW_CURSORS (0)
|
||||
#endif
|
||||
|
||||
// Data
|
||||
enum GlfwClientApi
|
||||
@ -183,12 +189,20 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
||||
|
||||
g_MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = 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);
|
||||
#if GLFW_HAS_NEW_CURSORS
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_RESIZE_ALL_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_RESIZE_NESW_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_RESIZE_NWSE_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_NOT_ALLOWED_CURSOR);
|
||||
#else
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
g_MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
#endif
|
||||
|
||||
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||
g_PrevUserCallbackMousebutton = NULL;
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||
// 2019-10-11: Inputs: Fix using Backspace key.
|
||||
// 2019-07-21: Re-added clipboard handlers as they are not enabled by default in core imgui.cpp (reverted 2019-05-18 change).
|
||||
// 2019-05-28: Inputs: Added mouse cursor shape and visibility support.
|
||||
@ -79,6 +80,7 @@ bool ImGui_ImplOSX_Init()
|
||||
g_MouseCursors[ImGuiMouseCursor_TextInput] = [NSCursor IBeamCursor];
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = [NSCursor closedHandCursor];
|
||||
g_MouseCursors[ImGuiMouseCursor_Hand] = [NSCursor pointingHandCursor];
|
||||
g_MouseCursors[ImGuiMouseCursor_NotAllowed] = [NSCursor operationNotAllowedCursor];
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNS] = [NSCursor respondsToSelector:@selector(_windowResizeNorthSouthCursor)] ? [NSCursor _windowResizeNorthSouthCursor] : [NSCursor resizeUpDownCursor];
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = [NSCursor respondsToSelector:@selector(_windowResizeEastWestCursor)] ? [NSCursor _windowResizeEastWestCursor] : [NSCursor resizeLeftRightCursor];
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = [NSCursor respondsToSelector:@selector(_windowResizeNorthEastSouthWestCursor)] ? [NSCursor _windowResizeNorthEastSouthWestCursor] : [NSCursor closedHandCursor];
|
||||
|
@ -20,6 +20,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||
// 2019-04-23: Inputs: Added support for SDL_GameController (if ImGuiConfigFlags_NavEnableGamepad is set by user application).
|
||||
// 2019-03-12: Misc: Preserve DisplayFramebufferScale when main window is minimized.
|
||||
@ -198,6 +199,7 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window, void* sdl_gl_context)
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
|
||||
g_MouseCursors[ImGuiMouseCursor_Hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
g_MouseCursors[ImGuiMouseCursor_NotAllowed] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
|
||||
|
||||
// Our mouse update function expect PlatformHandle to be filled for the main viewport
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||
// 2019-05-11: Inputs: Don't filter value from WM_CHAR before calling AddInputCharacter().
|
||||
// 2019-01-17: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.
|
||||
// 2019-01-17: Inputs: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages.
|
||||
@ -136,6 +137,7 @@ static bool ImGui_ImplWin32_UpdateMouseCursor()
|
||||
case ImGuiMouseCursor_ResizeNESW: win32_cursor = IDC_SIZENESW; break;
|
||||
case ImGuiMouseCursor_ResizeNWSE: win32_cursor = IDC_SIZENWSE; break;
|
||||
case ImGuiMouseCursor_Hand: win32_cursor = IDC_HAND; break;
|
||||
case ImGuiMouseCursor_NotAllowed: win32_cursor = IDC_NO; break;
|
||||
}
|
||||
::SetCursor(::LoadCursor(NULL, win32_cursor));
|
||||
}
|
||||
|
13
imconfig.h
13
imconfig.h
@ -22,7 +22,7 @@
|
||||
//#define IMGUI_API __declspec( dllexport )
|
||||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
|
||||
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
|
||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
|
||||
//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
|
||||
@ -77,14 +77,19 @@
|
||||
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
|
||||
//#define ImDrawCallback MyImDrawCallback
|
||||
|
||||
//---- Debug Tools
|
||||
// Use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.
|
||||
//---- Debug Tools: Macro to break in Debugger
|
||||
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
|
||||
//#define IM_DEBUG_BREAK IM_ASSERT(0)
|
||||
//#define IM_DEBUG_BREAK __debugbreak()
|
||||
// Have the Item Picker break in the ItemAdd() function instead of ItemHoverable() - which is earlier in the code, will catch a few extra items, allow picking items other than Hovered one.
|
||||
|
||||
//---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(),
|
||||
// (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.)
|
||||
// This adds a small runtime cost which is why it is not enabled by default.
|
||||
//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
|
||||
|
||||
//---- Debug Tools: Enable slower asserts
|
||||
//#define IMGUI_DEBUG_PARANOID
|
||||
|
||||
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
||||
/*
|
||||
namespace ImGui
|
||||
|
126
imgui.cpp
126
imgui.cpp
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.74
|
||||
// dear imgui, v1.75 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
||||
@ -45,7 +45,7 @@ CODE
|
||||
// [SECTION] FORWARD DECLARATIONS
|
||||
// [SECTION] CONTEXT AND MEMORY ALLOCATORS
|
||||
// [SECTION] MAIN USER FACING STRUCTURES (ImGuiStyle, ImGuiIO)
|
||||
// [SECTION] MISC HELPERS/UTILITIES (Geomtry, String, Format, Hash, File functions)
|
||||
// [SECTION] MISC HELPERS/UTILITIES (Geometry, String, Format, Hash, File functions)
|
||||
// [SECTION] MISC HELPERS/UTILITIES (File functions)
|
||||
// [SECTION] MISC HELPERS/UTILITIES (ImText* functions)
|
||||
// [SECTION] MISC HELPERS/UTILITIES (Color functions)
|
||||
@ -312,9 +312,18 @@ CODE
|
||||
USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS
|
||||
------------------------------------------
|
||||
- The gamepad/keyboard navigation is fairly functional and keeps being improved.
|
||||
- Gamepad support is particularly useful to use dear imgui on a console system (e.g. PS4, Switch, XB1) without a mouse!
|
||||
- Gamepad support is particularly useful to use Dear ImGui on a console system (e.g. PS4, Switch, XB1) without a mouse!
|
||||
- You can ask questions and report issues at https://github.com/ocornut/imgui/issues/787
|
||||
- The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
||||
- Keyboard:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable.
|
||||
NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
||||
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag
|
||||
will be set. For more advanced uses, you may want to read from:
|
||||
- io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.
|
||||
- io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used).
|
||||
- or query focus information with e.g. IsWindowFocused(ImGuiFocusedFlags_AnyWindow), IsItemFocused() etc. functions.
|
||||
Please reach out if you think the game vs navigation input sharing could be improved.
|
||||
- Gamepad:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.
|
||||
- Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame().
|
||||
@ -326,15 +335,6 @@ CODE
|
||||
- You can download PNG/PSD files depicting the gamepad controls for common controllers at: http://goo.gl/9LgVZW.
|
||||
- If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo
|
||||
to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved.
|
||||
- Keyboard:
|
||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable.
|
||||
NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
||||
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag
|
||||
will be set. For more advanced uses, you may want to read from:
|
||||
- io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.
|
||||
- io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used).
|
||||
- or query focus information with e.g. IsWindowFocused(ImGuiFocusedFlags_AnyWindow), IsItemFocused() etc. functions.
|
||||
Please reach out if you think the game vs navigation input sharing could be improved.
|
||||
- Mouse:
|
||||
- PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.
|
||||
- Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + uSynergy.c (on your console/tablet/phone app) to share your PC mouse/keyboard.
|
||||
@ -364,10 +364,29 @@ CODE
|
||||
- 2019/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
||||
|
||||
|
||||
- 2019/12/13 (1.75) - [imgui_internal.h] changed ImRect() default constructor initializes all fields to 0.0f instead of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by adding multiple points into it, you may need to fix your initial value.
|
||||
- 2019/12/08 (1.75) - removed redirecting functions/enums that were marked obsolete in 1.53 (December 2017):
|
||||
- ShowTestWindow() -> use ShowDemoWindow()
|
||||
- IsRootWindowFocused() -> use IsWindowFocused(ImGuiFocusedFlags_RootWindow)
|
||||
- IsRootWindowOrAnyChildFocused() -> use IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows)
|
||||
- SetNextWindowContentWidth(w) -> use SetNextWindowContentSize(ImVec2(w, 0.0f)
|
||||
- GetItemsLineHeightWithSpacing() -> use GetFrameHeightWithSpacing()
|
||||
- ImGuiCol_ChildWindowBg -> use ImGuiCol_ChildBg
|
||||
- ImGuiStyleVar_ChildWindowRounding -> use ImGuiStyleVar_ChildRounding
|
||||
- ImGuiTreeNodeFlags_AllowOverlapMode -> use ImGuiTreeNodeFlags_AllowItemOverlap
|
||||
- IMGUI_DISABLE_TEST_WINDOWS -> use IMGUI_DISABLE_DEMO_WINDOWS
|
||||
- 2019/12/08 (1.75) - obsoleted calling ImDrawList::PrimReserve() with a negative count (which was the vaguely documented and rarely if ever used). Instead we added an explicit PrimUnreserve() API.
|
||||
- 2019/12/06 (1.75) - removed implicit default parameter to IsMouseDragging(int button = 0) to be consistent with other mouse functions (none of the other functions have it).
|
||||
>>>>>>> refs/heads/master
|
||||
- 2019/11/21 (1.74) - ImFontAtlas::AddCustomRectRegular() now requires an ID larger than 0x110000 (instead of 0x10000) to conform with supporting Unicode planes 1-16 in a future update. ID below 0x110000 will now assert.
|
||||
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS for consistency.
|
||||
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS for consistency.
|
||||
- 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. See docs/Changelog.txt or grep this log for details and new names, or see how they were implemented until 1.73.
|
||||
- 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017):
|
||||
- Begin() [old 5 args version] -> use Begin() [3 args], use SetNextWindowSize() SetNextWindowBgAlpha() if needed
|
||||
- IsRootWindowOrAnyChildHovered() -> use IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows)
|
||||
- AlignFirstTextHeightToWidgets() -> use AlignTextToFramePadding()
|
||||
- SetNextWindowPosCenter() -> use SetNextWindowPos() with a pivot of (0.5f, 0.5f)
|
||||
- ImFont::Glyph -> use ImFontGlyph
|
||||
- 2019/10/14 (1.74) - inputs: Fixed a miscalculation in the keyboard/mouse "typematic" repeat delay/rate calculation, used by keys and e.g. repeating mouse buttons as well as the GetKeyPressedAmount() function.
|
||||
if you were using a non-default value for io.KeyRepeatRate (previous default was 0.250), you can add +io.KeyRepeatDelay to it to compensate for the fix.
|
||||
The function was triggering on: 0.0 and (delay+rate*N) where (N>=1). Fixed formula responds to (N>=0). Effectively it made io.KeyRepeatRate behave like it was set to (io.KeyRepeatRate + io.KeyRepeatDelay).
|
||||
@ -546,14 +565,13 @@ CODE
|
||||
- 2015/02/01 (1.31) - removed IO.MemReallocFn (unused)
|
||||
- 2015/01/19 (1.30) - renamed ImGuiStorage::GetIntPtr()/GetFloatPtr() to GetIntRef()/GetIntRef() because Ptr was conflicting with actual pointer storage functions.
|
||||
- 2015/01/11 (1.30) - big font/image API change! now loads TTF file. allow for multiple fonts. no need for a PNG loader.
|
||||
(1.30) - removed GetDefaultFontData(). uses io.Fonts->GetTextureData*() API to retrieve uncompressed pixels.
|
||||
font init: { const void* png_data; unsigned int png_size; ImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size); <..Upload texture to GPU..>; }
|
||||
became: { unsigned char* pixels; int width, height; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); <..Upload texture to GPU>; io.Fonts->TexId = YourTextureIdentifier; }
|
||||
you now have more flexibility to load multiple TTF fonts and manage the texture buffer for internal needs.
|
||||
it is now recommended that you sample the font texture with bilinear interpolation.
|
||||
(1.30) - added texture identifier in ImDrawCmd passed to your render function (we can now render images). make sure to set io.Fonts->TexID.
|
||||
(1.30) - removed IO.PixelCenterOffset (unnecessary, can be handled in user projection matrix)
|
||||
(1.30) - removed ImGui::IsItemFocused() in favor of ImGui::IsItemActive() which handles all widgets
|
||||
- 2015/01/11 (1.30) - removed GetDefaultFontData(). uses io.Fonts->GetTextureData*() API to retrieve uncompressed pixels.
|
||||
- old: const void* png_data; unsigned int png_size; ImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size); [..Upload texture to GPU..];
|
||||
- new: unsigned char* pixels; int width, height; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); [..Upload texture to GPU..]; io.Fonts->TexId = YourTexIdentifier;
|
||||
you now have more flexibility to load multiple TTF fonts and manage the texture buffer for internal needs. It is now recommended that you sample the font texture with bilinear interpolation.
|
||||
- 2015/01/11 (1.30) - added texture identifier in ImDrawCmd passed to your render function (we can now render images). make sure to set io.Fonts->TexID.
|
||||
- 2015/01/11 (1.30) - removed IO.PixelCenterOffset (unnecessary, can be handled in user projection matrix)
|
||||
- 2015/01/11 (1.30) - removed ImGui::IsItemFocused() in favor of ImGui::IsItemActive() which handles all widgets
|
||||
- 2014/12/10 (1.18) - removed SetNewWindowDefaultPos() in favor of new generic API SetNextWindowPos(pos, ImGuiSetCondition_FirstUseEver)
|
||||
- 2014/11/28 (1.17) - moved IO.Font*** options to inside the IO.Font-> structure (FontYOffset, FontTexUvForWhite, FontBaseScale, FontFallbackGlyph)
|
||||
- 2014/11/26 (1.17) - reworked syntax of IMGUI_ONCE_UPON_A_FRAME helper macro to increase compiler compatibility
|
||||
@ -582,13 +600,16 @@ CODE
|
||||
- See demo code in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function.
|
||||
- The demo covers most features of Dear ImGui, so you can read the code and see its output.
|
||||
- See documentation and comments at the top of imgui.cpp + effectively imgui.h.
|
||||
- Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the examples/
|
||||
folder to explain how to integrate Dear ImGui with your own engine/application.
|
||||
- Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the
|
||||
examples/ folder to explain how to integrate Dear ImGui with your own engine/application.
|
||||
- The Wiki (https://github.com/ocornut/imgui/wiki) has many resources and links.
|
||||
- The Glossary (https://github.com/ocornut/imgui/wiki/Glossary) page also may be useful.
|
||||
- Your programming IDE is your friend, find the type or function declaration to find comments
|
||||
associated to it.
|
||||
|
||||
Q: Which version should I get?
|
||||
Q: Why the names "Dear ImGui" vs "ImGui"?
|
||||
>> This library is called "Dear ImGui", please don't call it "ImGui" :)
|
||||
>> See https://www.dearimgui.org/faq
|
||||
|
||||
Q&A: Concerns
|
||||
@ -618,6 +639,7 @@ CODE
|
||||
have 'io.WantCaptureKeyboard=false'. Depending on your application logic it may or not be inconvenient. You might want to track which key-downs
|
||||
were targeted for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.)
|
||||
|
||||
Q. How can I enable keyboard controls?
|
||||
Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)
|
||||
Q: I integrated Dear ImGui in my engine and the text or lines are blurry..
|
||||
Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around..
|
||||
@ -1027,6 +1049,7 @@ ImGuiIO::ImGuiIO()
|
||||
{
|
||||
// Most fields are initialized with zero
|
||||
memset(this, 0, sizeof(*this));
|
||||
IM_ASSERT(IM_ARRAYSIZE(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_ARRAYSIZE(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT); // Our pre-C++11 IM_STATIC_ASSERT() macros triggers warning on modern compilers so we don't use it here.
|
||||
|
||||
// Settings
|
||||
ConfigFlags = ImGuiConfigFlags_None;
|
||||
@ -4582,7 +4605,8 @@ int ImGui::GetKeyIndex(ImGuiKey imgui_key)
|
||||
return g.IO.KeyMap[imgui_key];
|
||||
}
|
||||
|
||||
// Note that imgui doesn't know the semantic of each entry of io.KeysDown[]. Use your own indices/enums according to how your back-end/engine stored them into io.KeysDown[]!
|
||||
// Note that dear imgui doesn't know the semantic of each entry of io.KeysDown[]!
|
||||
// Use your own indices/enums according to how your back-end/engine stored them into io.KeysDown[]!
|
||||
bool ImGui::IsKeyDown(int user_key_index)
|
||||
{
|
||||
if (user_key_index < 0)
|
||||
@ -4642,23 +4666,14 @@ bool ImGui::IsKeyReleased(int user_key_index)
|
||||
return g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !g.IO.KeysDown[user_key_index];
|
||||
}
|
||||
|
||||
bool ImGui::IsMouseDown(int button)
|
||||
bool ImGui::IsMouseDown(ImGuiMouseButton button)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
return g.IO.MouseDown[button];
|
||||
}
|
||||
|
||||
bool ImGui::IsAnyMouseDown()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++)
|
||||
if (g.IO.MouseDown[n])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::IsMouseClicked(int button, bool repeat)
|
||||
bool ImGui::IsMouseClicked(ImGuiMouseButton button, bool repeat)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
@ -4673,18 +4688,17 @@ bool ImGui::IsMouseClicked(int button, bool repeat)
|
||||
if (amount > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::IsMouseReleased(int button)
|
||||
bool ImGui::IsMouseReleased(ImGuiMouseButton button)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
return g.IO.MouseReleased[button];
|
||||
}
|
||||
|
||||
bool ImGui::IsMouseDoubleClicked(int button)
|
||||
bool ImGui::IsMouseDoubleClicked(ImGuiMouseButton button)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
@ -4692,7 +4706,7 @@ bool ImGui::IsMouseDoubleClicked(int button)
|
||||
}
|
||||
|
||||
// [Internal] This doesn't test if the button is pressed
|
||||
bool ImGui::IsMouseDragPastThreshold(int button, float lock_threshold)
|
||||
bool ImGui::IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
@ -4701,7 +4715,7 @@ bool ImGui::IsMouseDragPastThreshold(int button, float lock_threshold)
|
||||
return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
|
||||
}
|
||||
|
||||
bool ImGui::IsMouseDragging(int button, float lock_threshold)
|
||||
bool ImGui::IsMouseDragging(ImGuiMouseButton button, float lock_threshold)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
@ -4712,7 +4726,8 @@ bool ImGui::IsMouseDragging(int button, float lock_threshold)
|
||||
|
||||
ImVec2 ImGui::GetMousePos()
|
||||
{
|
||||
return GImGui->IO.MousePos;
|
||||
ImGuiContext& g = *GImGui;
|
||||
return g.IO.MousePos;
|
||||
}
|
||||
|
||||
// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed!
|
||||
@ -4735,10 +4750,19 @@ bool ImGui::IsMousePosValid(const ImVec2* mouse_pos)
|
||||
return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID;
|
||||
}
|
||||
|
||||
bool ImGui::IsAnyMouseDown()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++)
|
||||
if (g.IO.MouseDown[n])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return the delta from the initial clicking position while the mouse button is clicked or was just released.
|
||||
// This is locked and return 0.0f until the mouse moves past a distance threshold at least once.
|
||||
// NB: This is only valid if IsMousePosValid(). Back-ends in theory should always keep mouse position valid when dragging even outside the client window.
|
||||
ImVec2 ImGui::GetMouseDragDelta(int button, float lock_threshold)
|
||||
ImVec2 ImGui::GetMouseDragDelta(ImGuiMouseButton button, float lock_threshold)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
@ -4751,7 +4775,7 @@ ImVec2 ImGui::GetMouseDragDelta(int button, float lock_threshold)
|
||||
return ImVec2(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void ImGui::ResetMouseDragDelta(int button)
|
||||
void ImGui::ResetMouseDragDelta(ImGuiMouseButton button)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
@ -4833,7 +4857,7 @@ bool ImGui::IsItemFocused()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui::IsItemClicked(int mouse_button)
|
||||
bool ImGui::IsItemClicked(ImGuiMouseButton mouse_button)
|
||||
{
|
||||
return IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_None);
|
||||
}
|
||||
@ -4977,7 +5001,7 @@ void ImGui::EndChild()
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
IM_ASSERT(g.WithinEndChild == false);
|
||||
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss
|
||||
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
|
||||
|
||||
g.WithinEndChild = true;
|
||||
if (window->BeginCount > 1)
|
||||
@ -8299,7 +8323,7 @@ void ImGui::EndPopup()
|
||||
g.WithinEndChild = false;
|
||||
}
|
||||
|
||||
bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button)
|
||||
bool ImGui::OpenPopupOnItemClick(const char* str_id, ImGuiMouseButton mouse_button)
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||
@ -8315,7 +8339,7 @@ bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button)
|
||||
// This is a helper to handle the simplest case of associating one named popup to one given widget.
|
||||
// You may want to handle this on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters).
|
||||
// You can pass a NULL str_id to use the identifier of the last item.
|
||||
bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button)
|
||||
bool ImGui::BeginPopupContextItem(const char* str_id, ImGuiMouseButton mouse_button)
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
if (window->SkipItems)
|
||||
@ -8327,7 +8351,7 @@ bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button)
|
||||
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings);
|
||||
}
|
||||
|
||||
bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool also_over_items)
|
||||
bool ImGui::BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mouse_button, bool also_over_items)
|
||||
{
|
||||
if (!str_id)
|
||||
str_id = "window_context";
|
||||
@ -8338,7 +8362,7 @@ bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool a
|
||||
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings);
|
||||
}
|
||||
|
||||
bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
|
||||
bool ImGui::BeginPopupContextVoid(const char* str_id, ImGuiMouseButton mouse_button)
|
||||
{
|
||||
if (!str_id)
|
||||
str_id = "void_context";
|
||||
@ -9563,7 +9587,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
||||
bool source_drag_active = false;
|
||||
ImGuiID source_id = 0;
|
||||
ImGuiID source_parent_id = 0;
|
||||
int mouse_button = 0;
|
||||
ImGuiMouseButton mouse_button = ImGuiMouseButton_Left;
|
||||
if (!(flags & ImGuiDragDropFlags_SourceExtern))
|
||||
{
|
||||
source_id = window->DC.LastItemId;
|
||||
@ -14893,7 +14917,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
if (show_drawcmd_details && fg_draw_list && ImGui::IsItemHovered())
|
||||
{
|
||||
ImRect clip_rect = pcmd->ClipRect;
|
||||
ImRect vtxs_rect;
|
||||
ImRect vtxs_rect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
|
||||
for (unsigned int i = elem_offset; i < elem_offset + (int)pcmd->ElemCount; i++)
|
||||
vtxs_rect.Add(draw_list->VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos);
|
||||
fg_draw_list->AddRect(ImFloor(clip_rect.Min), ImFloor(clip_rect.Max), IM_COL32(255,0,255,255));
|
||||
|
106
imgui.h
106
imgui.h
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.74
|
||||
// dear imgui, v1.75 WIP
|
||||
// (headers)
|
||||
|
||||
// See imgui.cpp file for documentation.
|
||||
@ -48,8 +48,8 @@ Index of this file:
|
||||
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.74"
|
||||
#define IMGUI_VERSION_NUM 17400
|
||||
#define IMGUI_VERSION "1.75 WIP"
|
||||
#define IMGUI_VERSION_NUM 17401
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
|
||||
#define IMGUI_HAS_DOCK 1 // Docking WIP branch
|
||||
@ -145,6 +145,7 @@ typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A
|
||||
typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction
|
||||
typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier (ImGui-side enum)
|
||||
typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation
|
||||
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle)
|
||||
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier
|
||||
typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
|
||||
typedef int ImDrawCornerFlags; // -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect(), AddRectFilled() etc.
|
||||
@ -445,6 +446,7 @@ namespace ImGui
|
||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
||||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
|
||||
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
||||
// - Use v_min > v_max to lock edits.
|
||||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
||||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f);
|
||||
@ -577,16 +579,17 @@ namespace ImGui
|
||||
// - 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.
|
||||
// User can manipulate the visibility state by calling OpenPopup().
|
||||
// - We default to use the right mouse (ImGuiMouseButton_Right=1) for the Popup Context functions.
|
||||
// (*) You can use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) to bypass it and detect hovering even when normally blocked by a popup.
|
||||
// Those three properties are connected. The library needs to hold their visibility state because it can close popups at any time.
|
||||
IMGUI_API void OpenPopup(const char* str_id); // call to mark popup as open (don't call every frame!). popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).
|
||||
IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it. only call EndPopup() if BeginPopup() returns true!
|
||||
IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!
|
||||
IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, int mouse_button = 1, bool also_over_items = true); // helper to open and begin popup when clicked on current window.
|
||||
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 BeginPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mouse_button = 1); // helper to open and begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!
|
||||
IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, ImGuiMouseButton mouse_button = 1, bool also_over_items = true); // helper to open and begin popup when clicked on current window.
|
||||
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, ImGuiMouseButton 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 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 (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). return true when just opened.
|
||||
IMGUI_API bool OpenPopupOnItemClick(const char* str_id = NULL, ImGuiMouseButton 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 at the current begin-ed level of the popup stack.
|
||||
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
|
||||
|
||||
@ -660,7 +663,7 @@ namespace ImGui
|
||||
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 IsItemFocused(); // is the last item focused for keyboard/gamepad navigation?
|
||||
IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on) == IsMouseClicked(mouse_button) && IsItemHovered()
|
||||
IMGUI_API bool IsItemClicked(ImGuiMouseButton mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on) == IsMouseClicked(mouse_button) && IsItemHovered()
|
||||
IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling)
|
||||
IMGUI_API bool IsItemEdited(); // did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets.
|
||||
IMGUI_API bool IsItemActivated(); // was the last item just made active (item was previously inactive).
|
||||
@ -699,27 +702,34 @@ namespace ImGui
|
||||
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);
|
||||
|
||||
// Inputs Utilities
|
||||
// Inputs Utilities: Keyboard
|
||||
// - For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].
|
||||
// - We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index.
|
||||
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 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 IsKeyReleased(int user_key_index); // was key released (went from Down to !Down)..
|
||||
IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index].
|
||||
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 IsKeyReleased(int user_key_index); // was key released (went from Down to !Down)?
|
||||
IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate
|
||||
IMGUI_API bool IsMouseDown(int button); // is mouse button held (0=left, 1=right, 2=middle)
|
||||
IMGUI_API bool IsAnyMouseDown(); // is any mouse button held
|
||||
IMGUI_API bool IsMouseClicked(int button, bool repeat = false); // did mouse button clicked (went from !Down to Down) (0=left, 1=right, 2=middle)
|
||||
IMGUI_API bool IsMouseDoubleClicked(int button); // did mouse button double-clicked. a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime.
|
||||
IMGUI_API bool IsMouseReleased(int button); // did mouse button released (went from Down to !Down)
|
||||
IMGUI_API bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f); // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold
|
||||
IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true); // is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
|
||||
IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse
|
||||
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
||||
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve backup of mouse position at the time of opening popup we have BeginPopup() into
|
||||
IMGUI_API ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once. If lock_threshold < -1.0f uses io.MouseDraggingThreshold.
|
||||
IMGUI_API void ResetMouseDragDelta(int button = 0); //
|
||||
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
||||
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type
|
||||
IMGUI_API void CaptureKeyboardFromApp(bool want_capture_keyboard_value = true); // attention: misleading name! manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard_value"; after the next NewFrame() call.
|
||||
|
||||
// Inputs Utilities: Mouse
|
||||
// - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
|
||||
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
||||
// - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
|
||||
IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held?
|
||||
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down)
|
||||
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down)
|
||||
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime.
|
||||
IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
|
||||
IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available
|
||||
IMGUI_API bool IsAnyMouseDown(); // is any mouse button held?
|
||||
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
||||
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves)
|
||||
IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)
|
||||
IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)
|
||||
IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); //
|
||||
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
||||
IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired cursor type
|
||||
IMGUI_API void CaptureMouseFromApp(bool want_capture_mouse_value = true); // attention: misleading name! manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse_value;" after the next NewFrame() call.
|
||||
|
||||
// Clipboard Utilities (also see the LogToClipboard() function to capture or output text data to the clipboard)
|
||||
@ -797,8 +807,8 @@ enum ImGuiWindowFlags_
|
||||
ImGuiWindowFlags_DockNodeHost = 1 << 29 // Don't use! For internal use by Begin()/NewFrame()
|
||||
|
||||
// [Obsolete]
|
||||
//ImGuiWindowFlags_ShowBorders = 1 << 7, // --> Set style.FrameBorderSize=1.0f / style.WindowBorderSize=1.0f to enable borders around windows and items
|
||||
//ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.ConfigWindowsResizeFromEdges and make sure mouse cursors are supported by back-end (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors)
|
||||
//ImGuiWindowFlags_ShowBorders = 1 << 7, // --> Set style.FrameBorderSize=1.0f or style.WindowBorderSize=1.0f to enable borders around items or windows.
|
||||
//ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.ConfigWindowsResizeFromEdges=true and make sure mouse cursors are supported by back-end (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors)
|
||||
};
|
||||
|
||||
// Flags for ImGui::InputText()
|
||||
@ -849,11 +859,6 @@ enum ImGuiTreeNodeFlags_
|
||||
ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop)
|
||||
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
|
||||
ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog
|
||||
|
||||
// Obsolete names (will be removed)
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
, ImGuiTreeNodeFlags_AllowOverlapMode = ImGuiTreeNodeFlags_AllowItemOverlap // [renamed in 1.53]
|
||||
#endif
|
||||
};
|
||||
|
||||
// Flags for ImGui::Selectable()
|
||||
@ -1160,9 +1165,7 @@ enum ImGuiCol_
|
||||
// Obsolete names (will be removed)
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
, ImGuiCol_ModalWindowDarkening = ImGuiCol_ModalWindowDimBg // [renamed in 1.63]
|
||||
, ImGuiCol_ChildWindowBg = ImGuiCol_ChildBg // [renamed in 1.53]
|
||||
//ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered, // [unused since 1.60+] the close button now uses regular button colors.
|
||||
//ImGuiCol_ComboBg, // [unused since 1.53+] ComboBg has been merged with PopupBg, so a redirect isn't accurate.
|
||||
//, ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered// [unused since 1.60+] the close button now uses regular button colors.
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1200,7 +1203,6 @@ enum ImGuiStyleVar_
|
||||
// Obsolete names (will be removed)
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
, ImGuiStyleVar_Count_ = ImGuiStyleVar_COUNT // [renamed in 1.60]
|
||||
, ImGuiStyleVar_ChildWindowRounding = ImGuiStyleVar_ChildRounding // [renamed in 1.53]
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1249,6 +1251,16 @@ enum ImGuiColorEditFlags_
|
||||
#endif
|
||||
};
|
||||
|
||||
// Identify a mouse button.
|
||||
// Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience.
|
||||
enum ImGuiMouseButton_
|
||||
{
|
||||
ImGuiMouseButton_Left = 0,
|
||||
ImGuiMouseButton_Right = 1,
|
||||
ImGuiMouseButton_Middle = 2,
|
||||
ImGuiMouseButton_COUNT = 5
|
||||
};
|
||||
|
||||
// Enumeration for GetMouseCursor()
|
||||
// User code may request binding to display given cursor by calling SetMouseCursor(), which is why we have some cursors that are marked unused here
|
||||
enum ImGuiMouseCursor_
|
||||
@ -1262,6 +1274,7 @@ enum ImGuiMouseCursor_
|
||||
ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window
|
||||
ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window
|
||||
ImGuiMouseCursor_Hand, // (Unused by Dear ImGui functions. Use for e.g. hyperlinks)
|
||||
ImGuiMouseCursor_NotAllowed, // When hovering something with disallowed interaction. Usually a crossed circle.
|
||||
ImGuiMouseCursor_COUNT
|
||||
|
||||
// Obsolete names (will be removed)
|
||||
@ -1347,7 +1360,7 @@ struct ImVector
|
||||
inline int _grow_capacity(int sz) const { int new_capacity = Capacity ? (Capacity + Capacity/2) : 8; return new_capacity > sz ? new_capacity : sz; }
|
||||
inline void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
|
||||
inline void resize(int new_size, const T& v) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; }
|
||||
inline void shrink(int new_size) { IM_ASSERT(new_size <= Size); Size = new_size; }
|
||||
inline void shrink(int new_size) { IM_ASSERT(new_size <= Size); Size = new_size; } // Resize a vector to a smaller size, guaranteed not to cause a reallocation
|
||||
inline void reserve(int new_capacity) { if (new_capacity <= Capacity) return; T* new_data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); if (Data) { memcpy(new_data, Data, (size_t)Size * sizeof(T)); IM_FREE(Data); } Data = new_data; Capacity = new_capacity; }
|
||||
|
||||
// NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden.
|
||||
@ -1476,9 +1489,9 @@ struct ImGuiIO
|
||||
// Optional: Platform/Renderer back-end name (informational only! will be displayed in About Window) + User data for back-end/wrappers to store their own stuff.
|
||||
const char* BackendPlatformName; // = NULL
|
||||
const char* BackendRendererName; // = NULL
|
||||
void* BackendPlatformUserData; // = NULL
|
||||
void* BackendRendererUserData; // = NULL
|
||||
void* BackendLanguageUserData; // = NULL
|
||||
void* BackendPlatformUserData; // = NULL // User data for platform back-end
|
||||
void* BackendRendererUserData; // = NULL // User data for renderer back-end
|
||||
void* BackendLanguageUserData; // = NULL // User data for non C++ programming language back-end
|
||||
|
||||
// Optional: Access OS clipboard
|
||||
// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
|
||||
@ -1536,7 +1549,7 @@ struct ImGuiIO
|
||||
ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// [Internal] ImGui will maintain those fields. Forward compatibility not guaranteed!
|
||||
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
|
||||
//------------------------------------------------------------------
|
||||
|
||||
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
||||
@ -1679,12 +1692,6 @@ namespace ImGui
|
||||
static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); }
|
||||
static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }
|
||||
static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { IM_UNUSED(on_edge); IM_UNUSED(outward); IM_ASSERT(0); return pos; }
|
||||
// OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||
static inline void ShowTestWindow() { return ShowDemoWindow(); }
|
||||
static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); }
|
||||
static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); }
|
||||
static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); }
|
||||
static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); }
|
||||
}
|
||||
typedef ImGuiInputTextCallback ImGuiTextEditCallback; // OBSOLETED in 1.63 (from Aug 2018): made the names consistent
|
||||
typedef ImGuiInputTextCallbackData ImGuiTextEditCallbackData;
|
||||
@ -2029,6 +2036,8 @@ struct ImDrawList
|
||||
IMGUI_API void AddTriangleFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col);
|
||||
IMGUI_API void AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments = 12, float thickness = 1.0f);
|
||||
IMGUI_API void AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments = 12);
|
||||
IMGUI_API void AddNgon(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness = 1.0f);
|
||||
IMGUI_API void AddNgonFilled(const ImVec2& center, float radius, ImU32 col, int num_segments);
|
||||
IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL);
|
||||
IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL);
|
||||
IMGUI_API void AddPolyline(const ImVec2* points, int num_points, ImU32 col, bool closed, float thickness);
|
||||
@ -2071,6 +2080,7 @@ struct ImDrawList
|
||||
IMGUI_API void Clear();
|
||||
IMGUI_API void ClearFreeMemory();
|
||||
IMGUI_API void PrimReserve(int idx_count, int vtx_count);
|
||||
IMGUI_API void PrimUnreserve(int idx_count, int vtx_count);
|
||||
IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles)
|
||||
IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);
|
||||
IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.74
|
||||
// dear imgui, v1.75 WIP
|
||||
// (demo code)
|
||||
|
||||
// Message to the person tempted to delete this file when integrating Dear ImGui into their code base:
|
||||
@ -116,10 +116,6 @@ Index of this file:
|
||||
// [SECTION] Forward Declarations, Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && defined(IMGUI_DISABLE_TEST_WINDOWS) && !defined(IMGUI_DISABLE_DEMO_WINDOWS) // Obsolete name since 1.53, TEST->DEMO
|
||||
#define IMGUI_DISABLE_DEMO_WINDOWS
|
||||
#endif
|
||||
|
||||
#if !defined(IMGUI_DISABLE_DEMO_WINDOWS)
|
||||
|
||||
// Forward Declarations
|
||||
@ -2085,7 +2081,7 @@ static void ShowDemoWindowLayout()
|
||||
if (ImGui::BeginTabBar("MyTabBar", tab_bar_flags))
|
||||
{
|
||||
for (int n = 0; n < IM_ARRAYSIZE(opened); n++)
|
||||
if (opened[n] && ImGui::BeginTabItem(names[n], &opened[n]))
|
||||
if (opened[n] && ImGui::BeginTabItem(names[n], &opened[n], ImGuiTabItemFlags_None))
|
||||
{
|
||||
ImGui::Text("This is the %s tab!", names[n]);
|
||||
if (n & 1)
|
||||
@ -2263,10 +2259,10 @@ static void ShowDemoWindowLayout()
|
||||
ImGui::SameLine(140); enable_track |= ImGui::DragInt("##item", &track_item, 0.25f, 0, 99, "Item = %d");
|
||||
|
||||
bool scroll_to_off = ImGui::Button("Scroll Offset");
|
||||
ImGui::SameLine(140); scroll_to_off |= ImGui::DragFloat("##off", &scroll_to_off_px, 1.00f, 0, 9999, "+%.0f px");
|
||||
ImGui::SameLine(140); scroll_to_off |= ImGui::DragFloat("##off", &scroll_to_off_px, 1.00f, 0, FLT_MAX, "+%.0f px");
|
||||
|
||||
bool scroll_to_pos = ImGui::Button("Scroll To Pos");
|
||||
ImGui::SameLine(140); scroll_to_pos |= ImGui::DragFloat("##pos", &scroll_to_pos_px, 1.00f, -10, 9999, "X/Y = %.0f px");
|
||||
ImGui::SameLine(140); scroll_to_pos |= ImGui::DragFloat("##pos", &scroll_to_pos_px, 1.00f, -10, FLT_MAX, "X/Y = %.0f px");
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
if (scroll_to_off || scroll_to_pos)
|
||||
@ -2503,7 +2499,7 @@ static void ShowDemoWindowLayout()
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
ImVec4 clip_rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y);
|
||||
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(0)) { 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()->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();
|
||||
@ -3109,7 +3105,7 @@ static void ShowDemoWindowMisc()
|
||||
|
||||
if (ImGui::TreeNode("Mouse cursors"))
|
||||
{
|
||||
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "Move", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand" };
|
||||
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" };
|
||||
IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT);
|
||||
|
||||
ImGui::Text("Current mouse cursor = %d: %s", ImGui::GetMouseCursor(), mouse_cursors_names[ImGui::GetMouseCursor()]);
|
||||
@ -4528,9 +4524,11 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||
{
|
||||
static float sz = 36.0f;
|
||||
static float thickness = 3.0f;
|
||||
static int ngon_sides = 6;
|
||||
static ImVec4 colf = ImVec4(1.0f, 1.0f, 0.4f, 1.0f);
|
||||
ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f");
|
||||
ImGui::DragFloat("Thickness", &thickness, 0.05f, 1.0f, 8.0f, "%.02f");
|
||||
ImGui::SliderInt("n-gon sides", &ngon_sides, 3, 12);
|
||||
ImGui::ColorEdit4("Color", &colf.x);
|
||||
const ImVec2 p = ImGui::GetCursorScreenPos();
|
||||
const ImU32 col = ImColor(colf);
|
||||
@ -4543,7 +4541,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||
{
|
||||
// First line uses a thickness of 1.0f, second line uses the configurable thickness
|
||||
float th = (n == 0) ? 1.0f : thickness;
|
||||
draw_list->AddCircle(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, 6, th); x += sz + spacing; // Hexagon
|
||||
draw_list->AddNgon(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, ngon_sides, th); x += sz + spacing; // n-gon
|
||||
draw_list->AddCircle(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, 20, th); x += sz + spacing; // Circle
|
||||
draw_list->AddRect(ImVec2(x, y), ImVec2(x + sz, y + sz), col, 0.0f, corners_none, th); x += sz + spacing; // Square
|
||||
draw_list->AddRect(ImVec2(x, y), ImVec2(x + sz, y + sz), col, 10.0f, corners_all, th); x += sz + spacing; // Square with all rounded corners
|
||||
@ -4557,7 +4555,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||
x = p.x + 4;
|
||||
y += sz + spacing;
|
||||
}
|
||||
draw_list->AddCircleFilled(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, 6); x += sz + spacing; // Hexagon
|
||||
draw_list->AddNgonFilled(ImVec2(x + sz * 0.5f, y + sz * 0.5f), sz*0.5f, col, ngon_sides); x += sz + spacing; // n-gon
|
||||
draw_list->AddCircleFilled(ImVec2(x + sz*0.5f, y + sz*0.5f), sz*0.5f, col, 32); x += sz + spacing; // Circle
|
||||
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + sz), col); x += sz + spacing; // Square
|
||||
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x + sz, y + sz), col, 10.0f); x += sz + spacing; // Square with all rounded corners
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.74
|
||||
// dear imgui, v1.75 WIP
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
@ -522,10 +522,13 @@ void ImDrawList::PopTextureID()
|
||||
UpdateTextureID();
|
||||
}
|
||||
|
||||
// NB: this can be called with negative count for removing primitives (as long as the result does not underflow)
|
||||
// Reserve space for a number of vertices and indices.
|
||||
// You must finish filling your reserved data before calling PrimReserve() again, as it may reallocate or
|
||||
// submit the intermediate results. PrimUnreserve() can be used to release unused allocations.
|
||||
void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
||||
{
|
||||
// Large mesh support (when enabled)
|
||||
IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);
|
||||
if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset))
|
||||
{
|
||||
_VtxCurrentOffset = VtxBuffer.Size;
|
||||
@ -533,7 +536,7 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
||||
AddDrawCmd();
|
||||
}
|
||||
|
||||
ImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size-1];
|
||||
ImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||
draw_cmd.ElemCount += idx_count;
|
||||
|
||||
int vtx_buffer_old_size = VtxBuffer.Size;
|
||||
@ -545,6 +548,17 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
||||
_IdxWritePtr = IdxBuffer.Data + idx_buffer_old_size;
|
||||
}
|
||||
|
||||
// Release the a number of reserved vertices/indices from the end of the last reservation made with PrimReserve().
|
||||
void ImDrawList::PrimUnreserve(int idx_count, int vtx_count)
|
||||
{
|
||||
IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);
|
||||
|
||||
ImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||
draw_cmd.ElemCount -= idx_count;
|
||||
VtxBuffer.shrink(VtxBuffer.Size - vtx_count);
|
||||
IdxBuffer.shrink(IdxBuffer.Size - idx_count);
|
||||
}
|
||||
|
||||
// Fully unrolled with inline call to keep our debug builds decently fast.
|
||||
void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col)
|
||||
{
|
||||
@ -1096,6 +1110,30 @@ void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col,
|
||||
PathFillConvex(col);
|
||||
}
|
||||
|
||||
// Guaranteed to honor 'num_segments'
|
||||
void ImDrawList::AddNgon(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness)
|
||||
{
|
||||
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
||||
return;
|
||||
|
||||
// Because we are filling a closed shape we remove 1 from the count of segments/points
|
||||
const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
||||
PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
|
||||
PathStroke(col, true, thickness);
|
||||
}
|
||||
|
||||
// Guaranteed to honor 'num_segments'
|
||||
void ImDrawList::AddNgonFilled(const ImVec2& center, float radius, ImU32 col, int num_segments)
|
||||
{
|
||||
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
||||
return;
|
||||
|
||||
// Because we are filling a closed shape we remove 1 from the count of segments/points
|
||||
const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
||||
PathArcTo(center, radius, 0.0f, a_max, num_segments - 1);
|
||||
PathFillConvex(col);
|
||||
}
|
||||
|
||||
void ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments)
|
||||
{
|
||||
if ((col & IM_COL32_A_MASK) == 0)
|
||||
@ -1679,7 +1717,7 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
|
||||
void* data = ImFileLoadToMemory(filename, "rb", &data_size, 0);
|
||||
if (!data)
|
||||
{
|
||||
IM_ASSERT(0); // Could not load file.
|
||||
IM_ASSERT_USER_ERROR(0, "Could not load font file!");
|
||||
return NULL;
|
||||
}
|
||||
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.74
|
||||
// dear imgui, v1.75 WIP
|
||||
// (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!
|
||||
@ -167,8 +167,9 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
||||
#endif
|
||||
|
||||
// "Paranoid" Debug Asserts are meant to only be enabled during specific debugging/work, otherwise would slow down the code too much.
|
||||
#define IMGUI_DEBUG_PARANOID 0
|
||||
#if IMGUI_DEBUG_PARANOID
|
||||
// We currently don't have many of those so the effect is currently negligible, but onward intent to add more aggressive ones in the code.
|
||||
//#define IMGUI_DEBUG_PARANOID
|
||||
#ifdef IMGUI_DEBUG_PARANOID
|
||||
#define IM_ASSERT_PARANOID(_EXPR) IM_ASSERT(_EXPR)
|
||||
#else
|
||||
#define IM_ASSERT_PARANOID(_EXPR)
|
||||
@ -177,7 +178,7 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
||||
// Error handling
|
||||
// Down the line in some frameworks/languages we would like to have a way to redirect those to the programmer and recover from more faults.
|
||||
#ifndef IM_ASSERT_USER_ERROR
|
||||
#define IM_ASSERT_USER_ERROR(_EXP,_MSG) IM_ASSERT((_EXP) && (_MSG)) // Recoverable User Error
|
||||
#define IM_ASSERT_USER_ERROR(_EXP,_MSG) IM_ASSERT((_EXP) && _MSG) // Recoverable User Error
|
||||
#endif
|
||||
|
||||
// Misc Macros
|
||||
@ -655,7 +656,7 @@ struct IMGUI_API ImRect
|
||||
ImVec2 Min; // Upper-left
|
||||
ImVec2 Max; // Lower-right
|
||||
|
||||
ImRect() : Min(FLT_MAX,FLT_MAX), Max(-FLT_MAX,-FLT_MAX) {}
|
||||
ImRect() : Min(0.0f, 0.0f), Max(0.0f, 0.0f) {}
|
||||
ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {}
|
||||
ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {}
|
||||
ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {}
|
||||
@ -864,7 +865,7 @@ struct IMGUI_API ImDrawListSharedData
|
||||
ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas
|
||||
ImFont* Font; // Current/default font (optional, for simplified AddText overload)
|
||||
float FontSize; // Current/default font size (optional, for simplified AddText overload)
|
||||
float CurveTessellationTol;
|
||||
float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo()
|
||||
ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
|
||||
ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
|
||||
|
||||
@ -1703,7 +1704,7 @@ enum ImGuiTabBarFlagsPrivate_
|
||||
// Extend ImGuiTabItemFlags_
|
||||
enum ImGuiTabItemFlagsPrivate_
|
||||
{
|
||||
ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Store whether p_open is set or not, which we need to recompute ContentWidth during layout.
|
||||
ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout)
|
||||
ImGuiTabItemFlags_Unsorted = 1 << 21, // [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window.
|
||||
ImGuiTabItemFlags_Preview = 1 << 22 // [Docking] Display tab shape for docking preview (height is adjusted slightly to compensate for the yet missing tab bar)
|
||||
};
|
||||
@ -1893,7 +1894,7 @@ namespace ImGui
|
||||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
||||
inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }
|
||||
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsingKeyInputMask & ((ImU64)1 << key)) != 0; }
|
||||
IMGUI_API bool IsMouseDragPastThreshold(int button, float lock_threshold = -1.0f);
|
||||
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { ImGuiContext& g = *GImGui; const int key_index = g.IO.KeyMap[key]; return (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; }
|
||||
inline bool IsNavInputDown(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; }
|
||||
inline bool IsNavInputTest(ImGuiNavInput n, ImGuiInputReadMode rm) { return (GetNavInputAmount(n, rm) > 0.0f); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.74
|
||||
// dear imgui, v1.75 WIP
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@ -6981,6 +6981,12 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store into ImGuiTabItemFlags_NoCloseButton, also honor ImGuiTabItemFlags_NoCloseButton passed by user (although not documented)
|
||||
if (flags & ImGuiTabItemFlags_NoCloseButton)
|
||||
p_open = NULL;
|
||||
else if (p_open == NULL)
|
||||
flags |= ImGuiTabItemFlags_NoCloseButton;
|
||||
|
||||
// Calculate tab contents size
|
||||
ImVec2 size = TabItemCalcSize(label, p_open != NULL);
|
||||
|
||||
@ -6998,9 +7004,6 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
tab_bar->LastTabItemIdx = (short)tab_bar->Tabs.index_from_ptr(tab);
|
||||
tab->ContentWidth = size.x;
|
||||
|
||||
if (p_open == NULL)
|
||||
flags |= ImGuiTabItemFlags_NoCloseButton;
|
||||
|
||||
const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
|
||||
const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0;
|
||||
const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);
|
||||
|
Loading…
Reference in New Issue
Block a user