BuGUI
BUtton Grid User Interface
Loading...
Searching...
No Matches
painter.hpp
1#pragma once
2#include "base_painter.hpp"
3#include <bugui/geometry/rectangle.hpp>
4
5namespace bugui
6{
7struct base_controller;
8
14struct painter final
15 : base_painter
16 , rectangle
17{
18 explicit painter(int width, int height);
19
20 ~painter() { delete[] grid; }
21
23 void set(int x, int y);
26 void ofset(int x, int y);
29 void reset();
30
38
41 void draw_cell(int x, int y);
44 void draw_line(int x1, int y1, int x2, int y2);
47 void set_paint_over(bool value);
48
51 color read_clear(int x, int y);
52
53private:
54 const int x_bound;
55 const int y_bound;
56 const int max_x;
57 const int max_y;
58
59 int horizontal_ofset{0};
60 int vertical_ofset{0};
61
62 void set_cell(int x, int y);
63
64 bool paint_over{false};
65 color* grid;
66};
67
68} // namespace bugui
Serves as the root of the widget tree. Also provides access to buttons componnents.
Definition base_controller.hpp:10
Generic colour class holding RGBA coloour values. The blinking and pulsing states indicate discrete o...
Definition color.hpp:14
color read_clear(int x, int y)
Retrives the color of the cell at the given coordinates and set it to to black.
bool bound_at_offset(rectangle *bounds)
Set the size of the underlying rectangle. after aplying the coordinate offset to the bounds argument,...
void draw_line(int x1, int y1, int x2, int y2)
Paint a linear succesion of cells with the currently set color, from [x1, y1] to [x2,...
void reset()
Nullifies anny previous call to set and ofset.
void ofset(int x, int y)
Increment current displacement values by the given coordinates.
void set(int x, int y)
Explicitly set displacement values.
void set_paint_over(bool value)
Set whereter the next painted cells can be painted over or not.
void draw_cell(int x, int y)
Paint the cell at the given coordinates with the currently set color.
Provides the geometric structure of widgets.
Definition rectangle.hpp:8