Function tcod::draw_frame

Function Documentation

inline void tcod::draw_frame(TCOD_Console &console, const std::array<int, 4> &rect, const std::array<int, 9> &decoration, std::optional<TCOD_ColorRGB> fg, std::optional<TCOD_ColorRGB> bg, TCOD_bkgnd_flag_t flag = TCOD_BKGND_SET, bool clear = true)

Draw a decorative frame.

decoration is given the codepoints to be used for the edges, corners, and fill of the frame in this order:

0 1 2
3 4 5
6 7 8
auto console = tcod::Console{80, 50};
static constexpr std::array<int, 9> LEGEND = {'0', '1', '2', '3', '4', '5', '6', '7', '8'};
tcod::draw_frame(console, {0, 0, 3, 3}, LEGEND, {{255, 255, 255}}, {{0, 0, 0}});

New in version 1.19.

Parameters
  • console – A reference to a TCOD_Console.

  • rect – An {x, y, width, height} rectangle, starting from the upper-left-most tile as zero.

  • decoration – The codepoints to use for the frame in row-major order.

  • fg – The foreground color. The printed text is set to this color. If std::nullopt then the foreground will be left unchanged, inheriting the previous value of the tile.

  • bg – The background color. The background tile under the printed text is set to this color. If std::nullopt then the background will be left unchanged.

  • flag – The background blending flag.

  • clear – If true then the center area will be cleared with the center decoration.