CardGame
Rogue-like card videogame
Loading...
Searching...
No Matches
HandRenderer Class Reference

Renders a hand of cards as one or two rows of ASCII cards. More...

#include <handRenderer.h>

Collaboration diagram for HandRenderer:

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.
 

Detailed Description

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.

Member Function Documentation

◆ renderHand()

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.

Parameters
handToRenderNon-owning pointers to cards currently in hand.
Returns
RenderedHand containing one or two rendered rows.

◆ renderMultipleCards()

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.

Parameters
parsedHandPre-rendered cards (each entry is a card grid).
beginFirst card index in parsedHand to render (inclusive).
endOne-past-last card index in parsedHand to render (exclusive).
indexBaseOffset used for display numbering (1-based labels are indexBase + i + 1).
Returns
A rendered row grid with an extra final line containing selection indices.

The documentation for this class was generated from the following files: