Nav: Renamed ImGuiNavInput_PadLeft / etc. to ImGuiNavInput_PadLStickLeft. Renamed ImGuiNavInput_PadScrollLeft to ImGuiNavInput_PadRStickLeft, aka removing trying-too-hard semantic from the enums. (#787)
diff --git a/imgui.cpp b/imgui.cpp
index 65e623e..24c2468 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -2667,8 +2667,8 @@
enum ImGuiNavDirSource_
{
ImGuiNavDirSource_Key = 1 << 0,
- ImGuiNavDirSource_PadStickL = 1 << 1,
- ImGuiNavDirSource_PadStickR = 1 << 2
+ ImGuiNavDirSource_PadLStick = 1 << 1,
+ ImGuiNavDirSource_PadRStick = 1 << 2
};
// FIXME-NAV: Expose navigation repeat delay/rate
@@ -2715,11 +2715,11 @@
{
ImVec2 delta(0.0f, 0.0f);
if (dir_sources & ImGuiNavDirSource_Key)
- delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight, mode) - GetNavInputAmount(ImGuiNavInput_KeyLeft, mode), GetNavInputAmount(ImGuiNavInput_KeyDown, mode) - GetNavInputAmount(ImGuiNavInput_KeyUp, mode));
- if (dir_sources & ImGuiNavDirSource_PadStickL)
- delta += ImVec2(GetNavInputAmount(ImGuiNavInput_PadRight, mode) - GetNavInputAmount(ImGuiNavInput_PadLeft, mode), GetNavInputAmount(ImGuiNavInput_PadDown, mode) - GetNavInputAmount(ImGuiNavInput_PadUp, mode));
- if (dir_sources & ImGuiNavDirSource_PadStickR)
- delta += ImVec2(GetNavInputAmount(ImGuiNavInput_PadScrollRight, mode) - GetNavInputAmount(ImGuiNavInput_PadScrollLeft, mode), GetNavInputAmount(ImGuiNavInput_PadScrollDown, mode) - GetNavInputAmount(ImGuiNavInput_PadScrollUp, mode));
+ delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight, mode) - GetNavInputAmount(ImGuiNavInput_KeyLeft, mode), GetNavInputAmount(ImGuiNavInput_KeyDown, mode) - GetNavInputAmount(ImGuiNavInput_KeyUp, mode));
+ if (dir_sources & ImGuiNavDirSource_PadLStick)
+ delta += ImVec2(GetNavInputAmount(ImGuiNavInput_PadLStickRight, mode) - GetNavInputAmount(ImGuiNavInput_PadLStickLeft, mode), GetNavInputAmount(ImGuiNavInput_PadLStickDown, mode) - GetNavInputAmount(ImGuiNavInput_PadLStickUp, mode));
+ if (dir_sources & ImGuiNavDirSource_PadRStick)
+ delta += ImVec2(GetNavInputAmount(ImGuiNavInput_PadRStickRight, mode) - GetNavInputAmount(ImGuiNavInput_PadRStickLeft, mode), GetNavInputAmount(ImGuiNavInput_PadRStickDown, mode) - GetNavInputAmount(ImGuiNavInput_PadRStickUp, mode));
if (slow_factor != 0.0f && IsNavInputDown(ImGuiNavInput_PadTweakSlow))
delta *= slow_factor;
if (fast_factor != 0.0f && IsNavInputDown(ImGuiNavInput_PadTweakFast))
@@ -2768,7 +2768,7 @@
// Move window
if (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoMove))
{
- const ImVec2 move_delta = GetNavInputAmount2d(ImGuiNavDirSource_PadStickR, ImGuiNavReadMode_Down);
+ const ImVec2 move_delta = GetNavInputAmount2d(ImGuiNavDirSource_PadRStick, ImGuiNavReadMode_Down);
if (move_delta.x != 0.0f || move_delta.y != 0.0f)
{
const float move_speed = ImFloor(600 * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y));
@@ -2993,10 +2993,10 @@
g.NavMoveDir = ImGuiDir_None;
if (g.NavWindow && !g.NavWindowingTarget && allowed_dir_flags && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
{
- if ((allowed_dir_flags & (1<<ImGuiDir_Left)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadLeft, ImGuiNavInput_KeyLeft, ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Left;
- if ((allowed_dir_flags & (1<<ImGuiDir_Right)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadRight,ImGuiNavInput_KeyRight,ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Right;
- if ((allowed_dir_flags & (1<<ImGuiDir_Up)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadUp, ImGuiNavInput_KeyUp, ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Up;
- if ((allowed_dir_flags & (1<<ImGuiDir_Down)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadDown, ImGuiNavInput_KeyDown, ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Down;
+ if ((allowed_dir_flags & (1<<ImGuiDir_Left)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadLStickLeft, ImGuiNavInput_KeyLeft, ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Left;
+ if ((allowed_dir_flags & (1<<ImGuiDir_Right)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadLStickRight,ImGuiNavInput_KeyRight,ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Right;
+ if ((allowed_dir_flags & (1<<ImGuiDir_Up)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadLStickUp, ImGuiNavInput_KeyUp, ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Up;
+ if ((allowed_dir_flags & (1<<ImGuiDir_Down)) && IsNavInputPressedAnyOfTwo(ImGuiNavInput_PadLStickDown, ImGuiNavInput_KeyDown, ImGuiNavReadMode_Repeat)) g.NavMoveDir = ImGuiDir_Down;
}
}
else
@@ -3038,7 +3038,7 @@
// *Normal* Manual scroll with NavScrollXXX keys
// Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds.
- ImVec2 scroll_dir = GetNavInputAmount2d(ImGuiNavDirSource_PadStickR, ImGuiNavReadMode_Down, 1.0f/10.0f, 10.0f);
+ ImVec2 scroll_dir = GetNavInputAmount2d(ImGuiNavDirSource_PadRStick, ImGuiNavReadMode_Down, 1.0f/10.0f, 10.0f);
if (scroll_dir.x != 0.0f && window->ScrollbarX)
{
SetWindowScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed));
@@ -5349,7 +5349,7 @@
// Navigation/gamepad resize
if (g.NavWindowingTarget == window)
{
- ImVec2 nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSource_PadStickL, ImGuiNavReadMode_Down);
+ ImVec2 nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSource_PadLStick, ImGuiNavReadMode_Down);
if (nav_resize_delta.x != 0.0f || nav_resize_delta.y != 0.0f)
{
const float GAMEPAD_RESIZE_SPEED = 600.0f;
@@ -8394,7 +8394,7 @@
}
else if (g.ActiveIdSource == ImGuiInputSource_Nav && g.NavActivateDownId == id)
{
- const ImVec2 delta2 = GetNavInputAmount2d(ImGuiNavDirSource_Key|ImGuiNavDirSource_PadStickL, ImGuiNavReadMode_RepeatFast, 0.0f, 0.0f);
+ const ImVec2 delta2 = GetNavInputAmount2d(ImGuiNavDirSource_Key|ImGuiNavDirSource_PadLStick, ImGuiNavReadMode_RepeatFast, 0.0f, 0.0f);
float delta = is_horizontal ? delta2.x : -delta2.y;
if (delta != 0.0f)
{
@@ -8741,7 +8741,7 @@
}
if (g.ActiveIdSource == ImGuiInputSource_Nav)
{
- adjust_delta = GetNavInputAmount2d(ImGuiNavDirSource_Key|ImGuiNavDirSource_PadStickL, ImGuiNavReadMode_RepeatFast, 1.0f/10.0f, 10.0f).x;
+ adjust_delta = GetNavInputAmount2d(ImGuiNavDirSource_Key|ImGuiNavDirSource_PadLStick, ImGuiNavReadMode_RepeatFast, 1.0f/10.0f, 10.0f).x;
v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
}
adjust_delta *= v_speed;
diff --git a/imgui.h b/imgui.h
index f6eedaa..9bb3d7f 100644
--- a/imgui.h
+++ b/imgui.h
@@ -704,14 +704,14 @@
ImGuiNavInput_PadCancel, // close menu/popup/child, lose selection // e.g. Cross button
ImGuiNavInput_PadInput, // text input // e.g. Triangle button
ImGuiNavInput_PadMenu, // toggle menu, hold to: focus, move, resize // e.g. Square button
- ImGuiNavInput_PadLeft, // move left, resize window (with PadMenu) // e.g. D-pad or left stick directions (analog)
- ImGuiNavInput_PadRight, // move right
- ImGuiNavInput_PadUp, // move up
- ImGuiNavInput_PadDown, // move down
- ImGuiNavInput_PadScrollLeft, // scroll up, move window (with PadMenu) // e.g. right stick directions (analog)
- ImGuiNavInput_PadScrollRight, // scroll right
- ImGuiNavInput_PadScrollUp, // scroll up
- ImGuiNavInput_PadScrollDown, // scroll down
+ ImGuiNavInput_PadLStickLeft, // move left, resize window (with PadMenu) // e.g. D-pad + left stick directions (analog)
+ ImGuiNavInput_PadLStickRight, // move right
+ ImGuiNavInput_PadLStickUp, // move up
+ ImGuiNavInput_PadLStickDown, // move down
+ ImGuiNavInput_PadRStickLeft, // scroll up, move window (with PadMenu) // e.g. right stick directions (analog)
+ ImGuiNavInput_PadRStickRight, // scroll right
+ ImGuiNavInput_PadRStickUp, // scroll up
+ ImGuiNavInput_PadRStickDown, // scroll down
ImGuiNavInput_PadFocusPrev, // next window (with PadMenu) // e.g. L-trigger
ImGuiNavInput_PadFocusNext, // prev window (with PadMenu) // e.g. R-trigger
ImGuiNavInput_PadTweakSlow, // slower tweaks // e.g. L-trigger, analog