mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-21 15:16:35 +00:00
Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt
This commit is contained in:
commit
e0c0e53edf
@ -98,6 +98,19 @@ Other changes:
|
||||
to make the examples main.cpp easier to read.
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.74 WIP (In Progress)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Breaking Changes:
|
||||
-
|
||||
|
||||
Other Changes:
|
||||
- InputText, Nav: Fixed Home/End key broken when activating Keyboard Navigation. (#787)
|
||||
- TreeNode: Fixed combination of ImGuiTreeNodeFlags_SpanFullWidth and ImGuiTreeNodeFlags_OpenOnArrow
|
||||
incorrectly locating the arrow hit position to the left of the frame. (#2451, #2438, #1897)
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.73 (Released 2019-09-24)
|
||||
-----------------------------------------------------------------------
|
||||
|
@ -3,13 +3,13 @@ dear imgui
|
||||
[![Build Status](https://api.travis-ci.com/ocornut/imgui.svg?branch=master)](https://travis-ci.com/ocornut/imgui)
|
||||
[![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 licence, 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. If you are an individual using dear imgui, please consider supporting the project via Patreon or PayPal.)</sub>
|
||||
|
||||
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
||||
<br> _E-mail: omarcornut at gmail dot com_
|
||||
<br> _E-mail: contact @ dearimgui dot org_
|
||||
|
||||
Individuals/hobbyists: support continued maintenance and development via the monthly Patreon:
|
||||
<br> [![Patreon](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/patreon_01.png)](http://www.patreon.com/imgui)
|
||||
<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)
|
||||
@ -22,12 +22,10 @@ Dear ImGui is designed to **enable fast iterations** and to **empower programmer
|
||||
|
||||
Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard.
|
||||
|
||||
See [Software using dear imgui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui), [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) and [Gallery](https://github.com/ocornut/imgui/issues/2529) pages to get an idea of its use cases.
|
||||
|
||||
| [Usage](#usage) - [How it works](#how-it-works) - [Demo](#demo) - [Integration](#integration) |
|
||||
:----------------------------------------------------------: |
|
||||
| [Upcoming changes](#upcoming-changes) - [Gallery](#gallery) - [Support, FAQ](#support-frequently-asked-questions-faq) - [How to help](#how-to-help) - [Sponsors](#sponsors) - [Credits](#credits) - [License](#license) |
|
||||
| <sub>[Wiki](https://github.com/ocornut/imgui/wiki) - [Language & frameworks bindings](https://github.com/ocornut/imgui/wiki/Bindings) - [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) - [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) </sub> |
|
||||
| [Wiki](https://github.com/ocornut/imgui/wiki) - [Language & frameworks bindings](https://github.com/ocornut/imgui/wiki/Bindings) - [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) - [User quotes](https://github.com/ocornut/imgui/wiki/Quotes) |
|
||||
|
||||
### Usage
|
||||
|
||||
@ -45,17 +43,15 @@ Dear ImGui is self-contained within a few files that you can easily copy and com
|
||||
|
||||
No specific build process is required. You can add the .cpp files to your project or #include them from an existing file.
|
||||
|
||||
Backends for a variety of graphics api and rendering platforms are provided in the [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder.
|
||||
Backends for a variety of graphics api and rendering platforms along with example applications are provided in the [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder.
|
||||
|
||||
The backend passes mouse/keyboard/gamepad inputs and variety of settings to Dear ImGui, and is in charge of rendering the resulting vertices (see example applications for more details). After Dear ImGui is setup in your application, you can use it from \_anywhere\_ in your program loop:
|
||||
The backend passes mouse/keyboard/gamepad inputs and variety of settings to Dear ImGui, and is in charge of rendering the resulting vertices. After Dear ImGui is setup in your application, you can use it from \_anywhere\_ in your program loop:
|
||||
|
||||
Code:
|
||||
```cp
|
||||
ImGui::Text("Hello, world %d", 123);
|
||||
if (ImGui::Button("Save"))
|
||||
{
|
||||
// do stuff
|
||||
}
|
||||
MySaveFunction();
|
||||
ImGui::InputText("string", buf, IM_ARRAYSIZE(buf));
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
||||
```
|
||||
@ -101,7 +97,7 @@ Dear ImGui allows you **create elaborate tools** as well as very short-lived one
|
||||
|
||||
### How it works
|
||||
|
||||
Check out the References section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize superfluous state duplication, state synchronization and state retention from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.
|
||||
Check out the [References](#references) section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize superfluous state duplication, state synchronization and state retention from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.
|
||||
|
||||
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes required to render them is fairly small. Because Dear ImGui doesn't know or touch graphics state directly, you can call its functions anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate dear imgui with your existing codebase.
|
||||
|
||||
@ -109,23 +105,25 @@ _A common misunderstanding is to mistake immediate mode gui for immediate mode r
|
||||
|
||||
### Demo
|
||||
|
||||
Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcasing variety of Dear ImGui features and examples.
|
||||
Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcasing variety of features and examples. The code is always available for reference in `imgui_demo.cpp`.
|
||||
|
||||
![screenshot demo](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v167/v167-misc.png)
|
||||
|
||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
||||
- [imgui-demo-binaries-20190715.zip](http://www.dearimgui.org/binaries/imgui-demo-binaries-20190715.zip) (Windows binaries, Dear ImGui 1.72 WIP built 2019/07/15, master branch, 5 executables)
|
||||
- [imgui-demo-binaries-20190715.zip](http://www.dearimgui.org/binaries/imgui-demo-binaries-20190715.zip) (Windows binaries, 1.72 WIP, built 2019/07/15, master branch, 5 executables)
|
||||
|
||||
The demo applications are unfortunately not yet DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at different scale, and scale your Style with `style.ScaleAllSizes()`.
|
||||
The demo applications are not DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at different scale, and scale your style with `style.ScaleAllSizes()`.
|
||||
|
||||
### Integration
|
||||
|
||||
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that. If you are an experienced programmer at ease with those concepts, it should take you about an hour to integrate Dear ImGui in your custom engine. Make sure to spend time reading the FAQ, the comments and other documentation!
|
||||
On most platforms and when using C++, **you should be able to use a combination of the [imgui_impl_xxxx](https://github.com/ocornut/imgui/tree/master/examples) files without modification** (e.g. `imgui_impl_win32.cpp` + `imgui_impl_dx11.cpp`). If your engine supports multiple platforms, consider using more of the imgui_impl_xxxx files instead of rewriting them: this will be less work for you and you can get Dear ImGui running immediately. You can _later_ decide to rewrite a custom binding using your custom engine functions if you wish so.
|
||||
|
||||
_NB: those third-party bindings may be more or less maintained, more or less close to the original API (as people who create language bindings sometimes haven't used the C++ API themselves.. for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
||||
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that. If you are an experienced programmer at ease with those concepts, it should take you less than two hours to integrate Dear ImGui in your custom engine. **Make sure to spend time reading the FAQ, comments, and one of the examples/ application!**
|
||||
|
||||
Languages: (third-party bindings)
|
||||
- C: [cimgui](https://github.com/cimgui/cimgui) (2018: now auto-generated! you can use its json output to generate bindings for other languages)
|
||||
_NB: those third-party bindings may be more or less maintained, more or less close to the original API (as people who create language bindings sometimes haven't used the C++ API themselves.. for the good reason that they aren't C++ users!). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
||||
|
||||
Languages:
|
||||
- C: [cimgui](https://github.com/cimgui/cimgui) (auto-generated! **you can use its json output to generate bindings for other languages**)
|
||||
- C#/.Net: [ImGui.NET](https://github.com/mellinoe/ImGui.NET)
|
||||
- ChaiScript: [imgui-chaiscript](https://github.com/JuJuBoSc/imgui-chaiscript)
|
||||
- D: [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
|
||||
@ -141,7 +139,7 @@ Languages: (third-party bindings)
|
||||
- Python: [pyimgui](https://github.com/swistakm/pyimgui) or [bimpy](https://github.com/podgorskiy/bimpy) or [ogre-imgui](https://github.com/OGRECave/ogre-imgui)
|
||||
- Ruby: [ruby-imgui](https://github.com/vaiorabbit/ruby-imgui)
|
||||
- Rust: [imgui-rs](https://github.com/Gekkio/imgui-rs) or [imgui-rust](https://github.com/nsf/imgui-rust)
|
||||
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
||||
- Swift: [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
||||
|
||||
Frameworks:
|
||||
- Renderers: DirectX 9/10/11/12, Metal, OpenGL2, OpenGL3+/ES2/ES3, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||
@ -172,12 +170,12 @@ For other bindings: see [Bindings](https://github.com/ocornut/imgui/wiki/Binding
|
||||
### Upcoming Changes
|
||||
|
||||
Some of the goals for 2019 are:
|
||||
- Finish work on docking, tabs. (see [#2109](https://github.com/ocornut/imgui/issues/2109), in public `docking` branch looking for feedback)
|
||||
- Finish work on multiple viewports / multiple OS windows. (see [#1542](https://github.com/ocornut/imgui/issues/1542), in public `docking` branch looking for feedback)
|
||||
- Finish work on docking, tabs. (see [#2109](https://github.com/ocornut/imgui/issues/2109), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch looking for feedback)
|
||||
- Finish work on multiple viewports / multiple OS windows. (see [#1542](https://github.com/ocornut/imgui/issues/1542), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch looking for feedback)
|
||||
- Finish work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787))
|
||||
- Add an automation and testing system, both to test the library and end-user apps. (see [#435](https://github.com/ocornut/imgui/issues/435))
|
||||
- Make Columns better. (they are currently pretty terrible!)
|
||||
- Make the examples look better, improve styles, improve font support, make the examples hi-DPI aware.
|
||||
- Make Columns better. They are currently pretty terrible! New Tables API coming Q4 2019!
|
||||
- Make the examples look better, improve styles, improve font support, make the examples hi-DPI and multi-DPI aware.
|
||||
|
||||
### Gallery
|
||||
|
||||
@ -208,7 +206,7 @@ See the [Wiki](https://github.com/ocornut/imgui/wiki) for more references and [B
|
||||
|
||||
If you are new to Dear ImGui and have issues with: compiling, linking, adding fonts, wiring inputs, running or displaying Dear ImGui: you can use [Discord server](https://discord.gg/NgJ4SEP) or [Discourse forums](https://discourse.dearimgui.org).
|
||||
|
||||
Otherwise for any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues. Please read and fill the New Issue template carefully.
|
||||
Otherwise, for any other questions, bug reports, requests, feedback, you may post on https://github.com/ocornut/imgui/issues. Please read and fill the New Issue template carefully.
|
||||
|
||||
Private support is available for paying customers.
|
||||
|
||||
@ -220,8 +218,8 @@ Private support is available for paying customers.
|
||||
- The demo covers most features of Dear ImGui, so you can read the code and see its output.
|
||||
- See documentation and comments at the top of imgui.cpp + effectively imgui.h.
|
||||
- Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder to explain how to integrate Dear ImGui with your own engine/application.
|
||||
- Your programming IDE is your friend, find the type or function declaration to find comments associated to it.
|
||||
- We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort.
|
||||
- Your programming IDE is your friend, find the type or function declaration to find comments associated with it.
|
||||
- We obviously need better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort.
|
||||
|
||||
**Which version should I get?**
|
||||
|
||||
@ -235,7 +233,7 @@ See the [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) and [Software usi
|
||||
|
||||
**Why the odd dual naming, "Dear ImGui" vs "ImGui"?**
|
||||
|
||||
The library started its life as "ImGui" due to the fact that I didn't give it a proper name when I released 1.0 and had no particular expectation that it would take off. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations (e.g. Unity uses it own implementation of the IMGUI paradigm). To reduce this ambiguity without affecting existing codebases, I have decided on an alternate, longer name "Dear ImGui" that people can use to refer to this specific library. Please try to refer to this library as "Dear ImGui".
|
||||
The library started its life as "ImGui" due to the fact that I didn't give it a proper name when I released 1.0 and had no particular expectation that it would take off. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations (e.g. Unity uses its own implementation of the IMGUI paradigm). To reduce this ambiguity without affecting existing codebases, I have decided on an alternate, longer name "Dear ImGui" that people can use to refer to this specific library. Please try to refer to this library as "Dear ImGui".
|
||||
|
||||
**How can I tell whether to dispatch mouse/keyboard to Dear ImGui or to my application?**
|
||||
<br>**How can I display an image? What is ImTextureID, how does it works?** ([examples](https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples))
|
||||
@ -258,7 +256,7 @@ See the FAQ in [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cp
|
||||
|
||||
Yes. People have written game editors, data browsers, debuggers, profilers and all sort of non-trivial tools with the library. In my experience the simplicity of the API is very empowering. Your UI runs close to your live data. Make the tools always-on and everybody in the team will be inclined to create new tools (as opposed to more "offline" UI toolkits where only a fraction of your team effectively creates tools). The list of sponsors below is also an indicator that serious game teams have been using the library.
|
||||
|
||||
Dear ImGui is very programmer centric and the immediate-mode GUI paradigm might requires you to readjust some habits before you can realize its full potential. Dear ImGui is about making things that are simple, efficient and powerful.
|
||||
Dear ImGui is very programmer centric and the immediate-mode GUI paradigm might require you to readjust some habits before you can realize its full potential. Dear ImGui is about making things that are simple, efficient and powerful.
|
||||
|
||||
**Can you reskin the look of Dear ImGui?**
|
||||
|
||||
@ -268,7 +266,7 @@ You can alter the look of the interface to some degree: changing colors, sizes,
|
||||
|
||||
**Why using C++ (as opposed to C)?**
|
||||
|
||||
Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost-insanity/quagmire. Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers. Dear ImGui doesn't use any C++ header file. Language-wise, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.
|
||||
Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost insanity/quagmire. Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers. Dear ImGui doesn't use any C++ header file. Language-wise, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.
|
||||
|
||||
There is an auto-generated [c-api for Dear ImGui (cimgui)](https://github.com/cimgui/cimgui) by Sonoro1234 and Stephan Dilly. It is designed for creating binding to other languages. If possible, I would suggest using your target language functionalities to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. Also see [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for various third-party bindings.
|
||||
|
||||
@ -284,13 +282,13 @@ How to help
|
||||
|
||||
**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 licence, 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. If you are an individual using dear imgui, please consider supporting the project via Patreon or PayPal. Thank you!
|
||||
|
||||
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
||||
<br> _E-mail: omarcornut at gmail dot com_
|
||||
<br> _E-mail: contact @ dearimgui dot org_
|
||||
|
||||
Individuals/hobbyists: support continued maintenance and development via the monthly Patreon:
|
||||
<br> [![Patreon](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/patreon_01.png)](http://www.patreon.com/imgui)
|
||||
<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)
|
||||
@ -318,13 +316,13 @@ And all other past and present supporters; THANK YOU!
|
||||
Credits
|
||||
-------
|
||||
|
||||
Developed by [Omar Cornut](http://www.miracleworld.net) and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com).
|
||||
Developed by [Omar Cornut](http://www.miracleworld.net) and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com) (Vita).
|
||||
|
||||
I first discovered the IMGUI paradigm at [Q-Games](http://www.q-games.com) where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it.
|
||||
|
||||
Embeds [ProggyClean.ttf](http://upperbounds.net) font by Tristan Grimmer (MIT license).
|
||||
|
||||
Embeds [stb_textedit.h, stb_truetype.h, stb_rectpack.h](https://github.com/nothings/stb/) by Sean Barrett (public domain).
|
||||
Embeds [stb_textedit.h, stb_truetype.h, stb_rect_pack.h](https://github.com/nothings/stb/) by Sean Barrett (public domain).
|
||||
|
||||
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. And everybody posting feedback, questions and patches on the GitHub.
|
||||
|
||||
|
@ -288,16 +288,17 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- drag and drop: fix/support/options for overlapping drag sources.
|
||||
- drag and drop: releasing a drop shows the "..." tooltip for one frame - since e13e598 (#1725)
|
||||
- drag and drop: drag source on a group object (would need e.g. an invisible button covering group in EndGroup) https://twitter.com/paniq/status/1121446364909535233
|
||||
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov.
|
||||
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov. (see 2018/01/11 post in #143)
|
||||
- drag and drop: allow preview tooltip to be submitted from a different place than the drag source. (#1725)
|
||||
- drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637)
|
||||
- drag and drop: make it easier and provide a demo to have tooltip both are source and target site, with a more detailed one on target site (tooltip ordering problem)
|
||||
- drag and drop: demo with reordering nodes (in a list, or a tree node). (#143)
|
||||
- drag and drop: test integrating with os drag and drop (make it easy to do a naive WM_DROPFILE integration)
|
||||
- drag and drop: allow for multiple payload types. (#143)
|
||||
- drag and drop: make payload optional? (#143)
|
||||
- drag and drop: make payload optional? payload promise? (see 2018/01/11 post in #143)
|
||||
- drag and drop: (#143) "both an in-process pointer and a promise to generate a serialized version, for whether the drag ends inside or outside the same process"
|
||||
- drag and drop: feedback when hovering a region blocked by modal (mouse cursor "NO"?)
|
||||
|
||||
- node/graph editor (#306)
|
||||
- pie menus patterns (#434)
|
||||
- markup: simple markup language for color change? (#902)
|
||||
|
@ -1,5 +1,5 @@
|
||||
-----------------------------------------------------------------------
|
||||
dear imgui, v1.73
|
||||
dear imgui, v1.74 WIP
|
||||
-----------------------------------------------------------------------
|
||||
examples/README.txt
|
||||
(This is the README file for the examples/ folder. See docs/ for more documentation)
|
||||
|
@ -26,6 +26,8 @@ void CleanupRenderTarget();
|
||||
int main(int, char**)
|
||||
{
|
||||
// Setup SDL
|
||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
||||
{
|
||||
printf("Error: %s\n", SDL_GetError());
|
||||
|
@ -17,6 +17,8 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
// Setup SDL
|
||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
||||
{
|
||||
printf("Error: %s\n", SDL_GetError());
|
||||
|
@ -27,6 +27,8 @@
|
||||
int main(int, char**)
|
||||
{
|
||||
// Setup SDL
|
||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
||||
{
|
||||
printf("Error: %s\n", SDL_GetError());
|
||||
|
@ -179,7 +179,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||
gl_loader = "GLEW";
|
||||
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
||||
gl_loader = "GLAD";
|
||||
#else IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||
#else // IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||
gl_loader = "Custom";
|
||||
#endif
|
||||
|
||||
|
63
imgui.cpp
63
imgui.cpp
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.73
|
||||
// dear imgui, v1.74 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
||||
@ -1076,7 +1076,7 @@ static void NavUpdate();
|
||||
static void NavUpdateWindowing();
|
||||
static void NavUpdateWindowingOverlay();
|
||||
static void NavUpdateMoveResult();
|
||||
static float NavUpdatePageUpPageDown(int allowed_dir_flags);
|
||||
static float NavUpdatePageUpPageDown();
|
||||
static inline void NavUpdateAnyRequestFlag();
|
||||
static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand);
|
||||
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, ImGuiID id);
|
||||
@ -2761,6 +2761,8 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = SetWindowDockAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;
|
||||
SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX);
|
||||
|
||||
InnerRect = ImRect(0.0f, 0.0f, 0.0f, 0.0f); // Clear so the InnerRect.GetSize() code in Begin() doesn't lead to overflow even if the result isn't used.
|
||||
|
||||
LastFrameActive = -1;
|
||||
LastFrameJustFocused = -1;
|
||||
LastTimeActive = -1.0f;
|
||||
@ -2923,8 +2925,6 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
||||
}
|
||||
}
|
||||
g.ActiveId = id;
|
||||
g.ActiveIdAllowNavDirFlags = 0;
|
||||
g.ActiveIdBlockNavInputFlags = 0;
|
||||
g.ActiveIdAllowOverlap = false;
|
||||
g.ActiveIdWindow = window;
|
||||
g.ActiveIdHasBeenEditedThisFrame = false;
|
||||
@ -2933,6 +2933,12 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
||||
g.ActiveIdIsAlive = id;
|
||||
g.ActiveIdSource = (g.NavActivateId == id || g.NavInputId == id || g.NavJustTabbedId == id || g.NavJustMovedToId == id) ? ImGuiInputSource_Nav : ImGuiInputSource_Mouse;
|
||||
}
|
||||
|
||||
// Clear declaration of inputs claimed by the widget
|
||||
// (Please note that this is WIP and not all keys/inputs are thoroughly declared by all widgets yet)
|
||||
g.ActiveIdUsingNavDirMask = 0x00;
|
||||
g.ActiveIdUsingNavInputMask = 0x00;
|
||||
g.ActiveIdUsingKeyInputMask = 0x00;
|
||||
}
|
||||
|
||||
// FIXME-NAV: The existence of SetNavID/SetNavIDWithRectRel/SetFocusID is incredibly messy and confusing and needs some explanation or refactoring.
|
||||
@ -3026,7 +3032,7 @@ static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFla
|
||||
}
|
||||
|
||||
// Advance cursor given item size for layout.
|
||||
void ImGui::ItemSize(const ImVec2& size, float text_offset_y)
|
||||
void ImGui::ItemSize(const ImVec2& size, float text_baseline_y)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
@ -3035,28 +3041,28 @@ void ImGui::ItemSize(const ImVec2& size, float text_offset_y)
|
||||
|
||||
// Always align ourselves on pixel boundaries
|
||||
const float line_height = ImMax(window->DC.CurrLineSize.y, size.y);
|
||||
const float text_base_offset = ImMax(window->DC.CurrLineTextBaseOffset, text_offset_y);
|
||||
//if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]
|
||||
window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x + size.x;
|
||||
window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y;
|
||||
window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
|
||||
window->DC.CursorPos.y = (float)(int)(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y);
|
||||
window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); // Next line
|
||||
window->DC.CursorPos.y = (float)(int)(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y); // Next line
|
||||
window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);
|
||||
window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y);
|
||||
//if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]
|
||||
|
||||
window->DC.PrevLineSize.y = line_height;
|
||||
window->DC.PrevLineTextBaseOffset = text_base_offset;
|
||||
window->DC.CurrLineSize.y = window->DC.CurrLineTextBaseOffset = 0.0f;
|
||||
window->DC.CurrLineSize.y = 0.0f;
|
||||
window->DC.PrevLineTextBaseOffset = ImMax(window->DC.CurrLineTextBaseOffset, text_baseline_y);
|
||||
window->DC.CurrLineTextBaseOffset = 0.0f;
|
||||
|
||||
// Horizontal layout mode
|
||||
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
|
||||
SameLine();
|
||||
}
|
||||
|
||||
void ImGui::ItemSize(const ImRect& bb, float text_offset_y)
|
||||
void ImGui::ItemSize(const ImRect& bb, float text_baseline_y)
|
||||
{
|
||||
ItemSize(bb.GetSize(), text_offset_y);
|
||||
ItemSize(bb.GetSize(), text_baseline_y);
|
||||
}
|
||||
|
||||
// Declare item bounding box for clipping and interaction.
|
||||
@ -3218,7 +3224,7 @@ bool ImGui::FocusableItemRegister(ImGuiWindow* window, ImGuiID id)
|
||||
|
||||
// Process TAB/Shift-TAB to tab *OUT* of the currently focused item.
|
||||
// (Note that we can always TAB out of a widget that doesn't allow tabbing in)
|
||||
if (g.ActiveId == id && g.FocusTabPressed && !(g.ActiveIdBlockNavInputFlags & (1 << ImGuiNavInput_KeyTab_)) && g.FocusRequestNextWindow == NULL)
|
||||
if (g.ActiveId == id && g.FocusTabPressed && !IsActiveIdUsingKey(ImGuiKey_Tab) && g.FocusRequestNextWindow == NULL)
|
||||
{
|
||||
g.FocusRequestNextWindow = window;
|
||||
g.FocusRequestNextCounterTab = window->DC.FocusCounterTab + (g.IO.KeyShift ? (is_tab_stop ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items.
|
||||
@ -3999,6 +4005,11 @@ void ImGui::NewFrame()
|
||||
g.ActiveIdIsJustActivated = false;
|
||||
if (g.TempInputTextId != 0 && g.ActiveId != g.TempInputTextId)
|
||||
g.TempInputTextId = 0;
|
||||
if (g.ActiveId == 0)
|
||||
{
|
||||
g.ActiveIdUsingNavDirMask = g.ActiveIdUsingNavInputMask = 0;
|
||||
g.ActiveIdUsingKeyInputMask = 0;
|
||||
}
|
||||
|
||||
// Drag and drop
|
||||
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
||||
@ -9032,7 +9043,6 @@ static void ImGui::NavUpdate()
|
||||
NAV_MAP_KEY(ImGuiKey_RightArrow,ImGuiNavInput_KeyRight_);
|
||||
NAV_MAP_KEY(ImGuiKey_UpArrow, ImGuiNavInput_KeyUp_ );
|
||||
NAV_MAP_KEY(ImGuiKey_DownArrow, ImGuiNavInput_KeyDown_ );
|
||||
NAV_MAP_KEY(ImGuiKey_Tab, ImGuiNavInput_KeyTab_ );
|
||||
if (g.IO.KeyCtrl)
|
||||
g.IO.NavInputs[ImGuiNavInput_TweakSlow] = 1.0f;
|
||||
if (g.IO.KeyShift)
|
||||
@ -9110,7 +9120,7 @@ static void ImGui::NavUpdate()
|
||||
{
|
||||
if (g.ActiveId != 0)
|
||||
{
|
||||
if (!(g.ActiveIdBlockNavInputFlags & (1 << ImGuiNavInput_Cancel)))
|
||||
if (!IsActiveIdUsingNavInput(ImGuiNavInput_Cancel))
|
||||
ClearActiveID();
|
||||
}
|
||||
else if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow) && !(g.NavWindow->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->ParentWindow && g.NavWindow != g.NavWindow->RootWindowDockStop)
|
||||
@ -9172,17 +9182,16 @@ static void ImGui::NavUpdate()
|
||||
g.NavNextActivateId = 0;
|
||||
|
||||
// Initiate directional inputs request
|
||||
const int allowed_dir_flags = (g.ActiveId == 0) ? ~0 : g.ActiveIdAllowNavDirFlags;
|
||||
if (g.NavMoveRequestForward == ImGuiNavForward_None)
|
||||
{
|
||||
g.NavMoveDir = ImGuiDir_None;
|
||||
g.NavMoveRequestFlags = ImGuiNavMoveFlags_None;
|
||||
if (g.NavWindow && !g.NavWindowingTarget && allowed_dir_flags && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||
if (g.NavWindow && !g.NavWindowingTarget && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||
{
|
||||
if ((allowed_dir_flags & (1 << ImGuiDir_Left)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadLeft, ImGuiNavInput_KeyLeft_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Left; }
|
||||
if ((allowed_dir_flags & (1 << ImGuiDir_Right)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadRight,ImGuiNavInput_KeyRight_,ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Right; }
|
||||
if ((allowed_dir_flags & (1 << ImGuiDir_Up)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadUp, ImGuiNavInput_KeyUp_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Up; }
|
||||
if ((allowed_dir_flags & (1 << ImGuiDir_Down)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadDown, ImGuiNavInput_KeyDown_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Down; }
|
||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadLeft, ImGuiNavInput_KeyLeft_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Left; }
|
||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadRight,ImGuiNavInput_KeyRight_,ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Right; }
|
||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadUp, ImGuiNavInput_KeyUp_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Up; }
|
||||
if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_DpadDown, ImGuiNavInput_KeyDown_, ImGuiInputReadMode_Repeat)) { g.NavMoveDir = ImGuiDir_Down; }
|
||||
}
|
||||
g.NavMoveClipDir = g.NavMoveDir;
|
||||
}
|
||||
@ -9199,7 +9208,7 @@ static void ImGui::NavUpdate()
|
||||
// FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag?
|
||||
float nav_scoring_rect_offset_y = 0.0f;
|
||||
if (nav_keyboard_active)
|
||||
nav_scoring_rect_offset_y = NavUpdatePageUpPageDown(allowed_dir_flags);
|
||||
nav_scoring_rect_offset_y = NavUpdatePageUpPageDown();
|
||||
|
||||
// If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match
|
||||
if (g.NavMoveDir != ImGuiDir_None)
|
||||
@ -9346,7 +9355,7 @@ static void ImGui::NavUpdateMoveResult()
|
||||
}
|
||||
|
||||
// Handle PageUp/PageDown/Home/End keys
|
||||
static float ImGui::NavUpdatePageUpPageDown(int allowed_dir_flags)
|
||||
static float ImGui::NavUpdatePageUpPageDown()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.NavMoveDir != ImGuiDir_None || g.NavWindow == NULL)
|
||||
@ -9355,10 +9364,10 @@ static float ImGui::NavUpdatePageUpPageDown(int allowed_dir_flags)
|
||||
return 0.0f;
|
||||
|
||||
ImGuiWindow* window = g.NavWindow;
|
||||
const bool page_up_held = IsKeyDown(g.IO.KeyMap[ImGuiKey_PageUp]) && (allowed_dir_flags & (1 << ImGuiDir_Up));
|
||||
const bool page_down_held = IsKeyDown(g.IO.KeyMap[ImGuiKey_PageDown]) && (allowed_dir_flags & (1 << ImGuiDir_Down));
|
||||
const bool home_pressed = IsKeyPressed(g.IO.KeyMap[ImGuiKey_Home]) && (allowed_dir_flags & (1 << ImGuiDir_Up));
|
||||
const bool end_pressed = IsKeyPressed(g.IO.KeyMap[ImGuiKey_End]) && (allowed_dir_flags & (1 << ImGuiDir_Down));
|
||||
const bool page_up_held = IsKeyDown(g.IO.KeyMap[ImGuiKey_PageUp]) && !IsActiveIdUsingKey(ImGuiKey_PageUp);
|
||||
const bool page_down_held = IsKeyDown(g.IO.KeyMap[ImGuiKey_PageDown]) && !IsActiveIdUsingKey(ImGuiKey_PageDown);
|
||||
const bool home_pressed = IsKeyPressed(g.IO.KeyMap[ImGuiKey_Home]) && !IsActiveIdUsingKey(ImGuiKey_Home);
|
||||
const bool end_pressed = IsKeyPressed(g.IO.KeyMap[ImGuiKey_End]) && !IsActiveIdUsingKey(ImGuiKey_End);
|
||||
if (page_up_held != page_down_held || home_pressed != end_pressed) // If either (not both) are pressed
|
||||
{
|
||||
if (window->DC.NavLayerActiveMask == 0x00 && window->DC.NavHasScroll)
|
||||
|
7
imgui.h
7
imgui.h
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.73
|
||||
// dear imgui, v1.74 WIP
|
||||
// (headers)
|
||||
|
||||
// See imgui.cpp file for documentation.
|
||||
@ -47,8 +47,8 @@ Index of this file:
|
||||
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.73"
|
||||
#define IMGUI_VERSION_NUM 17300
|
||||
#define IMGUI_VERSION "1.74 WIP"
|
||||
#define IMGUI_VERSION_NUM 17301
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
|
||||
#define IMGUI_HAS_DOCK 1 // Docking WIP branch
|
||||
@ -1042,7 +1042,6 @@ enum ImGuiNavInput_
|
||||
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
||||
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[].
|
||||
ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt
|
||||
ImGuiNavInput_KeyTab_, // tab // = Tab key
|
||||
ImGuiNavInput_KeyLeft_, // move left // = Arrow keys
|
||||
ImGuiNavInput_KeyRight_, // move right
|
||||
ImGuiNavInput_KeyUp_, // move up
|
||||
|
124
imgui_demo.cpp
124
imgui_demo.cpp
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.73
|
||||
// dear imgui, v1.74 WIP
|
||||
// (demo code)
|
||||
|
||||
// Message to the person tempted to delete this file when integrating Dear ImGui into their code base:
|
||||
@ -2105,55 +2105,99 @@ static void ShowDemoWindowLayout()
|
||||
|
||||
if (ImGui::TreeNode("Text Baseline Alignment"))
|
||||
{
|
||||
HelpMarker("This is testing the vertical alignment that gets applied on text to keep it aligned with widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets.");
|
||||
{
|
||||
ImGui::BulletText("Text baseline:");
|
||||
ImGui::SameLine();
|
||||
HelpMarker("This is testing the vertical alignment that gets applied on text to keep it aligned with widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets.");
|
||||
ImGui::Indent();
|
||||
|
||||
ImGui::Text("One\nTwo\nThree"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("Banana");
|
||||
ImGui::Text("KO Blahblah"); ImGui::SameLine();
|
||||
ImGui::Button("Some framed item"); ImGui::SameLine();
|
||||
HelpMarker("Baseline of button will look misaligned with text..");
|
||||
|
||||
ImGui::Text("Banana"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("One\nTwo\nThree");
|
||||
// If your line starts with text, call AlignTextToFramePadding() to align text to upcoming widgets.
|
||||
// Because we don't know what's coming after the Text() statement, we need to move the text baseline down by FramePadding.y
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("OK Blahblah"); ImGui::SameLine();
|
||||
ImGui::Button("Some framed item"); ImGui::SameLine();
|
||||
HelpMarker("We call AlignTextToFramePadding() to vertically align the text baseline by +FramePadding.y");
|
||||
|
||||
ImGui::Button("HOP##1"); ImGui::SameLine();
|
||||
ImGui::Text("Banana"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("Banana");
|
||||
// SmallButton() uses the same vertical padding as Text
|
||||
ImGui::Button("TEST##1"); ImGui::SameLine();
|
||||
ImGui::Text("TEST"); ImGui::SameLine();
|
||||
ImGui::SmallButton("TEST##2");
|
||||
|
||||
ImGui::Button("HOP##2"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("Banana");
|
||||
// If your line starts with text, call AlignTextToFramePadding() to align text to upcoming widgets.
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Text aligned to framed item"); ImGui::SameLine();
|
||||
ImGui::Button("Item##1"); ImGui::SameLine();
|
||||
ImGui::Text("Item"); ImGui::SameLine();
|
||||
ImGui::SmallButton("Item##2"); ImGui::SameLine();
|
||||
ImGui::Button("Item##3");
|
||||
|
||||
ImGui::Button("TEST##1"); ImGui::SameLine();
|
||||
ImGui::Text("TEST"); ImGui::SameLine();
|
||||
ImGui::SmallButton("TEST##2");
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding(); // If your line starts with text, call this to align it to upcoming widgets.
|
||||
ImGui::Text("Text aligned to Widget"); ImGui::SameLine();
|
||||
ImGui::Button("Widget##1"); ImGui::SameLine();
|
||||
ImGui::Text("Widget"); ImGui::SameLine();
|
||||
ImGui::SmallButton("Widget##2"); ImGui::SameLine();
|
||||
ImGui::Button("Widget##3");
|
||||
ImGui::Spacing();
|
||||
|
||||
// Tree
|
||||
const float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
||||
ImGui::Button("Button##1");
|
||||
ImGui::SameLine(0.0f, spacing);
|
||||
if (ImGui::TreeNode("Node##1")) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data
|
||||
{
|
||||
ImGui::BulletText("Multi-line text:");
|
||||
ImGui::Indent();
|
||||
ImGui::Text("One\nTwo\nThree"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("Banana");
|
||||
|
||||
ImGui::AlignTextToFramePadding(); // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget. Otherwise you can use SmallButton (smaller fit).
|
||||
bool node_open = ImGui::TreeNode("Node##2"); // Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add child content.
|
||||
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##2");
|
||||
if (node_open) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data
|
||||
ImGui::Text("Banana"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("One\nTwo\nThree");
|
||||
|
||||
// Bullet
|
||||
ImGui::Button("Button##3");
|
||||
ImGui::SameLine(0.0f, spacing);
|
||||
ImGui::BulletText("Bullet text");
|
||||
ImGui::Button("HOP##1"); ImGui::SameLine();
|
||||
ImGui::Text("Banana"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("Banana");
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::BulletText("Node");
|
||||
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##4");
|
||||
ImGui::Button("HOP##2"); ImGui::SameLine();
|
||||
ImGui::Text("Hello\nWorld"); ImGui::SameLine();
|
||||
ImGui::Text("Banana");
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
{
|
||||
ImGui::BulletText("Misc items:");
|
||||
ImGui::Indent();
|
||||
|
||||
// SmallButton() sets FramePadding to zero. Text baseline is aligned to match baseline of previous Button
|
||||
ImGui::Button("80x80", ImVec2(80, 80));
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("50x50", ImVec2(50, 50));
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("Button()");
|
||||
ImGui::SameLine();
|
||||
ImGui::SmallButton("SmallButton()");
|
||||
|
||||
// Tree
|
||||
const float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
||||
ImGui::Button("Button##1");
|
||||
ImGui::SameLine(0.0f, spacing);
|
||||
if (ImGui::TreeNode("Node##1")) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data
|
||||
|
||||
ImGui::AlignTextToFramePadding(); // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget. Otherwise you can use SmallButton (smaller fit).
|
||||
bool node_open = ImGui::TreeNode("Node##2");// Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add child content.
|
||||
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##2");
|
||||
if (node_open) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data
|
||||
|
||||
// Bullet
|
||||
ImGui::Button("Button##3");
|
||||
ImGui::SameLine(0.0f, spacing);
|
||||
ImGui::BulletText("Bullet text");
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::BulletText("Node");
|
||||
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##4");
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.73
|
||||
// dear imgui, v1.74 WIP
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.73
|
||||
// dear imgui, v1.74 WIP
|
||||
// (internal structures/api)
|
||||
|
||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||
@ -395,6 +395,7 @@ enum ImGuiSeparatorFlags_
|
||||
// This is going to be exposed in imgui.h when stabilized enough.
|
||||
enum ImGuiItemFlags_
|
||||
{
|
||||
ImGuiItemFlags_None = 0,
|
||||
ImGuiItemFlags_NoTabStop = 1 << 0, // false
|
||||
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
||||
ImGuiItemFlags_Disabled = 1 << 2, // false // [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211
|
||||
@ -1050,8 +1051,9 @@ struct ImGuiContext
|
||||
bool ActiveIdHasBeenPressedBefore; // Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.
|
||||
bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state.
|
||||
bool ActiveIdHasBeenEditedThisFrame;
|
||||
int ActiveIdAllowNavDirFlags; // Active widget allows using directional navigation (e.g. can activate a button and move away from it)
|
||||
int ActiveIdBlockNavInputFlags;
|
||||
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those directional navigation requests (e.g. can activate a button and move away from it)
|
||||
ImU32 ActiveIdUsingNavInputMask; // Active widget will want to read those nav inputs.
|
||||
ImU64 ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
|
||||
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
||||
ImGuiWindow* ActiveIdWindow;
|
||||
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
|
||||
@ -1253,8 +1255,9 @@ struct ImGuiContext
|
||||
ActiveIdHasBeenPressedBefore = false;
|
||||
ActiveIdHasBeenEditedBefore = false;
|
||||
ActiveIdHasBeenEditedThisFrame = false;
|
||||
ActiveIdAllowNavDirFlags = 0x00;
|
||||
ActiveIdBlockNavInputFlags = 0x00;
|
||||
ActiveIdUsingNavDirMask = 0x00;
|
||||
ActiveIdUsingNavInputMask = 0x00;
|
||||
ActiveIdUsingKeyInputMask = 0x00;
|
||||
ActiveIdClickOffset = ImVec2(-1,-1);
|
||||
ActiveIdWindow = NULL;
|
||||
ActiveIdSource = ImGuiInputSource_None;
|
||||
@ -1741,8 +1744,8 @@ namespace ImGui
|
||||
IMGUI_API void PushOverrideID(ImGuiID id);
|
||||
|
||||
// Basic Helpers for widget code
|
||||
IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);
|
||||
IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f);
|
||||
IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = 0.0f);
|
||||
IMGUI_API void ItemSize(const ImRect& bb, float text_baseline_y = 0.0f);
|
||||
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL);
|
||||
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
||||
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
||||
@ -1786,9 +1789,13 @@ namespace ImGui
|
||||
IMGUI_API void SetNavIDWithRectRel(ImGuiID id, int nav_layer, const ImRect& rect_rel);
|
||||
|
||||
// Inputs
|
||||
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
||||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
||||
inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }
|
||||
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsingKeyInputMask & ((ImU64)1 << key)) != 0; }
|
||||
IMGUI_API bool IsMouseDragPastThreshold(int button, float lock_threshold = -1.0f);
|
||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { const int key_index = GImGui->IO.KeyMap[key]; return (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; }
|
||||
inline bool IsNavInputDown(ImGuiNavInput n) { return GImGui->IO.NavInputs[n] > 0.0f; }
|
||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { ImGuiContext& g = *GImGui; const int key_index = g.IO.KeyMap[key]; return (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; }
|
||||
inline bool IsNavInputDown(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; }
|
||||
inline bool IsNavInputPressed(ImGuiNavInput n, ImGuiInputReadMode mode) { return GetNavInputAmount(n, mode) > 0.0f; }
|
||||
inline bool IsNavInputPressedAnyOfTwo(ImGuiNavInput n1, ImGuiNavInput n2, ImGuiInputReadMode mode) { return (GetNavInputAmount(n1, mode) + GetNavInputAmount(n2, mode)) > 0.0f; }
|
||||
|
||||
@ -1946,7 +1953,8 @@ namespace ImGui
|
||||
IMGUI_API void ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp);
|
||||
|
||||
// Debug Tools
|
||||
inline void DebugStartItemPicker() { GImGui->DebugItemPickerActive = true; }
|
||||
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(window->DC.LastItemRect.Min, window->DC.LastItemRect.Max, col); }
|
||||
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
||||
|
||||
} // namespace ImGui
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.73
|
||||
// dear imgui, v1.74 WIP
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@ -112,6 +112,7 @@ static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const
|
||||
//-------------------------------------------------------------------------
|
||||
// [SECTION] Widgets: Text, etc.
|
||||
//-------------------------------------------------------------------------
|
||||
// - TextEx() [Internal]
|
||||
// - TextUnformatted()
|
||||
// - Text()
|
||||
// - TextV()
|
||||
@ -557,7 +558,6 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
SetActiveID(id, window);
|
||||
if ((nav_activated_by_code || nav_activated_by_inputs) && !(flags & ImGuiButtonFlags_NoNavFocus))
|
||||
SetFocusID(id, window);
|
||||
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right) | (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2100,7 +2100,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* v, floa
|
||||
SetActiveID(id, window);
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||
g.ActiveIdUsingNavDirMask = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
|
||||
if (focus_requested || (clicked && g.IO.KeyCtrl) || double_clicked || g.NavInputId == id)
|
||||
{
|
||||
temp_input_start = true;
|
||||
@ -2437,7 +2437,7 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
||||
FLOATTYPE v_new_off_f = (v_max - v_min) * clicked_t;
|
||||
TYPE v_new_off_floor = (TYPE)(v_new_off_f);
|
||||
TYPE v_new_off_round = (TYPE)(v_new_off_f + (FLOATTYPE)0.5);
|
||||
if (!is_decimal && v_new_off_floor < v_new_off_round)
|
||||
if (v_new_off_floor < v_new_off_round)
|
||||
v_new = v_min + v_new_off_round;
|
||||
else
|
||||
v_new = v_min + v_new_off_floor;
|
||||
@ -2549,7 +2549,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* v, co
|
||||
SetActiveID(id, window);
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
|
||||
if (focus_requested || (clicked && g.IO.KeyCtrl) || g.NavInputId == id)
|
||||
{
|
||||
temp_input_start = true;
|
||||
@ -2703,7 +2703,7 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d
|
||||
SetActiveID(id, window);
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
|
||||
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||
}
|
||||
|
||||
// Draw frame
|
||||
@ -3512,12 +3512,17 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
SetActiveID(id, window);
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
|
||||
// Declare our inputs
|
||||
IM_ASSERT(ImGuiNavInput_COUNT < 32);
|
||||
g.ActiveIdBlockNavInputFlags = (1 << ImGuiNavInput_Cancel);
|
||||
if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory))
|
||||
g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||
g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);
|
||||
g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_Home) | ((ImU64)1 << ImGuiKey_End);
|
||||
if (is_multiline)
|
||||
g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_PageUp) | ((ImU64)1 << ImGuiKey_PageDown); // FIXME-NAV: Page up/down actually not supported yet by widget, but claim them ahead.
|
||||
if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) // Disable keyboard tabbing out as we will use the \t character.
|
||||
g.ActiveIdBlockNavInputFlags |= (1 << ImGuiNavInput_KeyTab_);
|
||||
if (!is_multiline && !(flags & ImGuiInputTextFlags_CallbackHistory))
|
||||
g.ActiveIdAllowNavDirFlags = ((1 << ImGuiDir_Up) | (1 << ImGuiDir_Down));
|
||||
g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_Tab);
|
||||
}
|
||||
|
||||
// We have an edge case if ActiveId was set through another widget (e.g. widget being swapped), clear id immediately (don't wait until the end of the function)
|
||||
@ -5275,9 +5280,11 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
{
|
||||
if (pressed)
|
||||
{
|
||||
const float arrow_x1 = text_pos.x - text_offset_x;
|
||||
const float arrow_x2 = arrow_x1 + g.FontSize + padding.x * 2.0f;
|
||||
toggled = !(flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)) || (g.NavActivateId == id);
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnArrow)
|
||||
toggled |= IsMouseHoveringRect(interact_bb.Min, ImVec2(interact_bb.Min.x + text_offset_x, interact_bb.Max.y)) && (!g.NavDisableMouseHover);
|
||||
toggled |= IsMouseHoveringRect(ImVec2(arrow_x1, interact_bb.Min.y), ImVec2(arrow_x2, interact_bb.Max.y)) && (!g.NavDisableMouseHover);
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||
toggled |= g.IO.MouseDoubleClicked[0];
|
||||
if (g.DragDropActive && is_open) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again.
|
||||
|
@ -1,5 +1,5 @@
|
||||
----------------------------------------------------------------------
|
||||
dear imgui, v1.73
|
||||
dear imgui, v1.74 WIP
|
||||
----------------------------------------------------------------------
|
||||
misc/fonts/README.txt
|
||||
This is the Readme dedicated to fonts.
|
||||
|
Loading…
Reference in New Issue
Block a user