MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / NavUpdate

Method NavUpdate

KBotExt/imgui/imgui.cpp:11359–11519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11357}
11358
11359static void ImGui::NavUpdate()
11360{
11361 ImGuiContext& g = *GImGui;
11362 ImGuiIO& io = g.IO;
11363
11364 io.WantSetMousePos = false;
11365 //if (g.NavScoringDebugCount > 0) IMGUI_DEBUG_LOG_NAV("[nav] NavScoringDebugCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.NavScoringDebugCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);
11366
11367 // Set input source based on which keys are last pressed (as some features differs when used with Gamepad vs Keyboard)
11368 // FIXME-NAV: Now that keys are separated maybe we can get rid of NavInputSource?
11369 const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
11370 const ImGuiKey nav_gamepad_keys_to_change_source[] = { ImGuiKey_GamepadFaceRight, ImGuiKey_GamepadFaceLeft, ImGuiKey_GamepadFaceUp, ImGuiKey_GamepadFaceDown, ImGuiKey_GamepadDpadRight, ImGuiKey_GamepadDpadLeft, ImGuiKey_GamepadDpadUp, ImGuiKey_GamepadDpadDown };
11371 if (nav_gamepad_active)
11372 for (ImGuiKey key : nav_gamepad_keys_to_change_source)
11373 if (IsKeyDown(key))
11374 g.NavInputSource = ImGuiInputSource_Gamepad;
11375 const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
11376 const ImGuiKey nav_keyboard_keys_to_change_source[] = { ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_RightArrow, ImGuiKey_LeftArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow };
11377 if (nav_keyboard_active)
11378 for (ImGuiKey key : nav_keyboard_keys_to_change_source)
11379 if (IsKeyDown(key))
11380 g.NavInputSource = ImGuiInputSource_Keyboard;
11381
11382 // Process navigation init request (select first/default focus)
11383 g.NavJustMovedToId = 0;
11384 if (g.NavInitResult.ID != 0)
11385 NavInitRequestApplyResult();
11386 g.NavInitRequest = false;
11387 g.NavInitRequestFromMove = false;
11388 g.NavInitResult.ID = 0;
11389
11390 // Process navigation move request
11391 if (g.NavMoveSubmitted)
11392 NavMoveRequestApplyResult();
11393 g.NavTabbingCounter = 0;
11394 g.NavMoveSubmitted = g.NavMoveScoringItems = false;
11395
11396 // Schedule mouse position update (will be done at the bottom of this function, after 1) processing all move requests and 2) updating scrolling)
11397 bool set_mouse_pos = false;
11398 if (g.NavMousePosDirty && g.NavIdIsAlive)
11399 if (!g.NavDisableHighlight && g.NavDisableMouseHover && g.NavWindow)
11400 set_mouse_pos = true;
11401 g.NavMousePosDirty = false;
11402 IM_ASSERT(g.NavLayer == ImGuiNavLayer_Main || g.NavLayer == ImGuiNavLayer_Menu);
11403
11404 // Store our return window (for returning from Menu Layer to Main Layer) and clear it as soon as we step back in our own Layer 0
11405 if (g.NavWindow)
11406 NavSaveLastChildNavWindowIntoParent(g.NavWindow);
11407 if (g.NavWindow && g.NavWindow->NavLastChildNavWindow != NULL && g.NavLayer == ImGuiNavLayer_Main)
11408 g.NavWindow->NavLastChildNavWindow = NULL;
11409
11410 // Update CTRL+TAB and Windowing features (hold Square to move/resize/etc.)
11411 NavUpdateWindowing();
11412
11413 // Set output flags for user application
11414 io.NavActive = (nav_keyboard_active || nav_gamepad_active) && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs);
11415 io.NavVisible = (io.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL);
11416

Callers

nothing calls this directly

Calls 4

ImFloorFunction · 0.85
GetForegroundDrawListFunction · 0.85
WindowRectRelToAbsFunction · 0.85
AddRectMethod · 0.80

Tested by

no test coverage detected