From 02913e21842e28d1b2e0b23b1ed76875aba6ed09 Mon Sep 17 00:00:00 2001 From: Cubic Love <7754483+cubiclove@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:01:22 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibCards/Card.h | 4 ++-- Userland/Libraries/LibCards/CardPainter.cpp | 22 ++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Userland/Libraries/LibCards/Card.h b/Userland/Libraries/LibCards/Card.h index 9072d26f2b..210d4bdd90 100644 --- a/Userland/Libraries/LibCards/Card.h +++ b/Userland/Libraries/LibCards/Card.h @@ -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; diff --git a/Userland/Libraries/LibCards/CardPainter.cpp b/Userland/Libraries/LibCards/CardPainter.cpp index 0c2561d013..808825afb2 100644 --- a/Userland/Libraries/LibCards/CardPainter.cpp +++ b/Userland/Libraries/LibCards/CardPainter.cpp @@ -64,16 +64,16 @@ static constexpr Gfx::CharacterBitmap s_spade { }; static constexpr Gfx::CharacterBitmap s_club { - " ### " - " ##### " - " ##### " - " ## ### ## " - "###########" - "###########" - "#### # ####" - " ## ### ## " - " ### "sv, - 11, 9 + " ### " + " ##### " + " ##### " + "## ### ##" + "#########" + "#########" + " ## # ## " + " ### " + " ### "sv, + 9, 9 }; NonnullRefPtr 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(