mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Comments about io.WantCapture flags + todo entries.
This commit is contained in:
parent
ac2027c415
commit
c1bdab6d5b
5
TODO.txt
5
TODO.txt
@ -249,6 +249,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- nav: cannot access menubar of a flattened child window with Alt/menu key (not a very common use case..).
|
||||
- nav: esc/enter default behavior for popups, e.g. be able to mark an "ok" or "cancel" button that would get triggered by those keys.
|
||||
- nav: when activating a button that changes label (without a static ID) or disappear, can we somehow automatically recover into a nearest highlight item?
|
||||
- nav: there's currently no way to completely clear focus with the keyboard. depending on patterns used by the application to dispatch inputs, it may be desirable.
|
||||
- nav: configuration flag to disable global shortcuts (currently only CTRL-tab) ?
|
||||
- focus: preserve ActiveId/focus stack state, e.g. when opening a menu and close it, previously selected InputText() focus gets restored (#622)
|
||||
- focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame)
|
||||
- focus: unable to use SetKeyboardFocusHere() on clipped widgets. (#787)
|
||||
@ -263,6 +265,9 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- misc: fix for compilation settings where stdcall isn't the default (e.g. vectorcall) (#1230)
|
||||
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
||||
|
||||
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
|
||||
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
|
||||
|
||||
- remote: make a system like RemoteImGui first-class citizen/project (#75)
|
||||
|
||||
- demo: add vertical separator demo
|
||||
|
22
imgui.cpp
22
imgui.cpp
@ -214,9 +214,9 @@
|
||||
}
|
||||
|
||||
- The examples/ folders contains many functional implementation of the pseudo-code above.
|
||||
- When calling NewFrame(), the 'io.WantCaptureMouse'/'io.WantCaptureKeyboard'/'io.WantTextInput' flags are updated.
|
||||
They tell you if ImGui intends to use your inputs. So for example, if 'io.WantCaptureMouse' is set you would typically want to hide
|
||||
mouse inputs from the rest of your application. Read the FAQ below for more information about those flags.
|
||||
- When calling NewFrame(), the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags are updated.
|
||||
They tell you if ImGui intends to use your inputs. When a flag is set you want to hide the corresponding inputs from the rest of your application.
|
||||
However, in both cases you need to pass on the inputs to imgui. Read the FAQ below for more information about those flags.
|
||||
- Please read the FAQ above. Amusingly, it is called a FAQ because people frequently have the same issues!
|
||||
|
||||
USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS [BETA]
|
||||
@ -420,17 +420,19 @@
|
||||
======================================
|
||||
|
||||
Q: How can I tell whether to dispatch mouse/keyboard to imgui or to my application?
|
||||
A: You can read the 'io.WantCaptureMouse'/'io.WantCaptureKeyboard'/'io.WantTextInput' flags from the ImGuiIO structure.
|
||||
A: You can read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags from the ImGuiIO structure.
|
||||
- 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).
|
||||
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.
|
||||
(Advanced note: text input releases focus on Return 'KeyDown', so the following Return 'KeyUp' event that your application receive will typically
|
||||
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 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 NewFrameUpdateHoveredWindowAndCaptureFlags().
|
||||
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 for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.)
|
||||
were targetted for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.)
|
||||
|
||||
Q: How can I display an image? What is ImTextureID, how does it works?
|
||||
A: ImTextureID is a void* used to pass renderer-agnostic texture references around until it hits your render function.
|
||||
|
4
imgui.h
4
imgui.h
@ -1073,8 +1073,8 @@ struct ImGuiIO
|
||||
// Output - Retrieve after calling NewFrame()
|
||||
//------------------------------------------------------------------
|
||||
|
||||
bool WantCaptureMouse; // When io.WantCaptureMouse is true, imgui will use the mouse inputs, do not dispatch them to your main game/application. (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.).
|
||||
bool WantCaptureKeyboard; // When io.WantCaptureKeyboard is true, imgui will use the keyboard inputs, do not dispatch them to your main game/application. (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.).
|
||||
bool WantCaptureMouse; // When io.WantCaptureMouse is true, imgui will use the mouse inputs, do not dispatch them to your main game/application (in both cases, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.).
|
||||
bool WantCaptureKeyboard; // When io.WantCaptureKeyboard is true, imgui will use the keyboard inputs, do not dispatch them to your main game/application (in both cases, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.).
|
||||
bool WantTextInput; // Mobile/console: when io.WantTextInput is true, you may display an on-screen keyboard. This is set by ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).
|
||||
bool WantSetMousePos; // MousePos has been altered, back-end should reposition mouse on next frame. Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled.
|
||||
bool NavActive; // Directional navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
|
||||
|
Loading…
Reference in New Issue
Block a user