LibCards: Adjust card design
Alter the card dimensions to be 80x110px with a corner radius of 7px. This is inspired by the dimensions of physical playing cards. It gives 12px of padding between the illustration and the card's border. Move the card letter and symbol closer to the edge to make space. Adjust the Club symbol to have the same dimensions as the other symbols.
This commit is contained in:
parent
355e373ce5
commit
02913e2184
Notes:
sideshowbarker
2024-07-17 02:42:21 +09:00
Author: https://github.com/cubiclove Commit: https://github.com/SerenityOS/serenity/commit/02913e2184 Pull-request: https://github.com/SerenityOS/serenity/pull/21307 Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 13 additions and 13 deletions
|
@ -81,9 +81,9 @@ class Card final : public Core::EventReceiver {
|
|||
C_OBJECT(Card)
|
||||
public:
|
||||
static constexpr int width = 80;
|
||||
static constexpr int height = 100;
|
||||
static constexpr int height = 110;
|
||||
static constexpr int card_count = to_underlying(Rank::__Count);
|
||||
static constexpr int card_radius = 5;
|
||||
static constexpr int card_radius = 7;
|
||||
|
||||
virtual ~Card() override = default;
|
||||
|
||||
|
|
|
@ -64,16 +64,16 @@ static constexpr Gfx::CharacterBitmap s_spade {
|
|||
};
|
||||
|
||||
static constexpr Gfx::CharacterBitmap s_club {
|
||||
" ### "
|
||||
" ##### "
|
||||
" ##### "
|
||||
" ## ### ## "
|
||||
"###########"
|
||||
"###########"
|
||||
"#### # ####"
|
||||
" ## ### ## "
|
||||
" ### "sv,
|
||||
11, 9
|
||||
" ### "
|
||||
" ##### "
|
||||
" ##### "
|
||||
"## ### ##"
|
||||
"#########"
|
||||
"#########"
|
||||
" ## # ## "
|
||||
" ### "
|
||||
" ### "sv,
|
||||
9, 9
|
||||
};
|
||||
|
||||
NonnullRefPtr<Gfx::Bitmap> CardPainter::card_front(Suit suit, Rank rank)
|
||||
|
@ -201,7 +201,7 @@ void CardPainter::paint_card_front(Gfx::Bitmap& bitmap, Cards::Suit suit, Cards:
|
|||
paint_rect.set_height(paint_rect.height() / 2);
|
||||
paint_rect.shrink(10, 6);
|
||||
|
||||
auto text_rect = Gfx::IntRect { 4, 6, font.width_rounded_up("10"sv), font.pixel_size_rounded_up() };
|
||||
auto text_rect = Gfx::IntRect { 1, 6, font.width_rounded_up("10"sv), font.pixel_size_rounded_up() };
|
||||
painter.draw_text(text_rect, card_rank_label(rank), font, Gfx::TextAlignment::Center, suit_color);
|
||||
|
||||
painter.draw_bitmap(
|
||||
|
|
Loading…
Add table
Reference in a new issue