Skip to content

Commit

Permalink
Fix overlapping text in the High Scores dialog (#9243)
Browse files Browse the repository at this point in the history
ihhub authored Nov 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 5dc47dd commit 3f806b4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/fheroes2/game/game_highscores.cpp
Original file line number Diff line number Diff line change
@@ -66,6 +66,11 @@
#include "logging.h"
#endif

namespace fheroes2
{
enum class SupportedLanguage : uint8_t;
}

namespace
{
const std::string highScoreFileName = "fheroes2.hgs";
@@ -201,12 +206,15 @@ namespace
for ( const fheroes2::HighscoreData & data : highScores ) {
const fheroes2::FontType font = ( scoreIndex == selectedScoreIndex ) ? fheroes2::FontType::normalYellow() : fheroes2::FontType::normalWhite();

const fheroes2::LanguageSwitcher languageSwitcher( fheroes2::getLanguageFromAbbreviation( data.languageAbbreviation ) );
// TODO: scenario name can have its own independent language.
const fheroes2::SupportedLanguage language = fheroes2::getLanguageFromAbbreviation( data.languageAbbreviation );

text.set( data.playerName, font );
text.set( data.playerName, font, language );
text.fitToOneRow( scenarioNameOffset - playerNameOffset );
text.draw( position.x + playerNameOffset, offsetY + initialHighScoreEntryOffsetY, display );

text.set( data.scenarioName, font );
text.set( data.scenarioName, font, language );
text.fitToOneRow( dayCountOffset - scenarioNameOffset );
text.draw( position.x + scenarioNameOffset, offsetY + initialHighScoreEntryOffsetY, display );

text.set( std::to_string( data.dayCount ), font );

0 comments on commit 3f806b4

Please sign in to comment.