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:
Cubic Love 2023-10-01 19:01:22 +01:00 committed by Sam Atkins
parent 355e373ce5
commit 02913e2184
2 changed files with 13 additions and 13 deletions

View file

@ -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;

View file

@ -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(