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

LibCards+Solitaire: Elevate card highlight management to the card stack

Instead of indicating which individual cards should be highlighted, card
games now indicate which stack is highlighted. This lets the stack draw
empty stacks with a highlight (e.g. the Foundation stack in Solitaire).
If the stack is non-empty, the stack can delegate highlighting to the
top-most card.
This commit is contained in:
Timothy Flynn 2023-01-05 10:16:16 -05:00 committed by Andreas Kling
parent 8d8fcd0d64
commit 4cbdc747ab
6 changed files with 41 additions and 28 deletions

View file

@ -53,6 +53,8 @@ public:
void paint(GUI::Painter&, Gfx::Color background_color);
void clear();
void set_highlighted(bool highlighted) { m_highlighted = highlighted; }
private:
struct StackRules {
uint8_t shift_x { 0 };
@ -92,6 +94,7 @@ private:
Type m_type { Type::Invalid };
StackRules m_rules;
Gfx::IntRect m_base;
bool m_highlighted { false };
};
}