@ -2667,8 +2667,8 @@ typedef int ImGuiNavDirSource;
enum ImGuiNavDirSource_
{
ImGuiNavDirSource_Key = 1 < < 0 ,
ImGuiNavDirSource_Pad StickL = 1 < < 1 ,
ImGuiNavDirSource_Pad StickR = 1 < < 2
ImGuiNavDirSource_Pad L Stick = 1 < < 1 ,
ImGuiNavDirSource_Pad R Stick = 1 < < 2
} ;
// FIXME-NAV: Expose navigation repeat delay/rate
@ -2715,11 +2715,11 @@ static ImVec2 GetNavInputAmount2d(ImGuiNavDirSource dir_sources, ImGuiNavReadMod
{
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_Pad StickL )
delta + = ImVec2 ( GetNavInputAmount ( ImGuiNavInput_Pad Right, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad Left, mode ) , GetNavInputAmount ( ImGuiNavInput_Pad Down, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad Up, mode ) ) ;
if ( dir_sources & ImGuiNavDirSource_Pad StickR )
delta + = ImVec2 ( GetNavInputAmount ( ImGuiNavInput_Pad Scroll Right, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad Scroll Left, mode ) , GetNavInputAmount ( ImGuiNavInput_Pad Scroll Down, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad Scroll Up, mode ) ) ;
delta + = ImVec2 ( GetNavInputAmount ( ImGuiNavInput_KeyRight , mode ) - GetNavInputAmount ( ImGuiNavInput_KeyLeft , mode ) , GetNavInputAmount ( ImGuiNavInput_KeyDown , mode ) - GetNavInputAmount ( ImGuiNavInput_KeyUp , mode ) ) ;
if ( dir_sources & ImGuiNavDirSource_Pad L Stick)
delta + = ImVec2 ( GetNavInputAmount ( ImGuiNavInput_Pad LStick Right, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad LStick Left, mode ) , GetNavInputAmount ( ImGuiNavInput_Pad LStick Down, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad LStick Up, mode ) ) ;
if ( dir_sources & ImGuiNavDirSource_Pad R Stick)
delta + = ImVec2 ( GetNavInputAmount ( ImGuiNavInput_Pad RStick Right, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad RStick Left, mode ) , GetNavInputAmount ( ImGuiNavInput_Pad RStick Down, mode ) - GetNavInputAmount ( ImGuiNavInput_Pad RStick Up, mode ) ) ;
if ( slow_factor ! = 0.0f & & IsNavInputDown ( ImGuiNavInput_PadTweakSlow ) )
delta * = slow_factor ;
if ( fast_factor ! = 0.0f & & IsNavInputDown ( ImGuiNavInput_PadTweakFast ) )
@ -2768,7 +2768,7 @@ static void ImGui::NavUpdateWindowing()
// Move window
if ( g . NavWindowingTarget & & ! ( g . NavWindowingTarget - > Flags & ImGuiWindowFlags_NoMove ) )
{
const ImVec2 move_delta = GetNavInputAmount2d ( ImGuiNavDirSource_Pad StickR , ImGuiNavReadMode_Down ) ;
const ImVec2 move_delta = GetNavInputAmount2d ( ImGuiNavDirSource_Pad R Stick, 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 @@ static void ImGui::NavUpdate()
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_PadL eft, ImGuiNavInput_KeyLeft , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Left ;
if ( ( allowed_dir_flags & ( 1 < < ImGuiDir_Right ) ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_Pad Right, ImGuiNavInput_KeyRight , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Right ;
if ( ( allowed_dir_flags & ( 1 < < ImGuiDir_Up ) ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_Pad Up, ImGuiNavInput_KeyUp , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Up ;
if ( ( allowed_dir_flags & ( 1 < < ImGuiDir_Down ) ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_Pad Down, ImGuiNavInput_KeyDown , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Down ;
if ( ( allowed_dir_flags & ( 1 < < ImGuiDir_Left ) ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_PadL StickL eft, ImGuiNavInput_KeyLeft , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Left ;
if ( ( allowed_dir_flags & ( 1 < < ImGuiDir_Right ) ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_Pad LStick Right, ImGuiNavInput_KeyRight , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Right ;
if ( ( allowed_dir_flags & ( 1 < < ImGuiDir_Up ) ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_Pad LStick Up, ImGuiNavInput_KeyUp , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Up ;
if ( ( allowed_dir_flags & ( 1 < < ImGuiDir_Down ) ) & & IsNavInputPressedAnyOfTwo ( ImGuiNavInput_Pad LStick Down, ImGuiNavInput_KeyDown , ImGuiNavReadMode_Repeat ) ) g . NavMoveDir = ImGuiDir_Down ;
}
}
else
@ -3038,7 +3038,7 @@ static void ImGui::NavUpdate()
// *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_Pad StickR , ImGuiNavReadMode_Down , 1.0f / 10.0f , 10.0f ) ;
ImVec2 scroll_dir = GetNavInputAmount2d ( ImGuiNavDirSource_Pad R Stick, 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 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
// Navigation/gamepad resize
if ( g . NavWindowingTarget = = window )
{
ImVec2 nav_resize_delta = GetNavInputAmount2d ( ImGuiNavDirSource_Pad StickL , ImGuiNavReadMode_Down ) ;
ImVec2 nav_resize_delta = GetNavInputAmount2d ( ImGuiNavDirSource_Pad L Stick, 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 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
}
else if ( g . ActiveIdSource = = ImGuiInputSource_Nav & & g . NavActivateDownId = = id )
{
const ImVec2 delta2 = GetNavInputAmount2d ( ImGuiNavDirSource_Key | ImGuiNavDirSource_Pad StickL , ImGuiNavReadMode_RepeatFast , 0.0f , 0.0f ) ;
const ImVec2 delta2 = GetNavInputAmount2d ( ImGuiNavDirSource_Key | ImGuiNavDirSource_Pad L Stick, ImGuiNavReadMode_RepeatFast , 0.0f , 0.0f ) ;
float delta = is_horizontal ? delta2 . x : - delta2 . y ;
if ( delta ! = 0.0f )
{
@ -8741,7 +8741,7 @@ bool ImGui::DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_s
}
if ( g . ActiveIdSource = = ImGuiInputSource_Nav )
{
adjust_delta = GetNavInputAmount2d ( ImGuiNavDirSource_Key | ImGuiNavDirSource_Pad StickL , ImGuiNavReadMode_RepeatFast , 1.0f / 10.0f , 10.0f ) . x ;
adjust_delta = GetNavInputAmount2d ( ImGuiNavDirSource_Key | ImGuiNavDirSource_Pad L Stick, ImGuiNavReadMode_RepeatFast , 1.0f / 10.0f , 10.0f ) . x ;
v_speed = ImMax ( v_speed , GetMinimumStepAtDecimalPrecision ( decimal_precision ) ) ;
}
adjust_delta * = v_speed ;