Skip to content

Commit

Permalink
Merge pull request #748 from mbarnes/mouse-menu-navigation
Browse files Browse the repository at this point in the history
Improve mouse navigation in overlay menus
  • Loading branch information
mickelson authored Jul 12, 2023
2 parents 7ae57c7 + 504c755 commit bee4233
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/fe_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,15 @@ bool FeOverlay::event_loop( FeEventLoopCtx &ctx )
&& ( c == ctx.extra_exit ))
c = FeInputMap::Exit;

if ( ev.type == sf::Event::MouseMoved )
{
if ( m_feSettings.test_mouse_reset( ev.mouseMove.x, ev.mouseMove.y ) )
{
sf::Vector2u s = m_wnd.get_win().getSize();
sf::Mouse::setPosition( sf::Vector2i( s.x / 2, s.y / 2 ), m_wnd.get_win() );
}
}

switch( c )
{
case FeInputMap::Back:
Expand All @@ -1407,7 +1416,7 @@ bool FeOverlay::event_loop( FeEventLoopCtx &ctx )

if ( ctx.sel > 0 )
ctx.sel--;
else
else if ( ev.type != sf::Event::MouseMoved )
ctx.sel=ctx.max_sel;

ctx.move_event = ev;
Expand All @@ -1423,7 +1432,7 @@ bool FeOverlay::event_loop( FeEventLoopCtx &ctx )

if ( ctx.sel < ctx.max_sel )
ctx.sel++;
else
else if ( ev.type != sf::Event::MouseMoved )
ctx.sel = 0;

ctx.move_event = ev;
Expand Down

0 comments on commit bee4233

Please sign in to comment.