MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / NavUpdateCreateMoveRequest

Method NavUpdateCreateMoveRequest

Dependencies/ImGui/src/imgui.cpp:14651–14773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14649}
14650
14651void ImGui::NavUpdateCreateMoveRequest()
14652{
14653 ImGuiContext& g = *GImGui;
14654 ImGuiIO& io = g.IO;
14655 ImGuiWindow* window = g.NavWindow;
14656 const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
14657 const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
14658
14659 if (g.NavMoveForwardToNextFrame && window != NULL)
14660 {
14661 // Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window)
14662 // (preserve most state, which were already set by the NavMoveRequestForward() function)
14663 IM_ASSERT(g.NavMoveDir != ImGuiDir_None && g.NavMoveClipDir != ImGuiDir_None);
14664 IM_ASSERT(g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded);
14665 IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestForward %d\n", g.NavMoveDir);
14666 }
14667 else
14668 {
14669 // Initiate directional inputs request
14670 g.NavMoveDir = ImGuiDir_None;
14671 g.NavMoveFlags = ImGuiNavMoveFlags_None;
14672 g.NavMoveScrollFlags = ImGuiScrollFlags_None;
14673 if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs))
14674 {
14675 const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateNavMove;
14676 if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadLeft, repeat_mode, ImGuiKeyOwner_NoOwner)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_LeftArrow, repeat_mode, ImGuiKeyOwner_NoOwner)))) { g.NavMoveDir = ImGuiDir_Left; }
14677 if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadRight, repeat_mode, ImGuiKeyOwner_NoOwner)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_RightArrow, repeat_mode, ImGuiKeyOwner_NoOwner)))) { g.NavMoveDir = ImGuiDir_Right; }
14678 if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadUp, repeat_mode, ImGuiKeyOwner_NoOwner)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_UpArrow, repeat_mode, ImGuiKeyOwner_NoOwner)))) { g.NavMoveDir = ImGuiDir_Up; }
14679 if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadDown, repeat_mode, ImGuiKeyOwner_NoOwner)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_DownArrow, repeat_mode, ImGuiKeyOwner_NoOwner)))) { g.NavMoveDir = ImGuiDir_Down; }
14680 }
14681 g.NavMoveClipDir = g.NavMoveDir;
14682 g.NavScoringNoClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX);
14683 }
14684
14685 // Update PageUp/PageDown/Home/End scroll
14686 // FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag?
14687 float scoring_page_offset_y = 0.0f;
14688 if (window && g.NavMoveDir == ImGuiDir_None && nav_keyboard_active)
14689 scoring_page_offset_y = NavUpdatePageUpPageDown();
14690
14691 // [DEBUG] Always send a request when holding Ctrl. Hold Ctrl + Arrow change the direction.
14692#if IMGUI_DEBUG_NAV_SCORING
14693 //if (io.KeyCtrl && IsKeyPressed(ImGuiKey_C))
14694 // g.NavMoveDirForDebug = (ImGuiDir)((g.NavMoveDirForDebug + 1) & 3);
14695 if (io.KeyCtrl)
14696 {
14697 if (g.NavMoveDir == ImGuiDir_None)
14698 g.NavMoveDir = g.NavMoveDirForDebug;
14699 g.NavMoveClipDir = g.NavMoveDir;
14700 g.NavMoveFlags |= ImGuiNavMoveFlags_DebugNoResult;
14701 }
14702#endif
14703
14704 // Submit
14705 g.NavMoveForwardToNextFrame = false;
14706 if (g.NavMoveDir != ImGuiDir_None)
14707 NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags);
14708

Callers

nothing calls this directly

Calls 13

IsActiveIdUsingNavDirFunction · 0.85
WindowRectAbsToRelFunction · 0.85
ImVec2Function · 0.85
ImMinFunction · 0.85
WindowRectRelToAbsFunction · 0.85
NavBiasScoringRectFunction · 0.85
GetWidthMethod · 0.80
ImRectFunction · 0.50
TranslateMethod · 0.45
ContainsMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected