Brunot
Loading...
Searching...
No Matches
GameRules.h
Go to the documentation of this file.
1
11// ____ __ __ __
12// /\__ _\/\ \ /\ \/\ \
13// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
14// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
15// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
16// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
17// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
18
19
20#pragma once
21
22#include "Framework/System.h"
25
26namespace sys
27{
28class GameRules : public System
29{
30public:
31#pragma region static_functions
32
36 static auto getEnum() -> Type
37 {
38 return Type::GameRules;
39 }
40
41#pragma endregion
42
43 GameRules();
44 ~GameRules() override = default;
45 GameRules(const GameRules& other) = default;
46 GameRules(GameRules&& other) noexcept = default;
47 auto operator=(const GameRules& other) -> GameRules&;
48 auto operator=(GameRules&& other) noexcept -> GameRules& = default;
49
50
51#pragma region overridden_functions
52
53 auto clone() const -> std::unique_ptr<GameObject> override
54 {
55 return std::make_unique<GameRules>(*this);
56 }
57
58 auto onUpdate(float dt) -> void override;
59
60 auto systemShowMenu() -> void override;
61 auto endWindow() -> void override
62 {
63 }; // for debug ImGUI
64 auto onRender() -> void override;
65 auto load(const Stream& stream) -> void override;
66 auto save(Stream& stream) const -> void override;
67
68#pragma endregion
69
70#pragma region GameRules_Functions
71
76 [[nodiscard]] auto getSeed() const -> unsigned int;
82 auto setSeed(unsigned int seed) -> void;
83
84 auto getMaxPlayerCards() const -> int;
85 auto setMaxPlayerCards(int newMax) -> void;
86
87 auto getCardsPlayedPerTurnLimit() const -> int;
88 auto setCardsPlayedPerTurnLimit(int newMax) -> void;
89
90 auto getBoardDimensions() const -> const std::pair<int, int>&;
91 auto setBoardDimensions(const std::pair<int, int>& newDimensions) -> void;
92
93 auto getPlayerTimeLimit() const -> float;
94 auto setPlayerTimeLimit(float newLimit) -> void;
95
96 auto getTimeLimitPointPenalty() const -> int;
97 auto setTimeLimitPointPenalty(int newPenalty) -> void;
98
99 auto getScoreCalculator() const -> bool;
100 auto setScoreCalculator(bool enabled) -> void;
101
102 auto getHandTypeColor(HandRating::HandType handType) const -> Vector4D;
103 auto getHandTypeValue(HandRating::HandType handType) const -> int;
104
105 auto setHelpPopUp(bool enabled) -> void;
106 auto getHelpPopUp() const -> bool;
107
108 auto getPlayerCount() const -> int;
109 auto setPlayerCount(int count) -> void;
110
115 auto getPassAndPlay() const -> bool;
116 auto setPassAndPlay(bool newState) -> void;
117
118#pragma endregion
119
120private:
121#pragma region member_variables
122
124 bool useSetSeed = false;
126 unsigned int seed;
127
130 std::pair<int, int> boardDimensions;
131
134
137
139 bool scoreCalculator = false;
140
141 // this currently is not used anywhere!!!!! but i'm adding it rn because we should have it at some point
143 float gameSpeedModifier = 1.f;
144
146 int playerCount = 0;
147
149 bool passAndPlay = false;
150
152 Vector4D straightFlushColor = { 0.5f, 0.02f, 0.92f, 1.0f };
153 Vector4D quadsColor = { 1.0f, 0.84f, 0.23f, 1.0f };
154 Vector4D fullHouseColor = { 0.f, 0.f, 1.0f, 1.0f };
155 Vector4D flushColor = { 0.f, 1.0f, 1.0f, 1.0f };
156 Vector4D straightColor = { 0.5f, 0.f, 1.0f, 1.0f };
157 Vector4D tripsColor = { 1.0f, 0.f, 0.f, 1.0f };
158 Vector4D twoPairColor = { 1.0f, 0.5f, 0.f, 1.0f };
159 Vector4D pairColor = { 1.0f, 1.0f, 0.f, 1.0f };
160 Vector4D highCardColor = { 0.6f, 1.0f, 1.0f, 1.0f };
161
162 // if the help pop up happens automatically at the start of the game
163 bool helpPopUp = true;
164
165#pragma endregion
166
167#pragma region helper_functions
168
169#pragma endregion
170
171#pragma region static_variables
172
173#pragma endregion
174
175
176};
177}
sys::Json Stream
Definition AudioObject.h:20
A class that can get the score of a hand.
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:24
Definition HandRating.h:30
Type
Definition System.h:20
@ GameRules
Definition System.h:41
System(const std::string &typeName, Type systemType)
Definition System.cpp:75
auto setScoreCalculator(bool enabled) -> void
Definition GameRules.cpp:206
auto setSeed(unsigned int seed) -> void
if for some reason you want set the seed manually in code, instead of ImGui, you can set it here make...
Definition GameRules.cpp:141
auto setHelpPopUp(bool enabled) -> void
Definition GameRules.cpp:245
GameRules(GameRules &&other) noexcept=default
unsigned int seed
seed to use to seed random generators for gameplay events
Definition GameRules.h:126
auto getBoardDimensions() const -> const std::pair< int, int > &
Definition GameRules.cpp:171
int timeLimitPointPenalty
The amount of points players lose if they run out of time.
Definition GameRules.h:136
auto setPlayerCount(int count) -> void
Definition GameRules.cpp:260
bool useSetSeed
whether GameRules should generate seed from a random number on construction
Definition GameRules.h:124
auto getSeed() const -> unsigned int
get the seed we use for making random number generators, so we can have a consistent gameplay if we w...
Definition GameRules.cpp:136
bool scoreCalculator
if the player has scoring calculator enabled
Definition GameRules.h:139
auto getCardsPlayedPerTurnLimit() const -> int
Definition GameRules.cpp:161
auto getTimeLimitPointPenalty() const -> int
Definition GameRules.cpp:191
auto systemShowMenu() -> void override
Specific systems should override this function to show their specific menu for the system.
Definition GameRules.cpp:107
auto getHelpPopUp() const -> bool
Definition GameRules.cpp:250
Vector4D twoPairColor
Definition GameRules.h:158
bool passAndPlay
If we want to support multiple device inputs at the same time in the gameplay scene.
Definition GameRules.h:149
auto operator=(const GameRules &other) -> GameRules &
Definition GameRules.cpp:88
auto getPlayerTimeLimit() const -> float
Definition GameRules.cpp:181
auto setCardsPlayedPerTurnLimit(int newMax) -> void
Definition GameRules.cpp:166
auto getPlayerCount() const -> int
Definition GameRules.cpp:255
GameRules(const GameRules &other)=default
Vector4D tripsColor
Definition GameRules.h:157
bool helpPopUp
Definition GameRules.h:163
std::pair< int, int > boardDimensions
Definition GameRules.h:130
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition GameRules.h:53
Vector4D quadsColor
Definition GameRules.h:153
auto setBoardDimensions(const std::pair< int, int > &newDimensions) -> void
Definition GameRules.cpp:176
Vector4D fullHouseColor
Definition GameRules.h:154
Vector4D pairColor
Definition GameRules.h:159
auto onUpdate(float dt) -> void override
called once every frame.
Definition GameRules.cpp:102
auto onRender() -> void override
called every frame after update has been called for every object.
Definition GameRules.cpp:122
int playerCount
Tracks how many players we want in our game.
Definition GameRules.h:146
float timeLimitPerPlayer
The time limit is stored in seconds.
Definition GameRules.h:133
auto setPassAndPlay(bool newState) -> void
Definition GameRules.cpp:270
auto setPlayerTimeLimit(float newLimit) -> void
Definition GameRules.cpp:186
auto setTimeLimitPointPenalty(int newPenalty) -> void
Definition GameRules.cpp:196
Vector4D flushColor
Definition GameRules.h:155
auto load(const Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition GameRules.cpp:126
Vector4D straightColor
Definition GameRules.h:156
auto setMaxPlayerCards(int newMax) -> void
Definition GameRules.cpp:156
auto getMaxPlayerCards() const -> int
Definition GameRules.cpp:151
int maxCardsPerPlayerHand
Definition GameRules.h:128
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition GameRules.h:61
auto getHandTypeColor(HandRating::HandType handType) const -> Vector4D
Definition GameRules.cpp:211
~GameRules() override=default
auto getScoreCalculator() const -> bool
Definition GameRules.cpp:201
GameRules()
Definition GameRules.cpp:77
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition GameRules.cpp:131
auto getHandTypeValue(HandRating::HandType handType) const -> int
Definition GameRules.cpp:240
auto operator=(GameRules &&other) noexcept -> GameRules &=default
Vector4D highCardColor
Definition GameRules.h:160
Vector4D straightFlushColor
the different colors for hand types
Definition GameRules.h:152
float gameSpeedModifier
Affects the speed of the animations in game.
Definition GameRules.h:143
static auto getEnum() -> Type
function required by all systems
Definition GameRules.h:36
auto getPassAndPlay() const -> bool
Sets if we want to pass and play when we start the gameplay scene Also causes us to load PlayerCountS...
Definition GameRules.cpp:265
int maxNumberOfCardsPlayedPerTurn
Definition GameRules.h:129
the type of elements in a basic_json container
Definition GameObject.h:37
Definition Vector4D.h:28