CardGame
Rogue-like card videogame
Loading...
Searching...
No Matches
handRenderer.h
Go to the documentation of this file.
1#ifndef HANDRENDER_H
2#define HANDRENDER_H
3
4#include "cardRenderer.h"
5
6#include <memory>
7#include <vector>
8
9class CardInstance;
10
18{
19 std::optional<std::vector<std::string>> firstRow;
20 std::optional<std::vector<std::string>> secondRow;
21};
22
31{
32 public:
42 RenderedHand renderHand(const std::vector<const CardInstance*>& handToRender) const;
43
56 std::vector<std::string>
57 renderMultipleCards(const std::vector<std::vector<std::string>>& parsedHand, size_t begin,
58 size_t end, size_t indexBase) const;
59
60 private:
61 CardRenderer m_cardRenderer{};
62
63 std::string m_gap{" "};
64 const int m_cardLabelWidth{4};
65};
66
67#endif // HANDRENDER_H
Represents a runtime instance of a card during combat.
Definition: cardInstance.h:21
Renders a CardInstance as a fixed-size ASCII grid.
Definition: cardRenderer.h:58
Renders a hand of cards as one or two rows of ASCII cards.
Definition: handRenderer.h:31
std::vector< std::string > renderMultipleCards(const std::vector< std::vector< std::string > > &parsedHand, size_t begin, size_t end, size_t indexBase) const
Renders a subrange of already-rendered cards into a single row.
Definition: handRenderer.cpp:39
RenderedHand renderHand(const std::vector< const CardInstance * > &handToRender) const
Renders the given hand into one or two terminal rows.
Definition: handRenderer.cpp:7
Rendered representation of a hand for terminal output.
Definition: handRenderer.h:18
std::optional< std::vector< std::string > > secondRow
Definition: handRenderer.h:20
std::optional< std::vector< std::string > > firstRow
Definition: handRenderer.h:19