mirror of
https://github.com/ocornut/imgui.git
synced 2026-07-27 02:56:37 +00:00
Docs: rework FAQ index, added multi-threading and string-view details.
This commit is contained in:
@@ -117,7 +117,7 @@ If you are not sure which backend to use, the recommended platform/frameworks fo
|
||||
| GLFW | https://github.com/glfw/glfw | imgui_impl_glfw.cpp | |
|
||||
| Sokol | https://github.com/floooh/sokol | [util/sokol_imgui.h](https://github.com/floooh/sokol/blob/master/util/sokol_imgui.h) | Lower-level than GLFW/SDL |
|
||||
|
||||
If your application runs on Windows or if you are using multi-viewport, the win32 backend handles some details a little better than other backends.
|
||||
If your application runs on Windows or if you are using multi-viewports, the imgui_impl_win32 backend handles some details better than other backends.
|
||||
|
||||
## Using third-party Backends
|
||||
|
||||
|
||||
105
docs/FAQ.md
105
docs/FAQ.md
@@ -9,42 +9,58 @@ or view this file with any Markdown viewer.
|
||||
|
||||
## Index
|
||||
|
||||
| **Q&A: Basics** |
|
||||
:---------------------------------------------------------- |
|
||||
| [Where is the documentation?](#q-where-is-the-documentation) |
|
||||
| [What is this library called?](#q-what-is-this-library-called) |
|
||||
| [What is the difference between Dear ImGui and traditional UI toolkits?](#q-what-is-the-difference-between-dear-imgui-and-traditional-ui-toolkits) |
|
||||
| [Which version should I get?](#q-which-version-should-i-get) |
|
||||
| **Q&A: Integration** |
|
||||
| **[How to get started?](#q-how-to-get-started)** |
|
||||
| **[How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?](#q-how-can-i-tell-whether-to-dispatch-mousekeyboard-to-dear-imgui-or-my-application)** |
|
||||
| [How can I enable keyboard or gamepad controls?](#q-how-can-i-enable-keyboard-or-gamepad-controls) |
|
||||
| [How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)](#q-how-can-i-use-this-on-a-machine-without-mouse-keyboard-or-screen-input-share-remote-display) |
|
||||
| [How can I create my own backend?](#q-how-can-i-create-my-own-backend)
|
||||
| [I integrated Dear ImGui in my engine and little squares are showing instead of text...](#q-i-integrated-dear-imgui-in-my-engine-and-little-squares-are-showing-instead-of-text) |
|
||||
| [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) |
|
||||
| [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) |
|
||||
| **Q&A: Usage** |
|
||||
| **[About the ID Stack system...](#q-about-the-id-stack-system)**<br>**[How can I have multiple widgets with the same label?](#q-how-can-i-have-multiple-widgets-with-the-same-label) (using `##` or `PushID()`)**<br>**[How can I have widgets with an empty label?](#q-how-can-i-have-widgets-with-an-empty-label) (using `##`)**<br>**[How can I make a label dynamic?](#q-how-can-i-make-a-label-dynamic) (using `###`)**<br>**[General description of the label and ID Stack system.](#general-description-of-the-label-and-id-stack-system)** |
|
||||
| [How can I display an image?](#q-how-can-i-display-an-image)<br>[What are ImTextureID/ImTextureRef?](#q-what-are-imtextureidimtextureref)|
|
||||
| [How can I use maths operators with ImVec2?](#q-how-can-i-use-maths-operators-with-imvec2) |
|
||||
| [How can I use my own maths types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-maths-types-instead-of-imvec2imvec4) |
|
||||
| [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-stdstring-and-stdvector) |
|
||||
| [How can I display custom shapes? (using low-level ImDrawList API)](#q-how-can-i-display-custom-shapes-using-low-level-imdrawlist-api) |
|
||||
| **Q&A: Fonts, Text** |
|
||||
| [How should I handle DPI in my application?](#q-how-should-i-handle-dpi-in-my-application) |
|
||||
| [How can I load a different font than the default?](#q-how-can-i-load-a-different-font-than-the-default) |
|
||||
| [How can I easily use icons in my application?](#q-how-can-i-easily-use-icons-in-my-application) |
|
||||
| [How can I load multiple fonts?](#q-how-can-i-load-multiple-fonts) |
|
||||
| [How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?](#q-how-can-i-display-and-input-non-latin-characters-such-as-chinese-japanese-korean-cyrillic) |
|
||||
| **Q&A: Concerns** |
|
||||
| [Who uses Dear ImGui?](#q-who-uses-dear-imgui) |
|
||||
| [Can you create elaborate/serious tools with Dear ImGui?](#q-can-you-create-elaborateserious-tools-with-dear-imgui) |
|
||||
| [Can you reskin the look of Dear ImGui?](#q-can-you-reskin-the-look-of-dear-imgui) |
|
||||
| [Why using C++ (as opposed to C)?](#q-why-using-c-as-opposed-to-c) |
|
||||
| **Q&A: Community** |
|
||||
| [How can I help?](#q-how-can-i-help) |
|
||||
### Basics
|
||||
|
||||
- [Where is the documentation?](#q-where-is-the-documentation)
|
||||
- [What is this library called?](#q-what-is-this-library-called)
|
||||
- [What is the difference between Dear ImGui and traditional UI toolkits?](#q-what-is-the-difference-between-dear-imgui-and-traditional-ui-toolkits)
|
||||
- [Which version should I get?](#q-which-version-should-i-get)
|
||||
|
||||
### Integration
|
||||
|
||||
- **[How to get started?](#q-how-to-get-started)**
|
||||
- **[How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?](#q-how-can-i-tell-whether-to-dispatch-mousekeyboard-to-dear-imgui-or-my-application)**
|
||||
- [How can I enable keyboard or gamepad controls?](#q-how-can-i-enable-keyboard-or-gamepad-controls)
|
||||
- [How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)](#q-how-can-i-use-this-on-a-machine-without-mouse-keyboard-or-screen-input-share-remote-display)
|
||||
- [How can I create my own backend?](#q-how-can-i-create-my-own-backend)
|
||||
- [I integrated Dear ImGui in my engine and little squares are showing instead of text...](#q-i-integrated-dear-imgui-in-my-engine-and-little-squares-are-showing-instead-of-text)
|
||||
- [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around)
|
||||
- [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries)
|
||||
|
||||
### Usage
|
||||
|
||||
- **[About the ID Stack system...](#q-about-the-id-stack-system)**
|
||||
- **[How can I have multiple widgets with the same label?](#q-how-can-i-have-multiple-widgets-with-the-same-label) (using `##` or `PushID()`)**
|
||||
- **[How can I have widgets with an empty label?](#q-how-can-i-have-widgets-with-an-empty-label) (using `##`)**
|
||||
- **[How can I make a label dynamic?](#q-how-can-i-make-a-label-dynamic) (using `###`)**
|
||||
- **[General description of the label and ID Stack system.](#general-description-of-the-label-and-id-stack-system)**
|
||||
- [How can I display an image?](#q-how-can-i-display-an-image), [What are ImTextureID/ImTextureRef?](#q-what-are-imtextureidimtextureref)
|
||||
- [How can I use maths operators with ImVec2?](#q-how-can-i-use-maths-operators-with-imvec2)
|
||||
- [How can I use my own maths types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-maths-types-instead-of-imvec2imvec4)
|
||||
- [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-stdstring-and-stdvector)
|
||||
- [How can I display custom shapes? (using low-level ImDrawList API)](#q-how-can-i-display-custom-shapes-using-low-level-imdrawlist-api)
|
||||
- [About Multi-Threading](#about-multi-threading)
|
||||
|
||||
### Fonts, Text
|
||||
|
||||
- [How should I handle DPI in my application?](#q-how-should-i-handle-dpi-in-my-application)
|
||||
- [How can I load a different font than the default?](#q-how-can-i-load-a-different-font-than-the-default)
|
||||
- [How can I easily use icons in my application?](#q-how-can-i-easily-use-icons-in-my-application)
|
||||
- [How can I load multiple fonts?](#q-how-can-i-load-multiple-fonts)
|
||||
- [How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?](#q-how-can-i-display-and-input-non-latin-characters-such-as-chinese-japanese-korean-cyrillic)
|
||||
|
||||
### Concerns
|
||||
|
||||
- [Who uses Dear ImGui?](#q-who-uses-dear-imgui)
|
||||
- [Can you create elaborate/serious tools with Dear ImGui?](#q-can-you-create-elaborateserious-tools-with-dear-imgui)
|
||||
- [Can you reskin the look of Dear ImGui?](#q-can-you-reskin-the-look-of-dear-imgui)
|
||||
- [Why using C++ (as opposed to C)?](#q-why-using-c-as-opposed-to-c)
|
||||
|
||||
### Community
|
||||
|
||||
- [How can I help?](#q-how-can-i-help)
|
||||
|
||||
--------
|
||||
|
||||
# Q&A: Basics
|
||||
|
||||
@@ -667,6 +683,7 @@ This way you will be able to use your own types everywhere, e.g. passing `MyVect
|
||||
---
|
||||
|
||||
### Q: How can I interact with standard C++ types (such as std::string and std::vector)?
|
||||
|
||||
- Being highly portable (backends/bindings for several languages, frameworks, programming styles, obscure or older platforms/compilers), and aiming for compatibility & performance suitable for every modern real-time game engine, 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 combo boxes and list boxes with `std::vector` or any other data structure: the `BeginCombo()/EndCombo()` API
|
||||
@@ -686,6 +703,10 @@ One possible implementation of a helper to facilitate printf-style building of s
|
||||
This is a small helper where you can instance strings with configurable local buffers length. Many game engines will
|
||||
provide similar or better string helpers.
|
||||
|
||||
Using string views:
|
||||
|
||||
- String view types such as `std::string_view` may be used with the [feature/string_view](https://github.com/ocornut/imgui/tree/features/string_view) branch. This branch is actively maintained and supported. Please provide feedback if you use it. We are waiting for a good moment to merge it.
|
||||
|
||||
##### [Return to Index](#index)
|
||||
|
||||
---
|
||||
@@ -726,6 +747,20 @@ ImGui::End();
|
||||
|
||||
---
|
||||
|
||||
### About Multi-Threading
|
||||
|
||||
A same Dear ImGui context may be not used from multiple threads in parallel.
|
||||
|
||||
If you want to use a same context within parallel tasks for occasional debug purpose, consider using a lock.
|
||||
|
||||
If you want to submit contents from a main/update thread but render Dear ImGui output in a dedicated render thread, you'll need to stage `ImDrawData` and texture requests. See the `ImDrawDataSnapshot` and `ImTextureQueue` helpers in [imgui_threaded_rendering](https://github.com/ocornut/imgui_club#imgui_threaded_rendering). Also see topics with [label: multi-threading](https://github.com/ocornut/imgui/issues?q=label%3Amulti-threading).
|
||||
|
||||
If you use multiple Dear ImGui contexts and want to use them from multiple threads, you need to `#define GImGui` to become a TLS variable (see details near the definition of `GImGui`. If you need to display multiple contexts simultaneously, consider using [imgui_multicontext_compositor](https://github.com/ocornut/imgui_club#imgui_multicontext_compositor). Also see topics with [label: multi-contexts](https://github.com/ocornut/imgui/issues?q=label%3Amulti-contexts).
|
||||
|
||||
There is a script/patch to make the API take an explicit context pointer: [#5856](https://github.com/ocornut/imgui/pull/5856). It is presently unmaintained and likely to easy to update. It has been decided that the change is not currently worth applying to main-line but maybe will be in a future version.
|
||||
|
||||
---
|
||||
|
||||
# Q&A: Fonts, Text
|
||||
|
||||
### Q: How should I handle DPI in my application?
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
||||
// This library is free but needs your support to sustain development and maintenance.
|
||||
// Businesses: you can support continued development via B2B invoiced technical support, maintenance and sponsoring contracts.
|
||||
// PLEASE reach out at omar AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Funding
|
||||
// PLEASE reach out at omar AT discohello DOT com. See https://github.com/ocornut/imgui/wiki/Funding
|
||||
// Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
||||
|
||||
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
||||
@@ -1198,6 +1198,7 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
Q: How can I use my own math types instead of ImVec2?
|
||||
Q: How can I interact with standard C++ types (such as std::string and std::vector)?
|
||||
Q: How can I display custom shapes? (using low-level ImDrawList API)
|
||||
Q: About Multi-Threading
|
||||
>> See https://www.dearimgui.com/faq
|
||||
|
||||
Q&A: Fonts, Text
|
||||
@@ -1223,7 +1224,7 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
==============
|
||||
|
||||
Q: How can I help?
|
||||
A: - Businesses: please reach out to "omar AT dearimgui DOT com" if you work in a place using Dear ImGui!
|
||||
A: - Businesses: please reach out to "omar AT discohello DOT com" 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 sustain and grow work on this project.
|
||||
>>> See https://github.com/ocornut/imgui/wiki/Funding
|
||||
|
||||
Reference in New Issue
Block a user