mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +00:00
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
2 changed files with 13 additions and 13 deletions
|
@ -81,9 +81,9 @@ class Card final : public Core::EventReceiver {
|
||||||
C_OBJECT(Card)
|
C_OBJECT(Card)
|
||||||
public:
|
public:
|
||||||
static constexpr int width = 80;
|
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_count = to_underlying(Rank::__Count);
|
||||||
static constexpr int card_radius = 5;
|
static constexpr int card_radius = 7;
|
||||||
|
|
||||||
virtual ~Card() override = default;
|
virtual ~Card() override = default;
|
||||||
|
|
||||||
|
|
|
@ -67,13 +67,13 @@ static constexpr Gfx::CharacterBitmap s_club {
|
||||||
" ### "
|
" ### "
|
||||||
" ##### "
|
" ##### "
|
||||||
" ##### "
|
" ##### "
|
||||||
" ## ### ## "
|
"## ### ##"
|
||||||
"###########"
|
"#########"
|
||||||
"###########"
|
"#########"
|
||||||
"#### # ####"
|
" ## # ## "
|
||||||
" ## ### ## "
|
" ### "
|
||||||
" ### "sv,
|
" ### "sv,
|
||||||
11, 9
|
9, 9
|
||||||
};
|
};
|
||||||
|
|
||||||
NonnullRefPtr<Gfx::Bitmap> CardPainter::card_front(Suit suit, Rank rank)
|
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.set_height(paint_rect.height() / 2);
|
||||||
paint_rect.shrink(10, 6);
|
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_text(text_rect, card_rank_label(rank), font, Gfx::TextAlignment::Center, suit_color);
|
||||||
|
|
||||||
painter.draw_bitmap(
|
painter.draw_bitmap(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue