TermOx
tile.hpp
1 #ifndef TERMOX_WIDGET_WIDGETS_TILE_HPP
2 #define TERMOX_WIDGET_WIDGETS_TILE_HPP
3 #include <memory>
4 
5 #include <termox/painter/glyph.hpp>
6 #include <termox/painter/painter.hpp>
7 #include <termox/widget/widget.hpp>
8 
9 namespace ox {
10 
12 class Tile : public Widget {
13  public:
14  struct Parameters {
15  Glyph tile = U' ';
16  };
17 
18  public:
19  explicit Tile(Glyph tile = U' ');
20 
21  explicit Tile(Parameters p);
22 
23  public:
24  void set_tile(Glyph tile);
25 
26  [[nodiscard]] auto tile() -> Glyph;
27 
28  protected:
29  auto paint_event(Painter& p) -> bool override;
30 
31  private:
32  Glyph tile_;
33 };
34 
36 [[nodiscard]] auto tile(Glyph tile = U' ') -> std::unique_ptr<Tile>;
37 
39 [[nodiscard]] auto tile(Tile::Parameters parameters) -> std::unique_ptr<Tile>;
40 
41 } // namespace ox
42 #endif // TERMOX_WIDGET_WIDGETS_TILE_HPP
Contains functions to paint Glyphs to a Widget's screen area.
Definition: painter.hpp:21
A unit width/height Widget that can display a single Glyph.
Definition: tile.hpp:12
auto paint_event(Painter &p) -> bool override
Handles Paint_event objects.
Definition: tile.cpp:28
Definition: widget.hpp:31
Holds a description of a paintable tile on the screen.
Definition: glyph.hpp:11
Definition: tile.hpp:14