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

Renders a CardInstance as a fixed-size ASCII grid. More...

#include <cardRenderer.h>

Collaboration diagram for CardRenderer:

Public Member Functions

 CardRenderer ()=default
 
std::vector< std::string > renderCard (const CardInstance &cardToRender) const
 Renders the given card into an ASCII grid.
 
int getCardTemplateWidth () const
 Returns the fixed width of the rendered card template.
 

Detailed Description

Renders a CardInstance as a fixed-size ASCII grid.

CardRenderer produces a vector of strings representing a bordered card template populated with the card's name, stats, and description. Layout is slot-based: text is fit to fixed-width slots and written into the grid.

The output grid has a constant width and height defined by the renderer.

Constructor & Destructor Documentation

◆ CardRenderer()

CardRenderer::CardRenderer ( )
default

Member Function Documentation

◆ getCardTemplateWidth()

int CardRenderer::getCardTemplateWidth ( ) const
inline

Returns the fixed width of the rendered card template.

◆ renderCard()

std::vector< std::string > CardRenderer::renderCard ( const CardInstance cardToRender) const

Renders the given card into an ASCII grid.

Parameters
cardToRenderCard instance to render.
Returns
Vector of strings where each entry is one row of the card.

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