mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt # examples/imgui_impl_opengl3.cpp # imgui.cpp
This commit is contained in:
commit
861f786d81
@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014-2019 Omar Cornut
|
Copyright (c) 2014-2020 Omar Cornut
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -30,7 +30,7 @@ HOW TO UPDATE?
|
|||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
DOCKING BRANCH (In Progress)
|
DOCKING+MULTI-VIEWPORT BRANCH (In Progress)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
DOCKING FEATURES
|
DOCKING FEATURES
|
||||||
@ -133,6 +133,10 @@ Breaking Changes:
|
|||||||
Other Changes:
|
Other Changes:
|
||||||
- Inputs: Added ImGuiMouseButton enum for convenience (e.g. ImGuiMouseButton_Right=1).
|
- 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.
|
We forever guarantee that the existing value will not changes so existing code is free to use 0/1/2.
|
||||||
|
- ColorEdit: Fix label alignment when using ImGuiColorEditFlags_NoInputs. (#2955) [@rokups]
|
||||||
|
- ColorEdit: In HSV display of a RGB stored value, attempt to locally preserve Saturation
|
||||||
|
when Value==0.0 (similar to changes done in 1.73 for Hue). Removed Hue editing lock since
|
||||||
|
those improvements in 1.73 makes them unnecessary. (#2722, #2770). [@rokups]
|
||||||
- Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups]
|
- 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.
|
- 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
|
In the current branch they are essentially the same as AddCircle(), AddCircleFilled() but as
|
||||||
@ -143,11 +147,11 @@ Other Changes:
|
|||||||
- Backends: SDL: Wayland: use SDL_GetMouseState (because there is no global mouse state available
|
- Backends: SDL: Wayland: use SDL_GetMouseState (because there is no global mouse state available
|
||||||
on Wayland). (#2800, #2802) [@NeroBurner]
|
on Wayland). (#2800, #2802) [@NeroBurner]
|
||||||
- Examples: Explicitly adding -DIMGUI_IMPL_OPENGL_LOADER_GL3W to Makefile to match linking
|
- 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
|
settings (otherwise if another loader such as Glew is accessible, the OpenGL3 backend might
|
||||||
automatically use it). [#2919, #2798]
|
automatically use it). (#2919, #2798)
|
||||||
- Examples: Metal: Wrapped main loop in @autoreleasepool block to ensure allocations get freed
|
- 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]
|
even if underlying system event loop gets paused due to app nap. (#2910, #2917) [@bear24rw]
|
||||||
>>>>>>> refs/heads/master
|
- Examples: Added support for glbindings OpenGL loader. (#2870) [@rokups]
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -232,7 +236,7 @@ Other Changes:
|
|||||||
- Nav, Scrolling: Added support for Home/End key. (#787)
|
- Nav, Scrolling: Added support for Home/End key. (#787)
|
||||||
- ColorEdit: Disable Hue edit when Saturation==0 instead of letting Hue values jump around.
|
- ColorEdit: Disable Hue edit when Saturation==0 instead of letting Hue values jump around.
|
||||||
- ColorEdit, ColorPicker: In HSV display of a RGB stored value, attempt to locally preserve Hue
|
- ColorEdit, ColorPicker: In HSV display of a RGB stored value, attempt to locally preserve Hue
|
||||||
when Saturation==0, which reduces accidentally lossy interactions. (#2722, 2770) [@rokups]
|
when Saturation==0, which reduces accidentally lossy interactions. (#2722, #2770) [@rokups]
|
||||||
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
|
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
|
||||||
Note that some elements won't accurately fade down with the same intensity, and the color wheel
|
Note that some elements won't accurately fade down with the same intensity, and the color wheel
|
||||||
when enabled will have small overlap glitches with (style.Alpha < 1.0).
|
when enabled will have small overlap glitches with (style.Alpha < 1.0).
|
||||||
|
20
docs/FAQ.md
20
docs/FAQ.md
@ -371,23 +371,23 @@ Finally, you may call ImGui::ShowMetricsWindow() to explore/visualize/understand
|
|||||||
|
|
||||||
### Q: How can I use my own math types instead of ImVec2/ImVec4?
|
### Q: How can I use my own math types instead of ImVec2/ImVec4?
|
||||||
|
|
||||||
You can edit [imconfig.h](https://github.com/ocornut/imgui/blob/master/imconfig.h) and setup the IM_VEC2_CLASS_EXTRA/IM_VEC4_CLASS_EXTRA macros to add implicit type conversions.
|
You can edit [imconfig.h](https://github.com/ocornut/imgui/blob/master/imconfig.h) and setup the `IM_VEC2_CLASS_EXTRA`/`IM_VEC4_CLASS_EXTRA` macros to add implicit type conversions.
|
||||||
This way you'll be able to use your own types everywhere, e.g. passing MyVector2 or glm::vec2 to ImGui functions instead of ImVec2.
|
This way you'll be able to use your own types everywhere, e.g. passing `MyVector2` or `glm::vec2` to ImGui functions instead of `ImVec2`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Q: How can I interact with standard C++ types (such as std::string and std::vector)?
|
### Q: How can I interact with standard C++ types (such as std::string and std::vector)?
|
||||||
- Being highly portable (bindings for several languages, frameworks, programming style, obscure or older platforms/compilers), and aiming for compatibility & performance suitable for every modern real-time game engines, dear imgui does not use any of std C++ types. We use raw types (e.g. char* instead of std::string) because they adapt to more use cases.
|
- Being highly portable (bindings for several languages, frameworks, programming style, obscure or older platforms/compilers), and aiming for compatibility & performance suitable for every modern real-time game engines, dear imgui does not use any of std C++ types. We use raw types (e.g. char* instead of std::string) because they adapt to more use cases.
|
||||||
- To use ImGui::InputText() with a std::string or any resizable string class, see [misc/cpp/imgui_stdlib.h](https://github.com/ocornut/imgui/blob/master/misc/cpp/imgui_stdlib.h).
|
- To use ImGui::InputText() with a std::string or any resizable string class, see [misc/cpp/imgui_stdlib.h](https://github.com/ocornut/imgui/blob/master/misc/cpp/imgui_stdlib.h).
|
||||||
- To use combo boxes and list boxes with std::vector or any other data structure: the BeginCombo()/EndCombo() API
|
- To use combo boxes and list boxes with `std::vector` or any other data structure: the `BeginCombo()/EndCombo()` API
|
||||||
lets you iterate and submit items yourself, so does the ListBoxHeader()/ListBoxFooter() API.
|
lets you iterate and submit items yourself, so does the `ListBoxHeader()/ListBoxFooter()` API.
|
||||||
Prefer using them over the old and awkward Combo()/ListBox() api.
|
Prefer using them over the old and awkward `Combo()/ListBox()` api.
|
||||||
- Generally for most high-level types you should be able to access the underlying data type.
|
- Generally for most high-level types you should be able to access the underlying data type.
|
||||||
You may write your own one-liner wrappers to facilitate user code (tip: add new functions in ImGui:: namespace from your code).
|
You may write your own one-liner wrappers to facilitate user code (tip: add new functions in ImGui:: namespace from your code).
|
||||||
- Dear ImGui applications often need to make intensive use of strings. It is expected that many of the strings you will pass
|
- Dear ImGui applications often need to make intensive use of strings. It is expected that many of the strings you will pass
|
||||||
to the API are raw literals (free in C/C++) or allocated in a manner that won't incur a large cost on your application.
|
to the API are raw literals (free in C/C++) or allocated in a manner that won't incur a large cost on your application.
|
||||||
Please bear in mind that using std::string on applications with large amount of UI may incur unsatisfactory performances.
|
Please bear in mind that using `std::string` on applications with large amount of UI may incur unsatisfactory performances.
|
||||||
Modern implementations of std::string often include small-string optimization (which is often a local buffer) but those
|
Modern implementations of `std::string` often include small-string optimization (which is often a local buffer) but those
|
||||||
are not configurable and not the same across implementations.
|
are not configurable and not the same across implementations.
|
||||||
- If you are finding your UI traversal cost to be too large, make sure your string usage is not leading to excessive amount
|
- If you are finding your UI traversal cost to be too large, make sure your string usage is not leading to excessive amount
|
||||||
of heap allocations. Consider using literals, statically sized buffers and your own helper functions. A common pattern
|
of heap allocations. Consider using literals, statically sized buffers and your own helper functions. A common pattern
|
||||||
@ -537,10 +537,10 @@ the default implementation of io.ImeSetInputScreenPosFn() to set your Microsoft
|
|||||||
# Q&A: Community
|
# Q&A: Community
|
||||||
|
|
||||||
### Q: How can I help?
|
### Q: How can I help?
|
||||||
|
- Businesses: please reach out to `contact AT dearimgui.org` if you work in a place using Dear ImGui! We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts. This is among the most useful thing you can do for Dear ImGui. With increased funding we can hire more people working on this project.
|
||||||
|
- Individuals: you can support continued maintenance and development via PayPal donations. See [README](https://github.com/ocornut/imgui/blob/master/docs/README.md).
|
||||||
- If you are experienced with Dear ImGui and C++, look at the [GitHub Issues](https://github.com/ocornut/imgui/issues), look at the [Wiki](https://github.com/ocornut/imgui/wiki), read [docs/TODO.txt](https://github.com/ocornut/imgui/blob/master/docs/TODO.txt) and see how you want to help and can help!
|
- If you are experienced with Dear ImGui and C++, look at the [GitHub Issues](https://github.com/ocornut/imgui/issues), look at the [Wiki](https://github.com/ocornut/imgui/wiki), read [docs/TODO.txt](https://github.com/ocornut/imgui/blob/master/docs/TODO.txt) and see how you want to help and can help!
|
||||||
- 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.
|
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
||||||
- 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. Disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions.
|
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.
|
- 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.
|
||||||
|
|
||||||
|
@ -3,16 +3,12 @@ dear imgui
|
|||||||
[![Build Status](https://github.com/ocornut/imgui/workflows/build/badge.svg)](https://github.com/ocornut/imgui/actions?workflow=build)
|
[![Build Status](https://github.com/ocornut/imgui/workflows/build/badge.svg)](https://github.com/ocornut/imgui/actions?workflow=build)
|
||||||
[![Coverity Status](https://scan.coverity.com/projects/4720/badge.svg)](https://scan.coverity.com/projects/4720)
|
[![Coverity Status](https://scan.coverity.com/projects/4720/badge.svg)](https://scan.coverity.com/projects/4720)
|
||||||
|
|
||||||
<sub>(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using dear imgui, please consider reaching out. If you are an individual using dear imgui, please consider supporting the project via Patreon or PayPal.)</sub>
|
<sub>(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using dear imgui, please consider reaching out.)</sub>
|
||||||
|
|
||||||
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
||||||
<br> _E-mail: contact @ dearimgui dot org_
|
<br> _E-mail: contact @ dearimgui dot org_
|
||||||
|
|
||||||
Individuals/hobbyists: support continued maintenance and development via the monthly Patreon:
|
Individuals: support continued maintenance and development via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S) donations.
|
||||||
<br> [![Patreon](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/patreon_02.png)](http://www.patreon.com/imgui)
|
|
||||||
|
|
||||||
Individuals/hobbyists: support continued maintenance and development via PayPal:
|
|
||||||
<br> [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S)
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -29,7 +25,7 @@ Dear ImGui is particularly suited to integration in games engine (for tooling),
|
|||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
**The core of Dear ImGui is self-contained within a few platform-agnostic files** which you can easily copy and compile into your application/engine. They are all the files in the root folder of the repository (imgui.cpp, imgui.h, imgui_demo.cpp, imgui_draw.cpp etc.).
|
**The core of Dear ImGui is self-contained within a few platform-agnostic files** which you can easily compile in your application/engine. They are all the files in the root folder of the repository (imgui.cpp, imgui.h, imgui_demo.cpp, imgui_draw.cpp etc.).
|
||||||
|
|
||||||
**No specific build process is required**. You can add the .cpp files to your existing project.
|
**No specific build process is required**. You can add the .cpp files to your existing project.
|
||||||
|
|
||||||
@ -48,7 +44,7 @@ ImGui::InputText("string", buf, IM_ARRAYSIZE(buf));
|
|||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
||||||
```
|
```
|
||||||
Result:
|
Result:
|
||||||
<br>![sample code output](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/code_sample_02.png)
|
<br>![sample code output (dark)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v175/capture_readme_styles_0001.png) ![sample code output (light)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v175/capture_readme_styles_0002.png)
|
||||||
<br>_(settings: Dark style (left), Light style (right) / Font: Roboto-Medium, 16px / Rounding: 5)_
|
<br>_(settings: Dark style (left), Light style (right) / Font: Roboto-Medium, 16px / Rounding: 5)_
|
||||||
|
|
||||||
Code:
|
Code:
|
||||||
@ -85,7 +81,7 @@ ImGui::End();
|
|||||||
Result:
|
Result:
|
||||||
<br>![sample code output](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/code_sample_03_color.gif)
|
<br>![sample code output](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/code_sample_03_color.gif)
|
||||||
|
|
||||||
Dear ImGui allows you **create elaborate tools** as well as very short-lived ones. On the extreme side of short-liveness: using the Edit&Continue (hot code reload) feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! Dear ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, an entire game making editor/framework, etc.
|
Dear ImGui allows you **create elaborate tools** as well as very short-lived ones. On the extreme side of short-livedness: using the Edit&Continue (hot code reload) feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! Dear ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, an entire game making editor/framework, etc.
|
||||||
|
|
||||||
### How it works
|
### How it works
|
||||||
|
|
||||||
@ -183,16 +179,12 @@ How to help
|
|||||||
|
|
||||||
**How can I help financing further development of Dear ImGui?**
|
**How can I help financing further development of Dear ImGui?**
|
||||||
|
|
||||||
Your contributions are keeping this project alive. The library is available under a free and permissive license, but continued maintenance and development are a full-time endeavor and I would like to grow the team. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using dear imgui, please consider reaching out for invoiced technical support and maintenance contracts. If you are an individual using dear imgui, please consider supporting the project via Patreon or PayPal. Thank you!
|
Your contributions are keeping this project alive. The library is available under a free and permissive license, but continued maintenance and development are a full-time endeavor and I would like to grow the team. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using dear imgui, please consider reaching out for invoiced technical support and maintenance contracts. Thank you!
|
||||||
|
|
||||||
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
||||||
<br> _E-mail: contact @ dearimgui dot org_
|
<br> _E-mail: contact @ dearimgui dot org_
|
||||||
|
|
||||||
Individuals/hobbyists: support continued maintenance and development via the monthly Patreon:
|
Individuals: support continued maintenance and development via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S) donations.
|
||||||
<br> [![Patreon](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/patreon_02.png)](http://www.patreon.com/imgui)
|
|
||||||
|
|
||||||
Individuals/hobbyists: support continued maintenance and development via PayPal:
|
|
||||||
<br> [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S)
|
|
||||||
|
|
||||||
### Sponsors
|
### Sponsors
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- window: investigate better auto-positioning for new windows.
|
- window: investigate better auto-positioning for new windows.
|
||||||
- window: top most window flag? (#2574)
|
- window: top most window flag? (#2574)
|
||||||
- window: the size_on_first_use path of Begin() can probably be removed
|
- window: the size_on_first_use path of Begin() can probably be removed
|
||||||
|
- window/size: manually triggered auto-fit (double-click on grip) shouldn't resize window down to viewport size?
|
||||||
- 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/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: 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.
|
- window/child: border could be emitted in parent as well.
|
||||||
@ -38,6 +39,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
! scrolling: exposing horizontal scrolling with Shift+Wheel even when scrollbar is disabled expose lots of issues (#2424, #1463)
|
! scrolling: exposing horizontal scrolling with Shift+Wheel even when scrollbar is disabled expose lots of issues (#2424, #1463)
|
||||||
- scrolling: while holding down a scrollbar, try to keep the same contents visible (at least while not moving mouse)
|
- scrolling: while holding down a scrollbar, try to keep the same contents visible (at least while not moving mouse)
|
||||||
- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
|
- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
|
||||||
|
- scrolling: forward mouse wheel scrolling to parent window when at the edge of scrolling limits? (useful for listbox,tables?)
|
||||||
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
|
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
|
||||||
- scrolling/style: shadows on scrollable areas to denote that there is more contents
|
- scrolling/style: shadows on scrollable areas to denote that there is more contents
|
||||||
|
|
||||||
@ -187,6 +189,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
|
|
||||||
- tabs: make EndTabBar fail if users doesn't respect BeginTabBar return value, for consistency/future-proofing.
|
- tabs: make EndTabBar fail if users doesn't respect BeginTabBar return value, for consistency/future-proofing.
|
||||||
- tabs: persistent order/focus in BeginTabBar() api (#261, #351)
|
- tabs: persistent order/focus in BeginTabBar() api (#261, #351)
|
||||||
|
- tabs: TabItem could honor SetNextItemWidth()?
|
||||||
|
|
||||||
- image/image button: misalignment on padded/bordered button?
|
- image/image button: misalignment on padded/bordered button?
|
||||||
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
||||||
@ -391,6 +394,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- 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.
|
- 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.
|
||||||
- misc: idle: if cursor blink if the _only_ visible animation, core imgui could rewrite vertex alpha to avoid CPU pass on ImGui:: calls.
|
- misc: idle: if cursor blink if the _only_ visible animation, core imgui could rewrite vertex alpha to avoid CPU pass on ImGui:: calls.
|
||||||
- misc: idle: if cursor blink if the _only_ visible animation, could even expose a dirty rectangle that optionally can be leverage by some app to render in a smaller viewport, getting rid of much pixel shading cost.
|
- misc: idle: if cursor blink if the _only_ visible animation, could even expose a dirty rectangle that optionally can be leverage by some app to render in a smaller viewport, getting rid of much pixel shading cost.
|
||||||
|
- misc: no way to run a root-most GetID() with ImGui:: api since there's always a Debug window in the stack. (mentioned in #2960)
|
||||||
- misc: make the ImGuiCond values linear (non-power-of-two). internal storage for ImGuiWindow can use integers to combine into flags (Why?)
|
- misc: make the ImGuiCond values linear (non-power-of-two). internal storage for ImGuiWindow can use integers to combine into flags (Why?)
|
||||||
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
||||||
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
||||||
|
@ -205,7 +205,7 @@ example_glfw_opengl2/
|
|||||||
GLFW + OpenGL2 example (legacy, fixed pipeline).
|
GLFW + OpenGL2 example (legacy, fixed pipeline).
|
||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
||||||
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
**Prefer using OPENGL3 code (with gl3w/glew/glad/glbindings, you can replace the OpenGL function loader)**
|
||||||
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
||||||
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
||||||
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
||||||
@ -250,7 +250,7 @@ example_sdl_opengl2/
|
|||||||
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
|
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
|
||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
||||||
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||||
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
**Prefer using OPENGL3 code (with gl3w/glew/glad/glbindings, you can replace the OpenGL function loader)**
|
||||||
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
||||||
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
||||||
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
||||||
|
@ -41,6 +41,10 @@ CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
|||||||
# SOURCES += ../libs/glad/src/glad.c
|
# SOURCES += ../libs/glad/src/glad.c
|
||||||
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
|
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
|
|
||||||
|
## Using OpenGL loader: glbinding
|
||||||
|
## (This assumes a system-wide installation)
|
||||||
|
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING
|
||||||
|
|
||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
## BUILD FLAGS PER PLATFORM
|
## BUILD FLAGS PER PLATFORM
|
||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
#include <GL/glew.h> // Initialize with glewInit()
|
#include <GL/glew.h> // Initialize with glewInit()
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
#include <glad/glad.h> // Initialize with gladLoadGL()
|
#include <glad/glad.h> // Initialize with gladLoadGL()
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING)
|
||||||
|
#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
|
||||||
|
#include <glbinding/glbinding.h> // Initialize with glbinding::initialize()
|
||||||
|
#include <glbinding/gl/gl.h>
|
||||||
|
using namespace gl;
|
||||||
#else
|
#else
|
||||||
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
#endif
|
#endif
|
||||||
@ -74,6 +79,9 @@ int main(int, char**)
|
|||||||
bool err = glewInit() != GLEW_OK;
|
bool err = glewInit() != GLEW_OK;
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
bool err = gladLoadGL() == 0;
|
bool err = gladLoadGL() == 0;
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING)
|
||||||
|
bool err = false;
|
||||||
|
glbinding::initialize([](const char* name) { return (glbinding::ProcAddress)glfwGetProcAddress(name); });
|
||||||
#else
|
#else
|
||||||
bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
|
bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,6 +41,10 @@ CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
|||||||
# SOURCES += ../libs/glad/src/glad.c
|
# SOURCES += ../libs/glad/src/glad.c
|
||||||
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
|
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
|
|
||||||
|
## Using OpenGL loader: glbinding
|
||||||
|
## (This assumes a system-wide installation)
|
||||||
|
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING
|
||||||
|
|
||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
## BUILD FLAGS PER PLATFORM
|
## BUILD FLAGS PER PLATFORM
|
||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
#include <GL/glew.h> // Initialize with glewInit()
|
#include <GL/glew.h> // Initialize with glewInit()
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
#include <glad/glad.h> // Initialize with gladLoadGL()
|
#include <glad/glad.h> // Initialize with gladLoadGL()
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING)
|
||||||
|
#include <glbinding/glbinding.h> // Initialize with glbinding::initialize()
|
||||||
|
#include <glbinding/gl/gl.h>
|
||||||
|
using namespace gl;
|
||||||
#else
|
#else
|
||||||
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
#endif
|
#endif
|
||||||
@ -69,6 +73,9 @@ int main(int, char**)
|
|||||||
bool err = glewInit() != GLEW_OK;
|
bool err = glewInit() != GLEW_OK;
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
bool err = gladLoadGL() == 0;
|
bool err = gladLoadGL() == 0;
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING)
|
||||||
|
bool err = false;
|
||||||
|
glbinding::initialize([](const char* name) { return (glbinding::ProcAddress)SDL_GL_GetProcAddress(name); });
|
||||||
#else
|
#else
|
||||||
bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
|
bool err = false; // If you use IMGUI_IMPL_OPENGL_LOADER_CUSTOM, your loader is likely to requires some form of initialization.
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
// 2019-07-21: DirectX10: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData().
|
// 2019-07-21: DirectX10: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData().
|
||||||
// 2019-05-29: DirectX10: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
// 2019-05-29: DirectX10: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
// 2019-04-30: DirectX10: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: DirectX10: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
// 2019-08-01: DirectX11: Fixed code querying the Geometry Shader state (would generally error with Debug layer enabled).
|
// 2019-08-01: DirectX11: Fixed code querying the Geometry Shader state (would generally error with Debug layer enabled).
|
||||||
// 2019-07-21: DirectX11: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData. Clearing Hull/Domain/Compute shaders without backup/restore.
|
// 2019-07-21: DirectX11: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData. Clearing Hull/Domain/Compute shaders without backup/restore.
|
||||||
// 2019-05-29: DirectX11: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
// 2019-05-29: DirectX11: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
// 2019-10-18: DirectX12: *BREAKING CHANGE* Added extra ID3D12DescriptorHeap parameter to ImGui_ImplDX12_Init() function.
|
// 2019-10-18: DirectX12: *BREAKING CHANGE* Added extra ID3D12DescriptorHeap parameter to ImGui_ImplDX12_Init() function.
|
||||||
// 2019-05-29: DirectX12: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
// 2019-05-29: DirectX12: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
// 2019-04-30: DirectX12: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: DirectX12: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
// 2019-05-29: DirectX9: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
// 2019-05-29: DirectX9: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
// 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
// 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects().
|
// 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects().
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-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-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-10-18: Misc: Previously installed user callbacks are now restored on shutdown.
|
||||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2020-01-07: OpenGL: Added support for glbindings OpenGL loader.
|
||||||
// 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders.
|
// 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders.
|
||||||
// 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility.
|
// 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility.
|
||||||
// 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call.
|
// 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call.
|
||||||
@ -87,12 +88,14 @@
|
|||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GL3W
|
#undef IMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLEW
|
#undef IMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLAD
|
#undef IMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
|
#undef IMGUI_IMPL_OPENGL_LOADER_GLBINDING
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
#undef IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
#elif defined(__EMSCRIPTEN__)
|
#elif defined(__EMSCRIPTEN__)
|
||||||
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GL3W
|
#undef IMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLEW
|
#undef IMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLAD
|
#undef IMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
|
#undef IMGUI_IMPL_OPENGL_LOADER_GLBINDING
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
#undef IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -117,6 +120,10 @@
|
|||||||
#include <GL/glew.h> // Needs to be initialized with glewInit() in user's code
|
#include <GL/glew.h> // Needs to be initialized with glewInit() in user's code
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
#include <glad/glad.h> // Needs to be initialized with gladLoadGL() in user's code
|
#include <glad/glad.h> // Needs to be initialized with gladLoadGL() in user's code
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING)
|
||||||
|
#include <glbinding/gl/gl.h> // Initialize with glbinding::initialize()
|
||||||
|
#include <glbinding/glbinding.h>
|
||||||
|
using namespace gl;
|
||||||
#else
|
#else
|
||||||
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
#include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
#endif
|
#endif
|
||||||
@ -164,7 +171,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
|||||||
#endif
|
#endif
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||||
|
|
||||||
// Store GLSL version string so we can refer to it later in case we recreate shaders.
|
// Store GLSL version string so we can refer to it later in case we recreate shaders.
|
||||||
// Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
// Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
||||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
if (glsl_version == NULL)
|
if (glsl_version == NULL)
|
||||||
@ -193,6 +200,8 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
|||||||
gl_loader = "GLEW";
|
gl_loader = "GLEW";
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||||
gl_loader = "GLAD";
|
gl_loader = "GLAD";
|
||||||
|
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING)
|
||||||
|
gl_loader = "glbinding";
|
||||||
#else // IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
#else // IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||||
gl_loader = "Custom";
|
gl_loader = "Custom";
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,6 +47,7 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
|||||||
#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
||||||
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||||
#if defined(__has_include)
|
#if defined(__has_include)
|
||||||
#if __has_include(<GL/glew.h>)
|
#if __has_include(<GL/glew.h>)
|
||||||
@ -55,6 +56,8 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
|||||||
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
|
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
#elif __has_include(<GL/gl3w.h>)
|
#elif __has_include(<GL/gl3w.h>)
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||||
|
#elif __has_include(<glbinding/gl/gl.h>)
|
||||||
|
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING
|
||||||
#else
|
#else
|
||||||
#error "Cannot detect OpenGL loader!"
|
#error "Cannot detect OpenGL loader!"
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
// 2019-12-17: Inputs: On Wayland, use SDL_GetMouseState (because there is no global mouse state).
|
// 2019-12-17: Inputs: On Wayland, use SDL_GetMouseState (because there is no global mouse state).
|
||||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
// 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-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: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.
|
||||||
|
50
imgui.cpp
50
imgui.cpp
@ -11,8 +11,8 @@
|
|||||||
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
|
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
|
||||||
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
||||||
// This library is free but I need your support to sustain development and maintenance.
|
// This library is free but I need your support to sustain development and maintenance.
|
||||||
// Businesses: you can support continued maintenance and development via support contracts or sponsoring, see docs/README.
|
// Businesses: you can support continued development via invoiced technical support, maintenance and sponsoring contracts. Please reach out to "contact AT dearimgui.org".
|
||||||
// Individuals: you can support continued maintenance and development via donations or Patreon https://www.patreon.com/imgui.
|
// Individuals: you can support continued development via donations. See docs/README or web page.
|
||||||
|
|
||||||
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
||||||
// Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without
|
// Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without
|
||||||
@ -507,7 +507,7 @@ CODE
|
|||||||
- 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
|
- 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
|
||||||
- 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore.
|
- 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore.
|
||||||
If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you, otherwise if <1.0f you need tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.
|
If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you, otherwise if <1.0f you need tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.
|
||||||
This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color:
|
This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color:
|
||||||
ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col) { float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a; return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a); }
|
ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col) { float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a; return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a); }
|
||||||
If this is confusing, pick the RGB value from title bar from an old screenshot and apply this as TitleBg/TitleBgActive. Or you may just create TitleBgActive from a tweaked TitleBg color.
|
If this is confusing, pick the RGB value from title bar from an old screenshot and apply this as TitleBg/TitleBgActive. Or you may just create TitleBgActive from a tweaked TitleBg color.
|
||||||
- 2016/05/07 (1.49) - removed confusing set of GetInternalState(), GetInternalStateSize(), SetInternalState() functions. Now using CreateContext(), DestroyContext(), GetCurrentContext(), SetCurrentContext().
|
- 2016/05/07 (1.49) - removed confusing set of GetInternalState(), GetInternalStateSize(), SetInternalState() functions. Now using CreateContext(), DestroyContext(), GetCurrentContext(), SetCurrentContext().
|
||||||
@ -787,11 +787,13 @@ CODE
|
|||||||
==============
|
==============
|
||||||
|
|
||||||
Q: How can I help?
|
Q: How can I help?
|
||||||
A: - If you are experienced with Dear ImGui and C++, look at the github issues, look at the Wiki, read docs/TODO.txt
|
A: - Businesses: please reach out to "contact AT dearimgui.org" if you work in a place using Dear ImGui!
|
||||||
|
We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts.
|
||||||
|
This is among the most useful thing you can do for Dear ImGui. With increased funding we can hire more people working on this project.
|
||||||
|
- Individuals: you can support continued development via PayPal donations. See README.
|
||||||
|
- If you are experienced with Dear ImGui and C++, look at the github issues, look at the Wiki, read docs/TODO.txt
|
||||||
and see how you want to help and can help!
|
and see how you want to help and can help!
|
||||||
- Businesses: convince your company to fund development via support contracts/sponsoring! This is among the most useful thing you can do for dear imgui.
|
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
||||||
- 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 (github.com/ocornut/imgui/issues/2847). Visuals are ideal as they inspire other programmers.
|
You may post screenshot or links in the gallery threads (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.
|
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 (on github or privately).
|
- 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 (on github or privately).
|
||||||
@ -1390,8 +1392,8 @@ const char* ImStrSkipBlank(const char* str)
|
|||||||
#ifndef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
#ifndef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
||||||
|
|
||||||
// We support stb_sprintf which is much faster (see: https://github.com/nothings/stb/blob/master/stb_sprintf.h)
|
// We support stb_sprintf which is much faster (see: https://github.com/nothings/stb/blob/master/stb_sprintf.h)
|
||||||
// You may set IMGUI_USE_STB_SPRINTF to use our default wrapper, or set IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
// You may set IMGUI_USE_STB_SPRINTF to use our default wrapper, or set IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
||||||
// and setup the wrapper yourself. (FIXME-OPT: Some of our high-level operations such as ImGuiTextBuffer::appendfv() are
|
// and setup the wrapper yourself. (FIXME-OPT: Some of our high-level operations such as ImGuiTextBuffer::appendfv() are
|
||||||
// designed using two-passes worst case, which probably could be improved using the stbsp_vsprintfcb() function.)
|
// designed using two-passes worst case, which probably could be improved using the stbsp_vsprintfcb() function.)
|
||||||
//#define IMGUI_USE_STB_SPRINTF
|
//#define IMGUI_USE_STB_SPRINTF
|
||||||
#ifdef IMGUI_USE_STB_SPRINTF
|
#ifdef IMGUI_USE_STB_SPRINTF
|
||||||
@ -1516,7 +1518,7 @@ ImU32 ImHashStr(const char* data_p, size_t data_size, ImU32 seed)
|
|||||||
ImFileHandle ImFileOpen(const char* filename, const char* mode)
|
ImFileHandle ImFileOpen(const char* filename, const char* mode)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(__CYGWIN__) && !defined(__GNUC__)
|
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(__CYGWIN__) && !defined(__GNUC__)
|
||||||
// We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames.
|
// We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames.
|
||||||
const int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1;
|
const int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1;
|
||||||
const int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1;
|
const int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1;
|
||||||
ImVector<ImWchar> buf;
|
ImVector<ImWchar> buf;
|
||||||
@ -4104,7 +4106,7 @@ void ImGui::Initialize(ImGuiContext* context)
|
|||||||
ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;
|
ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll;
|
||||||
g.SettingsHandlers.push_back(ini_handler);
|
g.SettingsHandlers.push_back(ini_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IMGUI_HAS_TABLE
|
#ifdef IMGUI_HAS_TABLE
|
||||||
// Add .ini handle for ImGuiTable type
|
// Add .ini handle for ImGuiTable type
|
||||||
{
|
{
|
||||||
@ -15097,6 +15099,19 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void NodeWindows(ImVector<ImGuiWindow*>& windows, const char* label)
|
||||||
|
{
|
||||||
|
if (!ImGui::TreeNode(label, "%s (%d)", label, windows.Size))
|
||||||
|
return;
|
||||||
|
for (int i = 0; i < windows.Size; i++)
|
||||||
|
{
|
||||||
|
ImGui::PushID(windows[i]);
|
||||||
|
Funcs::NodeWindow(windows[i], "Window");
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
static void NodeWindow(ImGuiWindow* window, const char* label)
|
static void NodeWindow(ImGuiWindow* window, const char* label)
|
||||||
{
|
{
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
@ -15104,7 +15119,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGui::BulletText("%s: NULL", label);
|
ImGui::BulletText("%s: NULL", label);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool open = ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, (window->Active || window->WasActive), window);
|
bool open = ImGui::TreeNode(label, "%s '%s', %d @ 0x%p", label, window->Name, (window->Active || window->WasActive), window);
|
||||||
if (ImGui::IsItemHovered() && window->WasActive)
|
if (ImGui::IsItemHovered() && window->WasActive)
|
||||||
ImGui::GetForegroundDrawList()->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));
|
ImGui::GetForegroundDrawList()->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));
|
||||||
if (!open)
|
if (!open)
|
||||||
@ -15145,15 +15160,6 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NodeWindows(ImVector<ImGuiWindow*>& windows, const char* label)
|
|
||||||
{
|
|
||||||
if (!ImGui::TreeNode(label, "%s (%d)", label, windows.Size))
|
|
||||||
return;
|
|
||||||
for (int i = 0; i < windows.Size; i++)
|
|
||||||
Funcs::NodeWindow(windows[i], "Window");
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void NodeViewport(ImGuiViewportP* viewport)
|
static void NodeViewport(ImGuiViewportP* viewport)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||||
@ -15365,7 +15371,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
#endif // #define IMGUI_HAS_DOCK
|
#endif // #define IMGUI_HAS_DOCK
|
||||||
|
|
||||||
// Misc Details
|
// Misc Details
|
||||||
if (ImGui::TreeNode("Internal state"))
|
if (ImGui::TreeNode("Internal state"))
|
||||||
{
|
{
|
||||||
|
16
imgui.h
16
imgui.h
@ -480,7 +480,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, float power = 1.0f);
|
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, float power = 1.0f);
|
||||||
|
|
||||||
// Widgets: Input with Keyboard
|
// Widgets: Input with Keyboard
|
||||||
// - If you want to use InputText() with a dynamic string type such as std::string or your own, see misc/cpp/imgui_stdlib.h
|
// - If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp.
|
||||||
// - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.
|
// - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.
|
||||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
@ -707,7 +707,7 @@ namespace ImGui
|
|||||||
// - For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].
|
// - 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.
|
// - 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 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].
|
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 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 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 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
|
||||||
@ -1252,7 +1252,7 @@ enum ImGuiColorEditFlags_
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Identify a mouse button.
|
// Identify a mouse button.
|
||||||
// Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience.
|
// Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience.
|
||||||
enum ImGuiMouseButton_
|
enum ImGuiMouseButton_
|
||||||
{
|
{
|
||||||
@ -1284,7 +1284,7 @@ enum ImGuiMouseCursor_
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enumateration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions
|
// Enumeration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions
|
||||||
// Represent a condition.
|
// Represent a condition.
|
||||||
// Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always.
|
// Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always.
|
||||||
enum ImGuiCond_
|
enum ImGuiCond_
|
||||||
@ -1824,9 +1824,13 @@ struct ImGuiStorage
|
|||||||
// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop.
|
// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop.
|
||||||
struct ImGuiListClipper
|
struct ImGuiListClipper
|
||||||
{
|
{
|
||||||
float StartPosY;
|
int DisplayStart, DisplayEnd;
|
||||||
|
int ItemsCount;
|
||||||
|
|
||||||
|
// [Internal]
|
||||||
|
int StepNo;
|
||||||
float ItemsHeight;
|
float ItemsHeight;
|
||||||
int ItemsCount, StepNo, DisplayStart, DisplayEnd;
|
float StartPosY;
|
||||||
|
|
||||||
// items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step).
|
// items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step).
|
||||||
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
|
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
|
||||||
|
@ -569,6 +569,8 @@ static void ShowDemoWindowWidgets()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// To wire InputText() with std::string or any other custom string type,
|
||||||
|
// see the "Text Input > Resize Callback" section of this demo, and the misc/cpp/imgui_stdlib.h file.
|
||||||
static char str0[128] = "Hello, world!";
|
static char str0[128] = "Hello, world!";
|
||||||
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
||||||
ImGui::SameLine(); HelpMarker("USER:\nHold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example (this is not demonstrated in imgui_demo.cpp).");
|
ImGui::SameLine(); HelpMarker("USER:\nHold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example (this is not demonstrated in imgui_demo.cpp).");
|
||||||
@ -1044,6 +1046,8 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To wire InputText() with std::string or any other custom string type,
|
||||||
|
// see the "Text Input > Resize Callback" section of this demo, and the misc/cpp/imgui_stdlib.h file.
|
||||||
if (ImGui::TreeNode("Text Input"))
|
if (ImGui::TreeNode("Text Input"))
|
||||||
{
|
{
|
||||||
if (ImGui::TreeNode("Multi-line Text Input"))
|
if (ImGui::TreeNode("Multi-line Text Input"))
|
||||||
@ -1063,7 +1067,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
"\tlock cmpxchg8b eax\n";
|
"\tlock cmpxchg8b eax\n";
|
||||||
|
|
||||||
static ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput;
|
static ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput;
|
||||||
HelpMarker("You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example. (This is not demonstrated in imgui_demo.cpp)");
|
HelpMarker("You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example. (This is not demonstrated in imgui_demo.cpp because we don't want to include <string> in here)");
|
||||||
ImGui::CheckboxFlags("ImGuiInputTextFlags_ReadOnly", (unsigned int*)&flags, ImGuiInputTextFlags_ReadOnly);
|
ImGui::CheckboxFlags("ImGuiInputTextFlags_ReadOnly", (unsigned int*)&flags, ImGuiInputTextFlags_ReadOnly);
|
||||||
ImGui::CheckboxFlags("ImGuiInputTextFlags_AllowTabInput", (unsigned int*)&flags, ImGuiInputTextFlags_AllowTabInput);
|
ImGui::CheckboxFlags("ImGuiInputTextFlags_AllowTabInput", (unsigned int*)&flags, ImGuiInputTextFlags_AllowTabInput);
|
||||||
ImGui::CheckboxFlags("ImGuiInputTextFlags_CtrlEnterForNewLine", (unsigned int*)&flags, ImGuiInputTextFlags_CtrlEnterForNewLine);
|
ImGui::CheckboxFlags("ImGuiInputTextFlags_CtrlEnterForNewLine", (unsigned int*)&flags, ImGuiInputTextFlags_CtrlEnterForNewLine);
|
||||||
@ -1092,8 +1096,9 @@ static void ShowDemoWindowWidgets()
|
|||||||
|
|
||||||
if (ImGui::TreeNode("Resize Callback"))
|
if (ImGui::TreeNode("Resize Callback"))
|
||||||
{
|
{
|
||||||
// If you have a custom string type you would typically create a ImGui::InputText() wrapper than takes your type as input.
|
// To wire InputText() with std::string or any other custom string type,
|
||||||
// See misc/cpp/imgui_stdlib.h and .cpp for an implementation of this using std::string.
|
// you can use the ImGuiInputTextFlags_CallbackResize flag + create a custom ImGui::InputText() wrapper using your prefered type.
|
||||||
|
// See misc/cpp/imgui_stdlib.h for an implementation of this using std::string.
|
||||||
HelpMarker("Demonstrate using ImGuiInputTextFlags_CallbackResize to wire your resizable string type to InputText().\n\nSee misc/cpp/imgui_stdlib.h for an implementation of this for std::string.");
|
HelpMarker("Demonstrate using ImGuiInputTextFlags_CallbackResize to wire your resizable string type to InputText().\n\nSee misc/cpp/imgui_stdlib.h for an implementation of this for std::string.");
|
||||||
struct Funcs
|
struct Funcs
|
||||||
{
|
{
|
||||||
|
@ -523,7 +523,7 @@ void ImDrawList::PopTextureID()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reserve space for a number of vertices and indices.
|
// 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
|
// 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.
|
// submit the intermediate results. PrimUnreserve() can be used to release unused allocations.
|
||||||
void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,7 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
|||||||
#ifdef IMGUI_DEBUG_PARANOID
|
#ifdef IMGUI_DEBUG_PARANOID
|
||||||
#define IM_ASSERT_PARANOID(_EXPR) IM_ASSERT(_EXPR)
|
#define IM_ASSERT_PARANOID(_EXPR) IM_ASSERT(_EXPR)
|
||||||
#else
|
#else
|
||||||
#define IM_ASSERT_PARANOID(_EXPR)
|
#define IM_ASSERT_PARANOID(_EXPR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Error handling
|
// Error handling
|
||||||
@ -429,20 +429,22 @@ enum ImGuiButtonFlags_
|
|||||||
{
|
{
|
||||||
ImGuiButtonFlags_None = 0,
|
ImGuiButtonFlags_None = 0,
|
||||||
ImGuiButtonFlags_Repeat = 1 << 0, // hold to repeat
|
ImGuiButtonFlags_Repeat = 1 << 0, // hold to repeat
|
||||||
ImGuiButtonFlags_PressedOnClickRelease = 1 << 1, // [Default] return true on click + release on same item
|
ImGuiButtonFlags_PressedOnClick = 1 << 1, // return true on click (mouse down event)
|
||||||
ImGuiButtonFlags_PressedOnClick = 1 << 2, // return true on click (default requires click+release)
|
ImGuiButtonFlags_PressedOnClickRelease = 1 << 2, // [Default] return true on click + release on same item <-- this is what the majority of Button are using
|
||||||
ImGuiButtonFlags_PressedOnRelease = 1 << 3, // return true on release (default requires click+release)
|
ImGuiButtonFlags_PressedOnClickReleaseAnywhere = 1 << 3, // return true on click + release even if the release event is not done while hovering the item
|
||||||
ImGuiButtonFlags_PressedOnDoubleClick = 1 << 4, // return true on double-click (default requires click+release)
|
ImGuiButtonFlags_PressedOnRelease = 1 << 4, // return true on release (default requires click+release)
|
||||||
ImGuiButtonFlags_FlattenChildren = 1 << 5, // allow interactions even if a child window is overlapping
|
ImGuiButtonFlags_PressedOnDoubleClick = 1 << 5, // return true on double-click (default requires click+release)
|
||||||
ImGuiButtonFlags_AllowItemOverlap = 1 << 6, // require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap()
|
ImGuiButtonFlags_PressedOnDragDropHold = 1 << 6, // return true when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
|
||||||
ImGuiButtonFlags_DontClosePopups = 1 << 7, // disable automatically closing parent popup on press // [UNUSED]
|
ImGuiButtonFlags_FlattenChildren = 1 << 7, // allow interactions even if a child window is overlapping
|
||||||
ImGuiButtonFlags_Disabled = 1 << 8, // disable interactions
|
ImGuiButtonFlags_AllowItemOverlap = 1 << 8, // require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap()
|
||||||
ImGuiButtonFlags_AlignTextBaseLine = 1 << 9, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
ImGuiButtonFlags_DontClosePopups = 1 << 9, // disable automatically closing parent popup on press // [UNUSED]
|
||||||
ImGuiButtonFlags_NoKeyModifiers = 1 << 10, // disable mouse interaction if a key modifier is held
|
ImGuiButtonFlags_Disabled = 1 << 10, // disable interactions
|
||||||
ImGuiButtonFlags_NoHoldingActiveID = 1 << 11, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
ImGuiButtonFlags_AlignTextBaseLine = 1 << 11, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
||||||
ImGuiButtonFlags_PressedOnDragDropHold = 1 << 12, // press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
|
ImGuiButtonFlags_NoKeyModifiers = 1 << 12, // disable mouse interaction if a key modifier is held
|
||||||
ImGuiButtonFlags_NoNavFocus = 1 << 13, // don't override navigation focus when activated
|
ImGuiButtonFlags_NoHoldingActiveID = 1 << 13, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
||||||
ImGuiButtonFlags_NoHoveredOnNav = 1 << 14 // don't report as hovered when navigated on
|
ImGuiButtonFlags_NoNavFocus = 1 << 14, // don't override navigation focus when activated
|
||||||
|
ImGuiButtonFlags_NoHoveredOnNav = 1 << 15, // don't report as hovered when navigated on
|
||||||
|
ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiSliderFlags_
|
enum ImGuiSliderFlags_
|
||||||
@ -517,7 +519,7 @@ enum ImGuiItemStatusFlags_
|
|||||||
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1,
|
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1,
|
||||||
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
||||||
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
|
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
|
||||||
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
||||||
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
||||||
ImGuiItemStatusFlags_Deactivated = 1 << 6 // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
ImGuiItemStatusFlags_Deactivated = 1 << 6 // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
||||||
|
|
||||||
@ -1275,6 +1277,7 @@ struct ImGuiContext
|
|||||||
ImGuiID TempInputTextId; // Temporary text input when CTRL+clicking on a slider, etc.
|
ImGuiID TempInputTextId; // Temporary text input when CTRL+clicking on a slider, etc.
|
||||||
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
||||||
float ColorEditLastHue; // Backup of last Hue associated to LastColor[3], so we can restore Hue in lossy RGB<>HSV round trips
|
float ColorEditLastHue; // Backup of last Hue associated to LastColor[3], so we can restore Hue in lossy RGB<>HSV round trips
|
||||||
|
float ColorEditLastSat; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
|
||||||
float ColorEditLastColor[3];
|
float ColorEditLastColor[3];
|
||||||
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
||||||
bool DragCurrentAccumDirty;
|
bool DragCurrentAccumDirty;
|
||||||
@ -1430,7 +1433,7 @@ struct ImGuiContext
|
|||||||
LastValidMousePos = ImVec2(0.0f, 0.0f);
|
LastValidMousePos = ImVec2(0.0f, 0.0f);
|
||||||
TempInputTextId = 0;
|
TempInputTextId = 0;
|
||||||
ColorEditOptions = ImGuiColorEditFlags__OptionsDefault;
|
ColorEditOptions = ImGuiColorEditFlags__OptionsDefault;
|
||||||
ColorEditLastHue = 0.0f;
|
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
||||||
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
|
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
|
||||||
DragCurrentAccumDirty = false;
|
DragCurrentAccumDirty = false;
|
||||||
DragCurrentAccum = 0.0f;
|
DragCurrentAccum = 0.0f;
|
||||||
|
@ -462,7 +462,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Default behavior requires click+release on same spot
|
// Default behavior requires click+release on same spot
|
||||||
if ((flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick)) == 0)
|
if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0)
|
||||||
flags |= ImGuiButtonFlags_PressedOnClickRelease;
|
flags |= ImGuiButtonFlags_PressedOnClickRelease;
|
||||||
|
|
||||||
ImGuiWindow* backup_hovered_window = g.HoveredWindow;
|
ImGuiWindow* backup_hovered_window = g.HoveredWindow;
|
||||||
@ -507,7 +507,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
{
|
{
|
||||||
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
||||||
{
|
{
|
||||||
if ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0])
|
if ((flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere)) && g.IO.MouseClicked[0])
|
||||||
{
|
{
|
||||||
SetActiveID(id, window);
|
SetActiveID(id, window);
|
||||||
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
||||||
@ -577,7 +577,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease) && !g.DragDropActive)
|
const bool release_in = hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease) != 0;
|
||||||
|
const bool release_anywhere = (flags & ImGuiButtonFlags_PressedOnClickReleaseAnywhere) != 0;
|
||||||
|
if ((release_in || release_anywhere) && !g.DragDropActive)
|
||||||
{
|
{
|
||||||
bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDownWasDoubleClick[0];
|
bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDownWasDoubleClick[0];
|
||||||
bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay; // Repeat mode trumps <on release>
|
bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay; // Repeat mode trumps <on release>
|
||||||
@ -4232,8 +4234,13 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
{
|
{
|
||||||
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
||||||
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||||
if (f[1] == 0 && memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
|
if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
|
||||||
f[0] = g.ColorEditLastHue;
|
{
|
||||||
|
if (f[1] == 0)
|
||||||
|
f[0] = g.ColorEditLastHue;
|
||||||
|
if (f[2] == 0)
|
||||||
|
f[1] = g.ColorEditLastSat;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };
|
int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };
|
||||||
|
|
||||||
@ -4272,16 +4279,15 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
SameLine(0, style.ItemInnerSpacing.x);
|
SameLine(0, style.ItemInnerSpacing.x);
|
||||||
SetNextItemWidth((n + 1 < components) ? w_item_one : w_item_last);
|
SetNextItemWidth((n + 1 < components) ? w_item_one : w_item_last);
|
||||||
|
|
||||||
// Disable Hue edit when Saturation is zero
|
// FIXME: When ImGuiColorEditFlags_HDR flag is passed HS values snap in weird ways when SV values go below 0.
|
||||||
const bool disable_hue_edit = (n == 0 && (flags & ImGuiColorEditFlags_DisplayHSV) && i[1] == 0);
|
|
||||||
if (flags & ImGuiColorEditFlags_Float)
|
if (flags & ImGuiColorEditFlags_Float)
|
||||||
{
|
{
|
||||||
value_changed |= DragFloat(ids[n], &f[n], 1.0f/255.0f, disable_hue_edit ? +FLT_MAX : 0.0f, disable_hue_edit ? -FLT_MAX : hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);
|
value_changed |= DragFloat(ids[n], &f[n], 1.0f/255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);
|
||||||
value_changed_as_float |= value_changed;
|
value_changed_as_float |= value_changed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value_changed |= DragInt(ids[n], &i[n], 1.0f, disable_hue_edit ? INT_MAX : 0, disable_hue_edit ? INT_MIN : hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);
|
value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);
|
||||||
}
|
}
|
||||||
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
||||||
OpenPopupOnItemClick("context");
|
OpenPopupOnItemClick("context");
|
||||||
@ -4350,7 +4356,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
|
|
||||||
if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel))
|
if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel))
|
||||||
{
|
{
|
||||||
window->DC.CursorPos = ImVec2(pos.x + w_full + style.ItemInnerSpacing.x, pos.y + style.FramePadding.y);
|
const float text_offset_x = (flags & ImGuiColorEditFlags_NoInputs) ? w_button : w_full + style.ItemInnerSpacing.x;
|
||||||
|
window->DC.CursorPos = ImVec2(pos.x + text_offset_x, pos.y + style.FramePadding.y);
|
||||||
TextEx(label, label_display_end);
|
TextEx(label, label_display_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4363,6 +4370,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
if ((flags & ImGuiColorEditFlags_DisplayHSV) && (flags & ImGuiColorEditFlags_InputRGB))
|
if ((flags & ImGuiColorEditFlags_DisplayHSV) && (flags & ImGuiColorEditFlags_InputRGB))
|
||||||
{
|
{
|
||||||
g.ColorEditLastHue = f[0];
|
g.ColorEditLastHue = f[0];
|
||||||
|
g.ColorEditLastSat = f[1];
|
||||||
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
|
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||||
memcpy(g.ColorEditLastColor, f, sizeof(float) * 3);
|
memcpy(g.ColorEditLastColor, f, sizeof(float) * 3);
|
||||||
}
|
}
|
||||||
@ -4545,8 +4553,13 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|||||||
{
|
{
|
||||||
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
||||||
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
||||||
if (S == 0 && memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
|
if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
|
||||||
H = g.ColorEditLastHue;
|
{
|
||||||
|
if (S == 0)
|
||||||
|
H = g.ColorEditLastHue;
|
||||||
|
if (V == 0)
|
||||||
|
S = g.ColorEditLastSat;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (flags & ImGuiColorEditFlags_InputHSV)
|
else if (flags & ImGuiColorEditFlags_InputHSV)
|
||||||
{
|
{
|
||||||
@ -4674,6 +4687,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|||||||
{
|
{
|
||||||
ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10*1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);
|
ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10*1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);
|
||||||
g.ColorEditLastHue = H;
|
g.ColorEditLastHue = H;
|
||||||
|
g.ColorEditLastSat = S;
|
||||||
memcpy(g.ColorEditLastColor, col, sizeof(float) * 3);
|
memcpy(g.ColorEditLastColor, col, sizeof(float) * 3);
|
||||||
}
|
}
|
||||||
else if (flags & ImGuiColorEditFlags_InputHSV)
|
else if (flags & ImGuiColorEditFlags_InputHSV)
|
||||||
@ -4728,8 +4742,13 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|||||||
G = col[1];
|
G = col[1];
|
||||||
B = col[2];
|
B = col[2];
|
||||||
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
||||||
if (S == 0 && memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0) // Fix local Hue as display below will use it immediately.
|
if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0) // Fix local Hue as display below will use it immediately.
|
||||||
H = g.ColorEditLastHue;
|
{
|
||||||
|
if (S == 0)
|
||||||
|
H = g.ColorEditLastHue;
|
||||||
|
if (V == 0)
|
||||||
|
S = g.ColorEditLastSat;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (flags & ImGuiColorEditFlags_InputHSV)
|
else if (flags & ImGuiColorEditFlags_InputHSV)
|
||||||
{
|
{
|
||||||
@ -5281,10 +5300,12 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||||||
button_flags |= ImGuiButtonFlags_AllowItemOverlap;
|
button_flags |= ImGuiButtonFlags_AllowItemOverlap;
|
||||||
if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||||
button_flags |= ImGuiButtonFlags_PressedOnDoubleClick | ((flags & ImGuiTreeNodeFlags_OpenOnArrow) ? ImGuiButtonFlags_PressedOnClickRelease : 0);
|
button_flags |= ImGuiButtonFlags_PressedOnDoubleClick | ((flags & ImGuiTreeNodeFlags_OpenOnArrow) ? ImGuiButtonFlags_PressedOnClickRelease : 0);
|
||||||
|
else
|
||||||
|
button_flags |= ImGuiButtonFlags_PressedOnClickRelease;
|
||||||
if (!is_leaf)
|
if (!is_leaf)
|
||||||
button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;
|
button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;
|
||||||
|
|
||||||
// We allow clicking on the arrow section with keyboard modifiers held, in order to easily
|
// We allow clicking on the arrow section with keyboard modifiers held, in order to easily
|
||||||
// allow browsing a tree while preserving selection with code implementing multi-selection patterns.
|
// allow browsing a tree while preserving selection with code implementing multi-selection patterns.
|
||||||
// When clicking on the rest of the tree node we always disallow keyboard modifiers.
|
// When clicking on the rest of the tree node we always disallow keyboard modifiers.
|
||||||
const float hit_padding_x = style.TouchExtraPadding.x;
|
const float hit_padding_x = style.TouchExtraPadding.x;
|
||||||
@ -5292,7 +5313,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||||||
const float arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding.x * 2.0f) + hit_padding_x;
|
const float arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding.x * 2.0f) + hit_padding_x;
|
||||||
if (window != g.HoveredWindow || !(g.IO.MousePos.x >= arrow_hit_x1 && g.IO.MousePos.x < arrow_hit_x2))
|
if (window != g.HoveredWindow || !(g.IO.MousePos.x >= arrow_hit_x1 && g.IO.MousePos.x < arrow_hit_x2))
|
||||||
button_flags |= ImGuiButtonFlags_NoKeyModifiers;
|
button_flags |= ImGuiButtonFlags_NoKeyModifiers;
|
||||||
|
|
||||||
bool selected = (flags & ImGuiTreeNodeFlags_Selected) != 0;
|
bool selected = (flags & ImGuiTreeNodeFlags_Selected) != 0;
|
||||||
const bool was_selected = selected;
|
const bool was_selected = selected;
|
||||||
|
|
||||||
@ -5566,12 +5587,12 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|||||||
|
|
||||||
// We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries
|
// We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries
|
||||||
ImGuiButtonFlags button_flags = 0;
|
ImGuiButtonFlags button_flags = 0;
|
||||||
if (flags & ImGuiSelectableFlags_NoHoldingActiveID) button_flags |= ImGuiButtonFlags_NoHoldingActiveID;
|
if (flags & ImGuiSelectableFlags_NoHoldingActiveID) { button_flags |= ImGuiButtonFlags_NoHoldingActiveID; }
|
||||||
if (flags & ImGuiSelectableFlags_PressedOnClick) button_flags |= ImGuiButtonFlags_PressedOnClick;
|
if (flags & ImGuiSelectableFlags_PressedOnClick) { button_flags |= ImGuiButtonFlags_PressedOnClick; }
|
||||||
if (flags & ImGuiSelectableFlags_PressedOnRelease) button_flags |= ImGuiButtonFlags_PressedOnRelease;
|
if (flags & ImGuiSelectableFlags_PressedOnRelease) { button_flags |= ImGuiButtonFlags_PressedOnRelease; }
|
||||||
if (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled;
|
if (flags & ImGuiSelectableFlags_Disabled) { button_flags |= ImGuiButtonFlags_Disabled; }
|
||||||
if (flags & ImGuiSelectableFlags_AllowDoubleClick) button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;
|
if (flags & ImGuiSelectableFlags_AllowDoubleClick) { button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick; }
|
||||||
if (flags & ImGuiSelectableFlags_AllowItemOverlap) button_flags |= ImGuiButtonFlags_AllowItemOverlap;
|
if (flags & ImGuiSelectableFlags_AllowItemOverlap) { button_flags |= ImGuiButtonFlags_AllowItemOverlap; }
|
||||||
|
|
||||||
if (flags & ImGuiSelectableFlags_Disabled)
|
if (flags & ImGuiSelectableFlags_Disabled)
|
||||||
selected = false;
|
selected = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user