mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibCards: Support "previewing" cards that may be covered by other cards
For example, in Solitaire, the vertical normal stacks cover the suit of all but the topmost card in the stack. To see the suit of covered cards the user currently has to move the cards on top of them out of the way. This adds an API for games to set a card at a location to be previewed, which will draw that card on top of all other cards without moving it.
This commit is contained in:
parent
c0bc3b9814
commit
2a1fb77faf
5 changed files with 67 additions and 0 deletions
|
@ -98,12 +98,14 @@ public:
|
|||
bool is_moving() const { return m_moving; }
|
||||
bool is_upside_down() const { return m_upside_down; }
|
||||
bool is_inverted() const { return m_inverted; }
|
||||
bool is_previewed() const { return m_previewed; }
|
||||
Gfx::Color color() const { return (m_suit == Suit::Diamonds || m_suit == Suit::Hearts) ? Color::Red : Color::Black; }
|
||||
|
||||
void set_position(const Gfx::IntPoint p) { m_rect.set_location(p); }
|
||||
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_previewed(bool previewed) { m_previewed = previewed; }
|
||||
|
||||
void save_old_position();
|
||||
|
||||
|
@ -122,6 +124,7 @@ private:
|
|||
bool m_moving { false };
|
||||
bool m_upside_down { false };
|
||||
bool m_inverted { false };
|
||||
bool m_previewed { false };
|
||||
};
|
||||
|
||||
enum class Shuffle {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue