31using CardGrid = std::vector<std::vector<Card>>;
40 Board(
int width = 5,
int height = 1)
52#pragma region overriden functions
57 auto
onUpdate(
float dt) ->
void override;
60 auto
save(
Stream& stream) const ->
void override;
70#pragma region Gameplay Functions
89 auto
addCardToBoard(std::unique_ptr<
Card> cardToAdd, const std::pair<
int,
int>& positionToAddAt) ->
void;
121#pragma region Messages
125#pragma region helper functions
sys::Json Stream
Definition AudioObject.h:20
std::vector< std::vector< Card > > CardGrid
Definition Board.h:31
The base class for components, holding all of their shared All components should inherit from this.
nlohmann::json json
Definition Json.cpp:19
Component that is responsible for managing the gameplay board, where cards are placed by Players.
Definition Board.h:38
auto componentShowMenu() -> void override
Definition Board.cpp:90
friend auto from_json(const json &j, Board &b) -> void
Definition Board.cpp:83
auto makePlayerHandFromRow(int rowIndex) const -> std::vector< PlayerHand >
Goes through a column in the card grid and finds all the player hands.
Definition Board.cpp:345
friend auto to_json(json &j, const Board &b) -> void
Definition Board.cpp:74
int boardWidth
Definition Board.h:116
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition Board.h:62
auto onEnterEngine() -> void override
hook that is called when a GameObject enters the Engine tree.
Definition Board.cpp:50
auto clearBoard() const -> void
Deletes all elements inside of the board.
Definition Board.cpp:232
~Board() override=default
Board(int width=5, int height=1)
Definition Board.h:40
auto collectCards() -> CardGrid
returns a 2d vector of cards, with each card in it's position on the board.
Definition Board.cpp:280
auto updateInternalGrid(const std::vector< Card * > &cards) -> void
Adds new cards to the internal grid.
Definition Board.cpp:325
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition Board.cpp:45
auto addCardToBoard(std::unique_ptr< Card > cardToAdd, const std::pair< int, int > &positionToAddAt) -> void
Adds a card component to an entity inside of the board menu.
Definition Board.cpp:118
int boardHeight
Definition Board.h:117
auto onRender() -> void override
called every frame after update has been called for every object.
Definition Board.cpp:60
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition Board.cpp:69
Board(const Board &rhs)=default
auto onUpdate(float dt) -> void override
called once every frame.
Definition Board.cpp:55
auto operator=(const Board &) -> Board &=default
Board(Board &&rhs) noexcept=default
CardGrid board
Definition Board.h:119
auto getHandsFromPlayedCards(const std::vector< Card * > &cards) -> std::vector< PlayerHand >
checks the rows and columns specifically from the played cards stored in Table
Definition Board.cpp:186
auto makePlayerHandFromColumn(int columnIndex) const -> std::vector< PlayerHand >
Goes through a column in the card grid and finds all the player hands.
Definition Board.cpp:340
auto load(Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition Board.cpp:64
auto rebuildGrid() -> void
Completely regenerates the internal card grid based on the cards below it.
Definition Board.cpp:301
auto getHandsFromCards(const std::vector< Card * > &cards) -> std::vector< PlayerHand >
Checks the rows and columns specifically from the played cards stored in Table.
Definition Board.cpp:140
auto fillBoard() -> void
Creates empty buttons under the board using the width and height, intended for initialization.
Definition Board.cpp:245
@ cBoard
Definition Component.h:47
Component(ComponentTypeEnum type, const char *typeName)
Definition Component.cpp:72
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:23
An indicator that loops through a parents' nodes children and can "select" them on keypress.
Definition Selector.h:31
Definition HandFinder.h:20