-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw_rect.h
45 lines (36 loc) · 1.3 KB
/
draw_rect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef RECON_DRAW_RECT_H
#define RECON_DRAW_RECT_H
#include "scene/gui/texture_rect.h"
class DrawRect : public TextureRect {
GDCLASS(DrawRect, TextureRect);
protected:
int thickness;
Color line_color;
Ref<Image> image;
Ref<Image> image_binary;
Rect2 rect;
bool drawing;
Vector2 last_point;
Variant extents_max;
Variant extents_min;
static void _bind_methods();
virtual void _gui_input(const Ref<InputEvent> &p_event);
public:
void init_white();
void reset_last_point();
void update_extents(const Vector2 &p_point);
void draw(const Vector2 &p_point);
void draw_line_to(const Vector2 &p_final_point);
void on_parent_resized();
void set_thickness(int p_thickness) { thickness = p_thickness; }
int get_thickness() const { return thickness; }
void set_extents_min(Variant p_extents) { extents_min = p_extents; }
Variant get_extents_min() const { return extents_min; }
void set_extents_max(Variant p_extents) { extents_max = p_extents; }
Variant get_extents_max() const { return extents_max; }
void set_line_color(Color p_color) { line_color = p_color; }
Color get_line_color() const { return line_color; }
Ref<Image> get_image_binary() const { return image_binary; }
DrawRect();
};
#endif // RECON_DRAW_RECT_H