mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
BrickGame: Port from DeprecatedStrings to Strings
This commit is contained in:
parent
2344666725
commit
962d39cc05
2 changed files with 7 additions and 7 deletions
|
@ -535,7 +535,7 @@ void BrickGame::paint_cell(GUI::Painter& painter, Gfx::IntRect rect, bool is_on)
|
||||||
painter.fill_rect(rect, is_on ? m_front_color : m_shadow_color);
|
painter.fill_rect(rect, is_on ? m_front_color : m_shadow_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrickGame::paint_sidebar_text(GUI::Painter& painter, int row, DeprecatedString const& text)
|
void BrickGame::paint_sidebar_text(GUI::Painter& painter, int row, StringView text)
|
||||||
{
|
{
|
||||||
auto const text_width = static_cast<int>(ceilf(font().width(text)));
|
auto const text_width = static_cast<int>(ceilf(font().width(text)));
|
||||||
auto const entire_area_rect { frame_inner_rect() };
|
auto const entire_area_rect { frame_inner_rect() };
|
||||||
|
@ -596,10 +596,10 @@ void BrickGame::paint_game(GUI::Painter& painter, Gfx::IntRect const& rect)
|
||||||
paint_cell(painter, cell_rect(position), (*m_brick_game)[board_position]);
|
paint_cell(painter, cell_rect(position), (*m_brick_game)[board_position]);
|
||||||
}
|
}
|
||||||
|
|
||||||
paint_sidebar_text(painter, 0, DeprecatedString::formatted("Score: {}", m_brick_game->score()));
|
paint_sidebar_text(painter, 0, String::formatted("Score: {}", m_brick_game->score()).release_value_but_fixme_should_propagate_errors());
|
||||||
paint_sidebar_text(painter, 1, DeprecatedString::formatted("Level: {}", m_brick_game->level()));
|
paint_sidebar_text(painter, 1, String::formatted("Level: {}", m_brick_game->level()).release_value_but_fixme_should_propagate_errors());
|
||||||
paint_sidebar_text(painter, 4, DeprecatedString::formatted("Hi-Score: {}", m_high_score));
|
paint_sidebar_text(painter, 4, String::formatted("Hi-Score: {}", m_high_score).release_value_but_fixme_should_propagate_errors());
|
||||||
paint_sidebar_text(painter, 12, "Next:");
|
paint_sidebar_text(painter, 12, "Next:"sv);
|
||||||
|
|
||||||
auto const hint_rect = Gfx::IntRect {
|
auto const hint_rect = Gfx::IntRect {
|
||||||
frame_inner_rect().x() + frame_inner_rect().width() - 105,
|
frame_inner_rect().x() + frame_inner_rect().width() - 105,
|
||||||
|
@ -640,7 +640,7 @@ void BrickGame::game_over()
|
||||||
Config::write_i32(m_app_name, m_app_name, "HighScore"sv, int(m_high_score = current_score));
|
Config::write_i32(m_app_name, m_app_name, "HighScore"sv, int(m_high_score = current_score));
|
||||||
}
|
}
|
||||||
GUI::MessageBox::show(window(),
|
GUI::MessageBox::show(window(),
|
||||||
text.to_deprecated_string(),
|
text.string_view(),
|
||||||
"Game Over"sv,
|
"Game Over"sv,
|
||||||
GUI::MessageBox::Type::Information);
|
GUI::MessageBox::Type::Information);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ private:
|
||||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||||
virtual void timer_event(Core::TimerEvent&) override;
|
virtual void timer_event(Core::TimerEvent&) override;
|
||||||
|
|
||||||
void paint_sidebar_text(GUI::Painter&, int row, DeprecatedString const&);
|
void paint_sidebar_text(GUI::Painter&, int row, StringView);
|
||||||
void paint_paused_text(GUI::Painter&);
|
void paint_paused_text(GUI::Painter&);
|
||||||
void paint_cell(GUI::Painter&, Gfx::IntRect, bool);
|
void paint_cell(GUI::Painter&, Gfx::IntRect, bool);
|
||||||
void paint_game(GUI::Painter&, Gfx::IntRect const&);
|
void paint_game(GUI::Painter&, Gfx::IntRect const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue