Updated Quickstart (markdown)

omar 2023-06-30 18:12:11 +02:00
parent ffff75dcb2
commit 5dfea66610

@ -24,6 +24,7 @@ If you already have an app running by definition you shouldn't have this problem
- (6) End of main loop: call `ImGui::Render()` + call Render function of Rendering backend. - (6) End of main loop: call `ImGui::Render()` + call Render function of Rendering backend.
- (7) Most backends requires extra steps to hook or forward events. - (7) Most backends requires extra steps to hook or forward events.
- (8) Shutdown backends, destroy Dear ImGui context with `ImGui::DestroyContext()`. - (8) Shutdown backends, destroy Dear ImGui context with `ImGui::DestroyContext()`.
- (9) In your application input logic: you can poll `ImGui::GetIO().WantCaptureMouse`/`WantCaptureKeyboard` to tell if Dear ImGui wants to obstruct mouse/keyboard inputs from underlying apps. e.g. when hovering a window WantCaptureMouse will be set to true.
## Example: If you are using Raw Win32 API + DirectX11 ## Example: If you are using Raw Win32 API + DirectX11
@ -52,7 +53,6 @@ ImGui_ImplDX11_Init(YOUR_D3D_DEVICE, YOUR_D3D_DEVICE_CONTEXT);
Add to start of main loop: Add to start of main loop:
```cpp ```cpp
// (Your code process and dispatch Win32 messages) // (Your code process and dispatch Win32 messages)
...
// Start the Dear ImGui frame // Start the Dear ImGui frame
ImGui_ImplDX11_NewFrame(); ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame(); ImGui_ImplWin32_NewFrame();
@ -72,6 +72,7 @@ Add to your WndProc handler:
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam)) if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
return true; return true;
(Your code process Windows messages. Read from `ImGui::GetIO().WantCaptureMouse`/`WantCaptureKeyboard` to tell if Dear ImGui should obstruct mouse/keyboard from your underlying application)
``` ```
Add to Shutdown: Add to Shutdown:
```cpp ```cpp