summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Games/2048/main.cpp6
-rw-r--r--Games/Snake/SnakeGame.cpp6
-rw-r--r--Games/Solitaire/main.cpp3
3 files changed, 8 insertions, 7 deletions
diff --git a/Games/2048/main.cpp b/Games/2048/main.cpp
index 969a61d60a..929f8b59d7 100644
--- a/Games/2048/main.cpp
+++ b/Games/2048/main.cpp
@@ -101,7 +101,7 @@ int main(int argc, char** argv)
auto update = [&]() {
board_view.set_board(&game.board());
board_view.update();
- statusbar.set_text(String::format("Score: %d", game.score()));
+ statusbar.set_text(String::formatted("Score: {}", game.score()));
};
update();
@@ -160,7 +160,7 @@ int main(int argc, char** argv)
case Game::MoveOutcome::Won:
update();
GUI::MessageBox::show(window,
- String::format("You reached %d in %zu turns with a score of %d", game.target_tile(), game.turns(), game.score()),
+ String::formatted("You reached {} in {} turns with a score of {}", game.target_tile(), game.turns(), game.score()),
"You won!",
GUI::MessageBox::Type::Information);
start_a_new_game();
@@ -168,7 +168,7 @@ int main(int argc, char** argv)
case Game::MoveOutcome::GameOver:
update();
GUI::MessageBox::show(window,
- String::format("You reached %d in %zu turns with a score of %d", game.largest_tile(), game.turns(), game.score()),
+ String::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()),
"You lost!",
GUI::MessageBox::Type::Information);
start_a_new_game();
diff --git a/Games/Snake/SnakeGame.cpp b/Games/Snake/SnakeGame.cpp
index 3d2bf109e1..32c7f45faf 100644
--- a/Games/Snake/SnakeGame.cpp
+++ b/Games/Snake/SnakeGame.cpp
@@ -45,7 +45,7 @@ SnakeGame::SnakeGame()
auto config = Core::ConfigFile::get_for_app("Snake");
m_high_score = config->read_num_entry("Snake", "HighScore", 0);
- m_high_score_text = String::format("Best: %u", m_high_score);
+ m_high_score_text = String::formatted("Best: {}", m_high_score);
}
SnakeGame::~SnakeGame()
@@ -146,10 +146,10 @@ void SnakeGame::timer_event(Core::TimerEvent&)
if (m_head == m_fruit) {
++m_length;
++m_score;
- m_score_text = String::format("Score: %u", m_score);
+ m_score_text = String::formatted("Score: {}", m_score);
if (m_score > m_high_score) {
m_high_score = m_score;
- m_high_score_text = String::format("Best: %u", m_high_score);
+ m_high_score_text = String::formatted("Best: {}", m_high_score);
update(high_score_rect());
auto config = Core::ConfigFile::get_for_app("Snake");
config->write_num_entry("Snake", "HighScore", m_high_score);
diff --git a/Games/Solitaire/main.cpp b/Games/Solitaire/main.cpp
index a430f606ef..ea46bf41ea 100644
--- a/Games/Solitaire/main.cpp
+++ b/Games/Solitaire/main.cpp
@@ -32,6 +32,7 @@
#include <LibGUI/MenuBar.h>
#include <LibGUI/Window.h>
#include <stdio.h>
+#include <unistd.h>
int main(int argc, char** argv)
{
@@ -48,7 +49,7 @@ int main(int argc, char** argv)
window->resize(SolitaireWidget::width, SolitaireWidget::height);
auto widget = SolitaireWidget::construct(window, [&](uint32_t score) {
- window->set_title(String::format("Score: %u - Solitaire", score));
+ window->set_title(String::formatted("Score: {} - Solitaire", score));
});
auto menubar = GUI::MenuBar::construct();