polygon_2d.h
1 #ifndef POLYGON_2D_H
2 #define POLYGON_2D_H
3 
4 #include "scene/2d/node_2d.h"
5 
6 class Polygon2D : public Node2D {
7 
8  OBJ_TYPE(Polygon2D,Node2D);
9 
10  DVector<Vector2> polygon;
12  Color color;
13  Ref<Texture> texture;
14  Vector2 tex_scale;
15  Vector2 tex_ofs;
16  bool tex_tile;
17  float tex_rot;
18  bool invert;
19  float invert_border;
20 
21  Vector2 offset;
22  mutable bool rect_cache_dirty;
23  mutable Rect2 item_rect;
24 
25  void _set_texture_rotationd(float p_rot);
26  float _get_texture_rotationd() const;
27 
28 protected:
29 
30  void _notification(int p_what);
31  static void _bind_methods();
32 public:
33 
34  void set_polygon(const DVector<Vector2>& p_polygon);
35  DVector<Vector2> get_polygon() const;
36 
37  void set_uv(const DVector<Vector2>& p_uv);
38  DVector<Vector2> get_uv() const;
39 
40  void set_color(const Color& p_color);
41  Color get_color() const;
42 
43  void set_texture(const Ref<Texture>& p_texture);
44  Ref<Texture> get_texture() const;
45 
46  void set_texture_offset(const Vector2& p_offset);
47  Vector2 get_texture_offset() const;
48 
49  void set_texture_rotation(float p_rot);
50  float get_texture_rotation() const;
51 
52  void set_texture_scale(const Vector2& p_scale);
53  Vector2 get_texture_scale() const;
54 
55  void set_invert(bool p_rot);
56  bool get_invert() const;
57 
58  void set_invert_border(float p_border);
59  float get_invert_border() const;
60 
61  void set_offset(const Vector2& p_offset);
62  Vector2 get_offset() const;
63 
64  //editor stuff
65 
66  virtual void edit_set_pivot(const Point2& p_pivot);
67  virtual Point2 edit_get_pivot() const;
68  virtual bool edit_has_pivot() const;
69 
70  virtual Rect2 get_item_rect() const;
71 
72  Polygon2D();
73 };
74 
75 #endif // POLYGON_2D_H
Definition: color.h:37
Definition: math_2d.h:204
Definition: math_2d.h:65
Definition: node_2d.h:34
Definition: polygon_2d.h:6