You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/EXAMPLES.md
+48-44Lines changed: 48 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,56 +17,60 @@ You can find Windows binaries for some of those example applications at:
17
17
18
18
Integration in a typical existing application, should take <20 lines when using standard backends.
19
19
20
-
At initialization:
21
-
call ImGui::CreateContext()
22
-
call ImGui_ImplXXXX_Init() for each backend.
20
+
```cpp
21
+
At initialization:
22
+
call ImGui::CreateContext()
23
+
call ImGui_ImplXXXX_Init() for each backend.
23
24
24
-
At the beginning of your frame:
25
-
call ImGui_ImplXXXX_NewFrame() for each backend.
26
-
call ImGui::NewFrame()
25
+
At the beginning of your frame:
26
+
call ImGui_ImplXXXX_NewFrame() for each backend.
27
+
call ImGui::NewFrame()
27
28
28
-
At the end of your frame:
29
-
call ImGui::Render()
30
-
call ImGui_ImplXXXX_RenderDrawData() for your Renderer backend.
29
+
At the end of your frame:
30
+
call ImGui::Render()
31
+
call ImGui_ImplXXXX_RenderDrawData() for your Renderer backend.
31
32
32
-
At shutdown:
33
-
call ImGui_ImplXXXX_Shutdown() for each backend.
34
-
call ImGui::DestroyContext()
33
+
At shutdown:
34
+
call ImGui_ImplXXXX_Shutdown() for each backend.
35
+
call ImGui::DestroyContext()
36
+
```
35
37
36
38
Example (using [backends/imgui_impl_win32.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_win32.cpp) + [backends/imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)):
37
39
38
-
// Create a Dear ImGui context, setup some options
39
-
ImGui::CreateContext();
40
-
ImGuiIO& io = ImGui::GetIO();
41
-
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable some options
Copy file name to clipboardExpand all lines: imgui.cpp
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -400,7 +400,7 @@ CODE
400
400
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unecessary. 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.
401
401
- IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX)
402
402
- IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
403
-
- Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent()
403
+
- 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).
404
404
- Backend writing to io.KeyCtrl, io.KeyShift.. -> backend should call io.AddKeyEvent() with ImGuiKey_ModXXX values. *IF YOU PULLED CODE BETWEEN 2021/01/10 and 2021/01/27: We used to have a io.AddKeyModsEvent() function which was now replaced by io.AddKeyEvent() with ImGuiKey_ModXXX values.*
405
405
- one case won't work with backward compatibility: if your custom backend used ImGuiKey as mock native indices (e.g. "io.KeyMap[ImGuiKey_A] = ImGuiKey_A") because those values are now larger than the legacy KeyDown[] array. Will assert.
406
406
- inputs: added ImGuiKey_ModCtrl/ImGuiKey_ModShift/ImGuiKey_ModAlt/ImGuiKey_ModSuper values to submit keyboard modifiers using io.AddKeyEvent(), instead of writing directly to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper.
0 commit comments