mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-23 09:48:56 +00:00
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.
This commit is contained in:
parent
d897abf4c2
commit
7c67c9b45f
Notes:
sideshowbarker
2024-07-18 17:49:42 +09:00
Author: https://github.com/dmitrii-ubskii
Commit: 7c67c9b45f
Pull-request: https://github.com/SerenityOS/serenity/pull/7196
Reviewed-by: https://github.com/linusg
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue