31using CardGrid = std::vector<std::vector<Card*>>;
45 Board(
int width = 5,
int height = 1)
57#pragma region overriden functions
62 auto
onUpdate(
float dt) ->
void override;
64 auto
load(const
Stream& stream) ->
void override;
65 auto
save(
Stream& stream) const ->
void override;
75#pragma region Board Functions
92 auto
getTile(const std::pair<
int,
int>& position) const ->
Entity*;
99 auto
addCardToBoard(std::unique_ptr<
Card> cardToAdd, const std::pair<
int,
int>& positionToAddAt) ->
void;
136#pragma region Messages
140#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:97
auto getTile(const std::pair< int, int > &position) const -> Entity *
Gets the tile at the requested position.
Definition Board.cpp:307
static auto bindLuaTypes(sol::state &lua) -> void
Definition Board.h:44
friend auto from_json(const json &j, Board &b) -> void
Definition Board.cpp:90
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:378
friend auto to_json(json &j, const Board &b) -> void
Definition Board.cpp:81
static auto getEnum() -> ComponentTypeEnum
Definition Board.h:40
int boardWidth
Definition Board.h:131
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition Board.h:67
auto clearBoard() const -> void
Deletes all elements inside of the board.
Definition Board.cpp:267
~Board() override=default
Board(int width=5, int height=1)
Definition Board.h:45
auto collectCards() -> CardGrid
returns a 2d vector of cards, with each card in it's position on the board.
Definition Board.cpp:314
auto updateInternalGrid(const std::vector< Card * > &cards) -> void
Adds new cards to the internal grid.
Definition Board.cpp:359
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition Board.cpp:47
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:125
auto load(const Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition Board.cpp:71
int boardHeight
Definition Board.h:132
auto onRender() -> void override
called every frame after update has been called for every object.
Definition Board.cpp:67
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition Board.cpp:76
Board(const Board &rhs)=default
auto onUpdate(float dt) -> void override
called once every frame.
Definition Board.cpp:62
auto operator=(const Board &) -> Board &=default
Board(Board &&rhs) noexcept=default
CardGrid board
Definition Board.h:134
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:215
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:373
auto clearBoardTile(Card *card) -> void
Takes a card pointer out of the internal grid.
Definition Board.cpp:261
auto rebuildGrid() -> void
Completely regenerates the internal card grid based on the cards below it.
Definition Board.cpp:335
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:169
auto onEnterEngine() -> void override
hook that is called when a GameObject enters the Engine tree.
Definition Board.cpp:52
auto fillBoard() -> void
Creates empty buttons under the board using the width and height, intended for initialization.
Definition Board.cpp:280
ComponentTypeEnum
This enum lists out every type of component we have.
Definition Component.h:39
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:24
An indicator that loops through a parents' nodes children and can "select" them on keypress.
Definition Selector.h:32
Definition HandFinder.h:20