1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:57:35 +00:00

LibCards: Make the card back image configurable

`CardPainter::set_background_image_path()` immediately repaints the card
back and inverted card back bitmaps if they exist, so users just need
to `update()` that part of the screen. This is handled automatically by
`CardGame`, but other users will have to do this manually.
This commit is contained in:
Sam Atkins 2022-08-21 15:47:06 +01:00 committed by Andreas Kling
parent 7f46d31849
commit 40b1428194
3 changed files with 35 additions and 4 deletions

View file

@ -21,7 +21,10 @@ public:
NonnullRefPtr<Gfx::Bitmap> card_front_inverted(Suit, Rank);
NonnullRefPtr<Gfx::Bitmap> card_back_inverted();
void set_background_image_path(String path);
private:
CardPainter();
NonnullRefPtr<Gfx::Bitmap> create_card_bitmap();
void paint_card_front(Gfx::Bitmap&, Suit, Rank);
void paint_card_back(Gfx::Bitmap&);
@ -31,6 +34,8 @@ private:
Array<Array<RefPtr<Gfx::Bitmap>, to_underlying(Rank::__Count)>, to_underlying(Suit::__Count)> m_cards_inverted;
RefPtr<Gfx::Bitmap> m_card_back;
RefPtr<Gfx::Bitmap> m_card_back_inverted;
String m_background_image_path;
};
}