summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorDmitrii Ubskii <ubskydm@gmail.com>2021-05-16 21:39:12 +0300
committerLinus Groh <mail@linusgroh.de>2021-05-18 18:58:07 +0100
commit7c67c9b45f68e1337a21a97a76468943d5680cec (patch)
treeca802e8f3a52b8d01dca755cf4d63542e7463584 /Userland
parentd897abf4c2e7be4c3aab8fba9869221c19207497 (diff)
downloadserenity-7c67c9b45f68e1337a21a97a76468943d5680cec.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Games/Pong/Game.h6
1 files changed, 4 insertions, 2 deletions
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;