1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:07:34 +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

@ -104,13 +104,12 @@ public:
void set_moving(bool moving) { m_moving = moving; }
void set_upside_down(bool upside_down) { m_upside_down = upside_down; }
void set_inverted(bool inverted) { m_inverted = inverted; }
void set_highlighted(bool highlighted) { m_highlighted = highlighted; }
void save_old_position();
void paint(GUI::Painter&) const;
void paint(GUI::Painter&, bool highlighted = false) const;
void clear(GUI::Painter&, Color background_color) const;
void clear_and_paint(GUI::Painter& painter, Color background_color);
void clear_and_paint(GUI::Painter& painter, Color background_color, bool highlighted);
private:
Card(Suit, Rank);
@ -123,7 +122,6 @@ private:
bool m_moving { false };
bool m_upside_down { false };
bool m_inverted { false };
bool m_highlighted { false };
};
enum class Shuffle {