BuGUI
BUtton Grid User Interface
Loading...
Searching...
No Matches
rectangle.hpp
1#pragma once
2#include "point.hpp"
3
4namespace bugui
5{
8{
9 ~rectangle() = default;
10
11 int get_x() const { return top_left.x; };
12 int get_y() const { return top_left.y; };
13
14 void set_x(int new_x);
15 void set_y(int new_y);
16
17 int get_width() const { return width; };
18 int get_height() const { return height; };
19
20 void set_width(int new_width);
21 void set_height(int new_height);
22
23 void set_size(int new_size);
24
25 void set(int new_x, int new_y);
26
27 void set(int new_x, int new_y, int new_width, int new_height);
28
29 const point& get_top_left() const { return top_left; };
30 const point& get_bottom_right() const { return bottom_right; };
31
32 void set_top_left(point&& new_top_left);
33
34 void set_bottom_right(point&& new_bottom_right);
35
36protected:
47 virtual bool overlap(rectangle& other) const;
48
49private:
50 point top_left{0, 0};
51 point bottom_right{1, 1};
52
53 int width{1};
54 int height{1};
55};
56
57} // namespace bugui
Provides the basics of 2D geometry. Primarily used as the top left and bottom right corners of the re...
Definition point.hpp:11
Provides the geometric structure of widgets.
Definition rectangle.hpp:8
virtual bool overlap(rectangle &other) const
Checks whether this rectangle overlaps with another. This funciton is the bassis for handling inputs ...