|
CardGame
Rogue-like card videogame
|
Renders a hand of cards as one or two rows of ASCII cards. More...
#include <handRenderer.h>
Public Member Functions | |
| RenderedHand | renderHand (const std::vector< const CardInstance * > &handToRender) const |
| Renders the given hand into one or two terminal rows. | |
| 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. | |
Renders a hand of cards as one or two rows of ASCII cards.
HandRenderer uses CardRenderer to render individual cards, then horizontally concatenates them with a fixed gap. A selection index line is appended below each rendered row to support terminal input by card number.
| RenderedHand HandRenderer::renderHand | ( | const std::vector< const CardInstance * > & | handToRender | ) | const |
Renders the given hand into one or two terminal rows.
If the hand is empty, returns a RenderedHand with no rows set. For large hands, the cards are split across two rows.
| handToRender | Non-owning pointers to cards currently in hand. |
| std::vector< std::string > HandRenderer::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.
Concatenates the ASCII grids in the range [begin, end) and appends a centered selection index line using indexBase for numbering.
| parsedHand | Pre-rendered cards (each entry is a card grid). |
| begin | First card index in parsedHand to render (inclusive). |
| end | One-past-last card index in parsedHand to render (exclusive). |
| indexBase | Offset used for display numbering (1-based labels are indexBase + i + 1). |