GigaPasjans
Loading...
Searching...
No Matches
Card.h
1// Wykonane przez Piotra Chudzińskiego w dniu 13.04.2025
2#pragma once
3
4#include <andromenda/Color.h>
5#include <foundation/math/Int2.h>
6#include <phosphorus/GameObject.h>
7
8namespace Game
9{
10 class Deck;
11 class CardStack;
12
17 enum class CardColor : wchar_t
18 {
19 Hearts = L'♥',
20 Diamonds = L'♦',
21 Spades = L'♠',
22 Clubs = L'♣'
23 };
24
25 // manualny rozmiar jest dobrze zeby wiedziec ze jak cos nowego dodam to zeby tutaj dodac
26 static constexpr std::array<CardColor, 4> CardColors = {CardColor::Hearts, CardColor::Diamonds, CardColor::Spades,
27 CardColor::Clubs};
28
33 enum class CardType : wchar_t
34 {
35 Ace = L'A',
36 N2 = L'2',
37 N3 = L'3',
38 N4 = L'4',
39 N5 = L'5',
40 N6 = L'6',
41 N7 = L'7',
42 N8 = L'8',
43 N9 = L'9',
44 N10 = L'\0',
45 Jack = L'J',
46 Queen = L'Q',
47 King = L'K',
48 };
49
50 // manualny rozmiar jest dobrze zeby wiedziec ze jak cos nowego dodam to zeby tutaj dodac
51 static constexpr std::array<CardType, 13> CardTypes = {
52 CardType::Ace, CardType::N2, CardType::N3, CardType::N4, CardType::N5, CardType::N6, CardType::N7,
53 CardType::N8, CardType::N9, CardType::N10, CardType::Jack, CardType::Queen, CardType::King};
54
60 class Card : public Phosphorus::GameObject
61 {
62 protected:
63 friend class CardStack;
64 friend struct CardInteraction;
65
69 bool m_IsEmpty = true;
70
74 CardStack *m_Stack = nullptr;
75
79 bool m_Dirty = false;
80
82 GameObject *clone() override;
83
85 [[nodiscard]] String GetIdentifer() const override;
86
87 public:
92
97
101 Phosphorus::BoolParameter Flipped;
102
103 Card();
104
105 ~Card() override = default;
106
107 Card(const String &identifier);
108
109 Card(const CardType &type, const CardColor &color);
110
114 [[nodiscard]] enum Color GetTint() const;
115
119 [[nodiscard]] CardStack *GetStack() const;
120 };
121
122
123 inline Card Empty;
124} // namespace Game
Represents a playing card in a game. This class defines a card with properties such as color,...
Definition Card.h:61
GameObject * clone() override
Definition Card.cpp:20
bool m_IsEmpty
Indicates if the card is empty.
Definition Card.h:69
CardStack * GetStack() const
Gets the stack the card belongs to.
Definition Card.cpp:61
Phosphorus::BoolParameter Flipped
Whether the card is flipped.
Definition Card.h:101
String GetIdentifer() const override
Definition Card.cpp:22
CardStack * m_Stack
The stack this card belongs to.
Definition Card.h:74
enum Color GetTint() const
Gets the tint color of the card.
Definition Card.cpp:63
bool m_Dirty
Whether the card's state has changed.
Definition Card.h:79
Phosphorus::EnumParameter< CardType > Type
The card's type.
Definition Card.h:96
Phosphorus::EnumParameter< CardColor > Color
The card's color.
Definition Card.h:91
Represents a stack of cards in the game.
Definition Deck.h:14
Represents a deck of cards, including all stacks.
Definition Deck.h:78
Templated enum parameter. Derived from BaseEnumParameter.
Definition GameObject.h:216
Represents named set of parameters which can be serialized.
Definition GameObject.h:274
Represents a mutable sequence of characters, providing various member functions for string manipulati...
Definition String.h:16