From 7c67c9b45f68e1337a21a97a76468943d5680cec Mon Sep 17 00:00:00 2001 From: Dmitrii Ubskii Date: Sun, 16 May 2021 21:39:12 +0300 Subject: Pong: Fix score display Player 1's score used to be score's width offset to the right. Now it's score_margin away from the divider line, same as player 2's. Also factored out score margin and increased it from 2px to 5px just to make it look a little nicer. --- Userland/Games/Pong/Game.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Userland') diff --git a/Userland/Games/Pong/Game.h b/Userland/Games/Pong/Game.h index 9817600e7c..ab1350fc7b 100644 --- a/Userland/Games/Pong/Game.h +++ b/Userland/Games/Pong/Game.h @@ -75,16 +75,18 @@ private: } }; + constexpr static int score_margin = 5; + Gfx::IntRect player_1_score_rect() const { int score_width = font().width(String::formatted("{}", m_player_1_score)); - return { (game_width / 2) + score_width + 2, 2, score_width, font().glyph_height() }; + return { (game_width / 2) + score_margin, score_margin, score_width, font().glyph_height() }; } Gfx::IntRect player_2_score_rect() const { int score_width = font().width(String::formatted("{}", m_player_2_score)); - return { (game_width / 2) - score_width - 2, 2, score_width, font().glyph_height() }; + return { (game_width / 2) - score_width - score_margin, score_margin, score_width, font().glyph_height() }; } Net m_net; -- cgit v1.2.3