Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overlapping text in the High Scores dialog #9243

Merged
merged 2 commits into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/fheroes2/game/game_highscores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
#include "logging.h"
#endif

namespace fheroes2
{
enum class SupportedLanguage : uint8_t;
}

namespace
{
const std::string highScoreFileName = "fheroes2.hgs";
Expand Down Expand Up @@ -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 );
Expand Down
Loading