Added note about feedback + event handling

omar 2025-10-30 15:32:41 +01:00
parent 71032f5d35
commit 7a7d1f1b5e

@ -2,6 +2,7 @@ _(had to turn off wiki editing, see [Home](Home) for details. you may post meani
## Index
- [Feedback Wanted!](#feedback-wanted)
- [Preamble](#preamble)
- [Game Loop?](#game-loop)
- [Compiling/Linking](#compilinglinking)
@ -18,6 +19,11 @@ _(had to turn off wiki editing, see [Home](Home) for details. you may post meani
- [Additional code to enable Multi-viewports](#additional-code-to-enable-multi-viewports)
- [Once you are setup...](#once-you-are-setup)
## Feedback Wanted!
> [!IMPORTANT]
> After you are done setting up Dear ImGui in your application/project, please share _any feedback_ you may have in [#9040](https://github.com/ocornut/imgui/discussions/9040).<BR>Even if you made mistakes or created yourself a problem of your own, or misread a documentation: your feedback helps tweaking documentation for future users.
## Preamble
**This is a Tutorial for getting Dear ImGui integrated in your C++ application using our standard backends.**
@ -138,6 +144,7 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg
if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
return true;
// (Your code process Win32 messages)
// (You should discard mouse/keyboard messages in your game/engine when io.WantCaptureMouse/io.WantCaptureKeyboard are set.)
```
Add to Shutdown:
```cpp
@ -207,6 +214,7 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg
if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
return true;
(Your code process Windows messages.)
// (You should discard mouse/keyboard messages in your game/engine when io.WantCaptureMouse/io.WantCaptureKeyboard are set.)
```
Add to Shutdown:
```cpp
@ -264,6 +272,9 @@ ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
```
Event handling:
- You should discard mouse/keyboard messages in your game/engine when io.WantCaptureMouse/io.WantCaptureKeyboard are set.
That should be all!
## Example: If you are using GLFW + Metal (on Apple devices)
@ -314,6 +325,9 @@ ImGui_ImplMetal_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
```
Event handling:
- You should discard mouse/keyboard messages in your game/engine when io.WantCaptureMouse/io.WantCaptureKeyboard are set.
That should be all!
## Example: If you are using SDL2/SDL3 + OpenGL/WebGL
@ -347,6 +361,7 @@ Add to start of main loop:
```cpp
// (Where your code calls SDL_PollEvent())
ImGui_ImplSDL2_ProcessEvent(&event); // Forward your event to backend
// (You should discard mouse/keyboard messages in your game/engine when io.WantCaptureMouse/io.WantCaptureKeyboard are set.)
```
```cpp
// (After event loop)
@ -370,6 +385,7 @@ ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
```
That should be all!
## Example: If you are using SDL2/SDL3 + Vulkan
@ -434,6 +450,8 @@ Add to start of main loop:
```cpp
// (Where your code calls SDL_PollEvent())
ImGui_ImplSDL2_ProcessEvent(&event); // Forward your event to backend
// (You should discard mouse/keyboard messages in your game/engine when io.WantCaptureMouse/io.WantCaptureKeyboard are set.)
```
```cpp
// (After event loop)
@ -457,6 +475,7 @@ ImGui_ImplVulkan_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
```
That should be all!
## Example: If you are using SDL3 + SDL_GPU
@ -493,6 +512,7 @@ Add to start of main loop:
```cpp
// (Where your code calls SDL_PollEvent())
ImGui_ImplSDL3_ProcessEvent(&event); // Forward your event to backend
// (You should discard mouse/keyboard messages in your game/engine when io.WantCaptureMouse/io.WantCaptureKeyboard are set.)
```
```cpp
// (After event loop)