Skip to content

Commit a28ffa8

Browse files
committed
Docs: added more references to IsKeyDown(), InFlags. (#8317)
1 parent 1d96282 commit a28ffa8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

docs/CHANGELOG.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,12 @@ Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v
153153
Breaking changes:
154154

155155
- Commented out pre-1.87 IO system (equivalent to using IMGUI_DISABLE_OBSOLETE_KEYIO or IMGUI_DISABLE_OBSOLETE_FUNCTIONS before).
156-
- io.KeyMap[] and io.KeysDown[] are removed (obsoleted February 2022).
156+
- io.KeyMap[] and io.KeysDown[] are removed (obsoleted February 2022). Use IsKeyDown() instead.
157157
- io.NavInputs[] and ImGuiNavInput are removed (obsoleted July 2022).
158158
- Pre-1.87 backends are not supported:
159159
- backends need to call io.AddKeyEvent(), io.AddMouseEvent() instead of writing to io.KeysDown[], io.MouseDown[] fields.
160160
- backends need to call io.AddKeyAnalogEvent() for gamepad values instead of writing to io.NavInputs[] fields.
161+
- you can use IsKeyDown() instead of reading from io.KeysDown[].
161162
- For more references:
162163
- read 1.87 and 1.88 part of API BREAKING CHANGES in imgui.cpp or read Changelog for 1.87 and 1.88.
163164
- read https://github.com/ocornut/imgui/issues/4921
@@ -2390,6 +2391,7 @@ Breaking Changes:
23902391
- For all calls to IO new functions, the Dear ImGui context should be bound/current.
23912392
- Reworked IO keyboard input API: (#4921, #2625, #3724) [@thedmd, @ocornut]
23922393
- Added io.AddKeyEvent() function, obsoleting writing directly to io.KeyMap[], io.KeysDown[] arrays.
2394+
- You can use IsKeyDown() instead of reading from io.KeysDown[].
23932395
- For keyboard modifiers, you can call io.AddKeyEvent() with ImGuiKey_ModXXX values,
23942396
obsoleting writing directly to io.KeyCtrl, io.KeyShift etc.
23952397
- Added io.SetKeyEventNativeData() function (optional) to pass native and old legacy indices.

imgui.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ CODE
647647
- Backend writing to io.MouseHoveredViewport -> backend should call io.AddMouseViewportEvent() [Docking branch w/ multi-viewports only]
648648
note: for all calls to IO new functions, the Dear ImGui context should be bound/current.
649649
read https://github.com/ocornut/imgui/issues/4921 for details.
650-
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unnecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details.
650+
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(), ImGui::IsKeyDown(). Removed GetKeyIndex(), now unnecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details.
651651
- IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX)
652652
- IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
653653
- Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent() (+ call io.SetKeyEventNativeData() if you want legacy user code to stil function with legacy key codes).

imgui_internal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1247,11 +1247,11 @@ struct ImGuiNextItemData
12471247
struct ImGuiLastItemData
12481248
{
12491249
ImGuiID ID;
1250-
ImGuiItemFlags ItemFlags; // See ImGuiItemFlags_
1250+
ImGuiItemFlags ItemFlags; // See ImGuiItemFlags_ (called 'InFlags' before v1.91.4).
12511251
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
12521252
ImRect Rect; // Full rectangle
12531253
ImRect NavRect; // Navigation scoring rectangle (not displayed)
1254-
// Rarely used fields are not explicitly cleared, only valid when the corresponding ImGuiItemStatusFlags ar set.
1254+
// Rarely used fields are not explicitly cleared, only valid when the corresponding ImGuiItemStatusFlags are set.
12551255
ImRect DisplayRect; // Display rectangle. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasDisplayRect) is set.
12561256
ImRect ClipRect; // Clip rectangle at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasClipRect) is set..
12571257
ImGuiKeyChord Shortcut; // Shortcut at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasShortcut) is set..

0 commit comments

Comments
 (0)