Skip to content

Commit

Permalink
Add hotkey for settings in main menu (ihhub#4777)
Browse files Browse the repository at this point in the history
  • Loading branch information
a1exsh authored Dec 11, 2021
1 parent 3cb327e commit 92145f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/fheroes2/game/game_mainmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ fheroes2::GameMode Game::MainMenu( bool isFirstGameRun )

const double scaleX = static_cast<double>( display.width() ) / fheroes2::Display::DEFAULT_WIDTH;
const double scaleY = static_cast<double>( display.height() ) / fheroes2::Display::DEFAULT_HEIGHT;
const fheroes2::Rect resolutionArea( static_cast<int32_t>( 63 * scaleX ), static_cast<int32_t>( 202 * scaleY ), static_cast<int32_t>( 90 * scaleX ),
static_cast<int32_t>( 160 * scaleY ) );
const fheroes2::Rect settingsArea( static_cast<int32_t>( 63 * scaleX ), static_cast<int32_t>( 202 * scaleY ), static_cast<int32_t>( 90 * scaleX ),
static_cast<int32_t>( 160 * scaleY ) );

u32 lantern_frame = 0;

Expand Down Expand Up @@ -298,7 +298,7 @@ fheroes2::GameMode Game::MainMenu( bool isFirstGameRun )
return fheroes2::GameMode::QUIT_GAME;
}
}
else if ( le.MouseClickLeft( resolutionArea ) ) {
else if ( HotKeyPressEvent( EVENT_BUTTON_SETTINGS ) || le.MouseClickLeft( settingsArea ) ) {
fheroes2::openGameSettings();

// force interface to reset area and positions
Expand All @@ -317,14 +317,14 @@ fheroes2::GameMode Game::MainMenu( bool isFirstGameRun )
Dialog::Message( _( "High Scores" ), _( "View the high scores screen." ), Font::BIG );
else if ( le.MousePressRight( buttonNewGame.area() ) )
Dialog::Message( _( "New Game" ), _( "Start a single or multi-player game." ), Font::BIG );
else if ( le.MousePressRight( resolutionArea ) )
else if ( le.MousePressRight( settingsArea ) )
Dialog::Message( _( "Settings" ), _( "Game settings." ), Font::BIG );

if ( validateAnimationDelay( MAIN_MENU_DELAY ) ) {
const fheroes2::Sprite & lantern12 = fheroes2::AGG::GetICN( ICN::SHNGANIM, ICN::AnimationFrame( ICN::SHNGANIM, 0, lantern_frame ) );
++lantern_frame;
fheroes2::Blit( lantern12, display, lantern12.x(), lantern12.y() );
if ( le.MouseCursor( resolutionArea ) ) {
if ( le.MouseCursor( settingsArea ) ) {
const int32_t offsetY = static_cast<int32_t>( 55 * scaleY );
fheroes2::Blit( highlightDoor, 0, offsetY, display, highlightDoor.x(), highlightDoor.y() + offsetY, highlightDoor.width(), highlightDoor.height() );
}
Expand Down

0 comments on commit 92145f7

Please sign in to comment.