| 353 | } |
| 354 | |
| 355 | void ImGui_ImplWin32_NewFrame() |
| 356 | { |
| 357 | ImGuiIO& io = ImGui::GetIO(); |
| 358 | ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData(); |
| 359 | IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplWin32_Init()?"); |
| 360 | |
| 361 | // Setup display size (every frame to accommodate for window resizing) |
| 362 | RECT rect = { 0, 0, 0, 0 }; |
| 363 | ::GetClientRect(bd->hWnd, &rect); |
| 364 | io.DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top)); |
| 365 | |
| 366 | // Setup time step |
| 367 | INT64 current_time = 0; |
| 368 | ::QueryPerformanceCounter((LARGE_INTEGER*)¤t_time); |
| 369 | io.DeltaTime = (float)(current_time - bd->Time) / bd->TicksPerSecond; |
| 370 | bd->Time = current_time; |
| 371 | |
| 372 | // Update OS mouse position |
| 373 | ImGui_ImplWin32_UpdateMouseData(); |
| 374 | |
| 375 | // Process workarounds for known Windows key handling issues |
| 376 | ImGui_ImplWin32_ProcessKeyEventsWorkarounds(); |
| 377 | |
| 378 | // Update OS mouse cursor with the cursor requested by imgui |
| 379 | ImGuiMouseCursor mouse_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor(); |
| 380 | if (bd->LastMouseCursor != mouse_cursor) |
| 381 | { |
| 382 | bd->LastMouseCursor = mouse_cursor; |
| 383 | ImGui_ImplWin32_UpdateMouseCursor(); |
| 384 | } |
| 385 | |
| 386 | // Update game controllers (if enabled and available) |
| 387 | ImGui_ImplWin32_UpdateGamepads(); |
| 388 | } |
| 389 | |
| 390 | // There is no distinct VK_xxx for keypad enter, instead it is VK_RETURN + KF_EXTENDED, we assign it an arbitrary value to make code more readable (VK_ codes go up to 255) |
| 391 | #define IM_VK_KEYPAD_ENTER (VK_RETURN + 256) |
no test coverage detected