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

Method NavUpdateCreateMoveRequest

Dependencies/ImGui/src/imgui.cpp:13910–14025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13908}
13909
13910void ImGui::NavUpdateCreateMoveRequest()
13911{
13912 ImGuiContext& g = *GImGui;
13913 ImGuiIO& io = g.IO;
13914 ImGuiWindow* window = g.NavWindow;
13915 const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
13916 const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
13917
13918 if (g.NavMoveForwardToNextFrame && window != NULL)
13919 {
13920 // 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)
13921 // (preserve most state, which were already set by the NavMoveRequestForward() function)
13922 IM_ASSERT(g.NavMoveDir != ImGuiDir_None && g.NavMoveClipDir != ImGuiDir_None);
13923 IM_ASSERT(g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded);
13924 IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestForward %d\n", g.NavMoveDir);
13925 }
13926 else
13927 {
13928 // Initiate directional inputs request
13929 g.NavMoveDir = ImGuiDir_None;
13930 g.NavMoveFlags = ImGuiNavMoveFlags_None;
13931 g.NavMoveScrollFlags = ImGuiScrollFlags_None;
13932 if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs))
13933 {
13934 const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateNavMove;
13935 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; }
13936 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; }
13937 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; }
13938 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; }
13939 }
13940 g.NavMoveClipDir = g.NavMoveDir;
13941 g.NavScoringNoClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX);
13942 }
13943
13944 // Update PageUp/PageDown/Home/End scroll
13945 // FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag?
13946 float scoring_rect_offset_y = 0.0f;
13947 if (window && g.NavMoveDir == ImGuiDir_None && nav_keyboard_active)
13948 scoring_rect_offset_y = NavUpdatePageUpPageDown();
13949 if (scoring_rect_offset_y != 0.0f)
13950 {
13951 g.NavScoringNoClipRect = window->InnerRect;
13952 g.NavScoringNoClipRect.TranslateY(scoring_rect_offset_y);
13953 }
13954
13955 // [DEBUG] Always send a request when holding CTRL. Hold CTRL + Arrow change the direction.
13956#if IMGUI_DEBUG_NAV_SCORING
13957 //if (io.KeyCtrl && IsKeyPressed(ImGuiKey_C))
13958 // g.NavMoveDirForDebug = (ImGuiDir)((g.NavMoveDirForDebug + 1) & 3);
13959 if (io.KeyCtrl)
13960 {
13961 if (g.NavMoveDir == ImGuiDir_None)
13962 g.NavMoveDir = g.NavMoveDirForDebug;
13963 g.NavMoveClipDir = g.NavMoveDir;
13964 g.NavMoveFlags |= ImGuiNavMoveFlags_DebugNoResult;
13965 }
13966#endif
13967

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
ImRectFunction · 0.50
TranslateMethod · 0.45
ContainsMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected