mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 04:58:47 +02:00
Docs: FAQ, Comments.
This commit is contained in:
59
imgui.cpp
59
imgui.cpp
@ -1,12 +1,19 @@
|
||||
// dear imgui, v1.75 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
||||
// Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase.
|
||||
// Get latest version at https://github.com/ocornut/imgui
|
||||
// Releases change-log at https://github.com/ocornut/imgui/releases
|
||||
// Technical Support for Getting Started https://github.com/ocornut/imgui/wiki
|
||||
// Gallery (please post your screenshots/video there!): https://github.com/ocornut/imgui/issues/2847
|
||||
// Help:
|
||||
// - Read FAQ at http://dearimgui.org/faq
|
||||
// - Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase.
|
||||
// - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code. All applications in examples/ are doing that.
|
||||
|
||||
// Resources:
|
||||
// - FAQ http://dearimgui.org/faq
|
||||
// - Homepage & latest https://github.com/ocornut/imgui
|
||||
// - Releases & changelog https://github.com/ocornut/imgui/releases
|
||||
// - Gallery https://github.com/ocornut/imgui/issues/2847 (please post your screenshots/video there!)
|
||||
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
||||
// - Wiki https://github.com/ocornut/imgui/wiki
|
||||
// - Issues & support https://github.com/ocornut/imgui/issues
|
||||
|
||||
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
|
||||
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
||||
@ -155,8 +162,9 @@ CODE
|
||||
GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE
|
||||
---------------------------------------------------------------
|
||||
- Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library.
|
||||
- In the majority of cases you should be able to use unmodified back-ends files available in the examples/ folder.
|
||||
- Add the Dear ImGui source files to your projects or using your preferred build system.
|
||||
It is recommended you build and statically link the .cpp files as part of your project and not as shared library (DLL).
|
||||
It is recommended you build and statically link the .cpp files as part of your project and NOT as shared library (DLL).
|
||||
- You can later customize the imconfig.h file to tweak some compile-time behavior, such as integrating Dear ImGui types with your own maths types.
|
||||
- When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them.
|
||||
- Dear ImGui never touches or knows about your GPU state. The only function that knows about GPU is the draw function that you provide.
|
||||
@ -176,7 +184,7 @@ CODE
|
||||
// TODO: Fill optional fields of the io structure later.
|
||||
// TODO: Load TTF/OTF fonts if you don't want to use the default font.
|
||||
|
||||
// Initialize helper Platform and Renderer bindings (here we are using imgui_impl_win32 and imgui_impl_dx11)
|
||||
// Initialize helper Platform and Renderer bindings (here we are using imgui_impl_win32.cpp and imgui_impl_dx11.cpp)
|
||||
ImGui_ImplWin32_Init(hwnd);
|
||||
ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);
|
||||
|
||||
@ -597,37 +605,17 @@ CODE
|
||||
- Your programming IDE is your friend, find the type or function declaration to find comments
|
||||
associated to it.
|
||||
|
||||
Q: What is this library called?
|
||||
Q: Which version should I get?
|
||||
Q: Why the names "Dear ImGui" vs "ImGui"?
|
||||
>> This library is called "Dear ImGui", please don't call it "ImGui" :)
|
||||
>> See https://www.dearimgui.org/faq
|
||||
|
||||
Q&A: Concerns
|
||||
=============
|
||||
|
||||
Q: Who uses Dear ImGui?
|
||||
Q: Can you create elaborate/serious tools with Dear ImGui?
|
||||
Q: Can you reskin the look of Dear ImGui?
|
||||
Q: Why using C++ (as opposed to C)?
|
||||
>> See https://www.dearimgui.org/faq
|
||||
|
||||
Q&A: Integration
|
||||
================
|
||||
|
||||
Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or to my application?
|
||||
A: You can read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags from the ImGuiIO structure (e.g. if (ImGui::GetIO().WantCaptureMouse) { ... } )
|
||||
- When 'io.WantCaptureMouse' is set, imgui wants to use your mouse state, and you may want to discard/hide the inputs from the rest of your application.
|
||||
- When 'io.WantCaptureKeyboard' is set, imgui wants to use your keyboard state, and you may want to discard/hide the inputs from the rest of your application.
|
||||
- When 'io.WantTextInput' is set to may want to notify your OS to popup an on-screen keyboard, if available (e.g. on a mobile phone, or console OS).
|
||||
Note: you should always pass your mouse/keyboard inputs to imgui, even when the io.WantCaptureXXX flag are set false.
|
||||
This is because imgui needs to detect that you clicked in the void to unfocus its own windows.
|
||||
Note: The 'io.WantCaptureMouse' is more accurate that any attempt to "check if the mouse is hovering a window" (don't do that!).
|
||||
It handle mouse dragging correctly (both dragging that started over your application or over an imgui window) and handle e.g. modal windows blocking inputs.
|
||||
Those flags are updated by ImGui::NewFrame(). Preferably read the flags after calling NewFrame() if you can afford it, but reading them before is also
|
||||
perfectly fine, as the bool toggle fairly rarely. If you have on a touch device, you might find use for an early call to UpdateHoveredWindowAndCaptureFlags().
|
||||
Note: Text input widget releases focus on "Return KeyDown", so the subsequent "Return KeyUp" event that your application receive will typically
|
||||
have 'io.WantCaptureKeyboard=false'. Depending on your application logic it may or not be inconvenient. You might want to track which key-downs
|
||||
were targeted for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.)
|
||||
A: You should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags!
|
||||
>> See https://www.dearimgui.org/faq for fully detailed answer. You really want to read this.
|
||||
|
||||
Q. How can I enable keyboard controls?
|
||||
Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)
|
||||
@ -771,6 +759,15 @@ CODE
|
||||
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
||||
>> See https://www.dearimgui.org/faq and docs/FONTS.txt
|
||||
|
||||
Q&A: Concerns
|
||||
=============
|
||||
|
||||
Q: Who uses Dear ImGui?
|
||||
Q: Can you create elaborate/serious tools with Dear ImGui?
|
||||
Q: Can you reskin the look of Dear ImGui?
|
||||
Q: Why using C++ (as opposed to C)?
|
||||
>> See https://www.dearimgui.org/faq
|
||||
|
||||
Q&A: Community
|
||||
==============
|
||||
|
||||
|
Reference in New Issue
Block a user