1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

Solitaire: Add setting for number of cards to be drawn

Klondike Solitaire has a couple more modes, but this adds modes for 1-
and 3-card draws.
This commit is contained in:
Timothy Flynn 2021-05-14 23:59:23 -04:00 committed by Andreas Kling
parent 3a45bf5254
commit e310b9cd0d
3 changed files with 58 additions and 6 deletions

View file

@ -12,6 +12,11 @@
namespace Solitaire {
enum class Mode {
SingleCardDraw,
ThreeCardDraw,
};
class Game final : public GUI::Frame {
C_OBJECT(Game)
public:
@ -19,7 +24,9 @@ public:
static constexpr int height = 480;
virtual ~Game() override;
void setup();
Mode mode() const { return m_mode; }
void setup(Mode);
Function<void(uint32_t)> on_score_update;
Function<void()> on_game_start;
@ -121,6 +128,8 @@ private:
virtual void keydown_event(GUI::KeyEvent&) override;
virtual void timer_event(Core::TimerEvent&) override;
Mode m_mode { Mode::SingleCardDraw };
NonnullRefPtrVector<Card> m_focused_cards;
NonnullRefPtrVector<Card> m_new_deck;
CardStack m_stacks[StackLocation::__Count];