1 #ifndef TERMOX_PAINTER_GLYPH_HPP
2 #define TERMOX_PAINTER_GLYPH_HPP
5 #include <termox/painter/brush.hpp>
27 template <
typename... Items>
37 template <
typename... Items>
38 constexpr
Glyph(
char sym, Items... items)
39 :
symbol{static_cast<char32_t>(sym)},
brush{items...}
45 auto constexpr operator|=(Glyph& g, Traits ts) -> Glyph&
51 [[nodiscard]]
auto constexpr operator|(Glyph g, Traits ts) -> Glyph
61 [[nodiscard]]
auto constexpr operator|(char32_t g, Trait t) ->
ox::Glyph
66 [[nodiscard]]
auto constexpr operator|(char32_t g, Traits ts) ->
ox::Glyph
71 [[nodiscard]]
auto constexpr operator|(
char g, Trait t) ->
ox::Glyph
76 [[nodiscard]]
auto constexpr operator|(
char g, Traits ts) ->
ox::Glyph
87 auto constexpr operator|=(Glyph& g, Background_color c) -> Glyph&
89 g.brush.background = Color{c.value};
93 [[nodiscard]]
auto constexpr operator|(Glyph g, Background_color c) -> Glyph
95 g.brush.background = Color{c.value};
99 [[nodiscard]]
auto constexpr operator|(char32_t g, Background_color c) -> Glyph
104 [[nodiscard]]
auto constexpr operator|(
char g, Background_color c) ->
ox::Glyph
111 auto constexpr operator|=(Glyph& g, Foreground_color c) -> Glyph&
113 g.brush.foreground = Color{c.value};
117 [[nodiscard]]
auto constexpr operator|(Glyph g, Foreground_color c) -> Glyph
119 g.brush.foreground = Color{c.value};
123 [[nodiscard]]
auto constexpr operator|(char32_t g, Foreground_color c) -> Glyph
128 [[nodiscard]]
auto constexpr operator|(
char g, Foreground_color c) ->
ox::Glyph
136 [[nodiscard]]
auto constexpr operator==(Glyph lhs, Glyph rhs) ->
bool
138 return (lhs.symbol == rhs.symbol) && (lhs.brush == rhs.brush);
142 [[nodiscard]]
auto constexpr operator!=(Glyph lhs, Glyph rhs) ->
bool
144 return !(lhs == rhs);
Holds the look of any paintable object with Traits and Colors.
Definition: brush.hpp:13
Holds a description of a paintable tile on the screen.
Definition: glyph.hpp:11
constexpr Glyph(char sym, Items... items)
Construct with the provided char32_t and list of Traits and Colors.
Definition: glyph.hpp:38
constexpr Glyph(char sym, Brush b)
Construct a Glyph with the provided char and Brush.
Definition: glyph.hpp:32
char32_t symbol
The Glyph's symbol is the wide character that will be displayed.
Definition: glyph.hpp:14
constexpr Glyph(char32_t sym, Brush b)
Construct a Glyph with the provided char32_t and Brush.
Definition: glyph.hpp:24
Brush brush
The Brush that will determine the Traits and Colors of the symbol.
Definition: glyph.hpp:17
constexpr Glyph(char32_t sym, Items... items)
Construct with the provided char32_t and list of Traits and Colors.
Definition: glyph.hpp:28
constexpr Glyph()=default
Construct an invisible Glyph, defaults to space and no traits/colors.