75 void drawTemplate(std::vector<std::string>& grid)
const;
87 std::string fitText(
Slot currentSlot, std::string_view text)
const;
96 void writeSlot(std::vector<std::string>& grid,
Slot slot, std::string_view formattedText)
const;
101 static void appendWord(std::string& line, std::string_view word);
106 static void appendSeparator(std::string& line, std::string_view word);
117 NameLayout drawLayout(std::string_view cardName,
Slot currentSlot)
const;
119 std::string drawEffects(
const CardParams& cardParams)
const;
121 const int m_width{24};
122 const int m_height{12};
124 const int m_nameWidth{16};
125 const int m_nameColumn{m_width / 2 - m_nameWidth / 2};
127 const char m_padding{
' '};
128 const char m_verticalBorder{
'|'};
129 const char m_horizontalBorder{
'-'};
131 Slot m_firstNameSlot{1, m_nameColumn, m_nameWidth, SlotAlignment::Center};
132 Slot m_secondNameSlot{2, m_nameColumn, m_nameWidth, SlotAlignment::Center};
134 Slot m_atkLabelSlot{5, 2, 6, SlotAlignment::Left};
135 Slot m_defLabelSlot{5, m_width - 10, 6, SlotAlignment::Left};
137 Slot m_damageValueSlot{5, 8, 2, SlotAlignment::Right};
138 Slot m_armorValueSlot{5, m_width - 4, 2, SlotAlignment::Right};
139 Slot m_effectsSumSlot{7, 3, 18, SlotAlignment::Center};
140 Slot m_firstDescrSlot{9, 2, m_width - 4, SlotAlignment::Left};
141 Slot m_secondDescrSlot{10, 2, m_width - 4, SlotAlignment::Left};
SlotAlignment
Text alignment used when fitting content into a fixed-width slot.
Definition: cardRenderer.h:17
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
std::vector< std::string > renderCard(const CardInstance &cardToRender) const
Renders the given card into an ASCII grid.
Definition: cardRenderer.cpp:9
int getCardTemplateWidth() const
Returns the fixed width of the rendered card template.
Definition: cardRenderer.h:71
Numeric parameters used to resolve gameplay effects.
Definition: cardParams.h:16
Two-line text layout produced by splitting a string to fit a slot width.
Definition: cardRenderer.h:43
std::optional< std::string > secondName
Definition: cardRenderer.h:45
std::string firstName
Definition: cardRenderer.h:44
Defines a rectangular text slot within a rendered card grid.
Definition: cardRenderer.h:30
SlotAlignment alignment
Definition: cardRenderer.h:34
int maxWidth
Definition: cardRenderer.h:33
int rowIndex
Definition: cardRenderer.h:31
int columnIndex
Definition: cardRenderer.h:32