mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-19 01:24:20 +00:00
Inputs: Added Shortcut(), SetNextItemShortcut(). Added ImGuiInputFlags, ImGuiInputFlags_RouteXXXX. (#456, #2637)
This commit is contained in:
parent
85513de247
commit
fc512a2474
4 changed files with 75 additions and 47 deletions
|
|
@ -9681,6 +9681,11 @@ void ImGui::SetNextItemShortcut(ImGuiKeyChord key_chord)
|
|||
g.NextItemData.Shortcut = key_chord;
|
||||
}
|
||||
|
||||
bool ImGui::Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags)
|
||||
{
|
||||
return Shortcut(key_chord, flags, ImGuiKeyOwner_Any);
|
||||
}
|
||||
|
||||
bool ImGui::Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags, ImGuiID owner_id)
|
||||
{
|
||||
//ImGuiContext& g = *GImGui;
|
||||
|
|
@ -12310,7 +12315,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||
g.NavMoveScrollFlags = ImGuiScrollFlags_None;
|
||||
if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||
{
|
||||
const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateNavMove;
|
||||
const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateNavMove;
|
||||
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; }
|
||||
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; }
|
||||
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; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue