Debian Codegraph @

scene/main/canvas_layer.h

raw symbols SCIP
1 /**************************************************************************/
2 /* canvas_layer.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "scene/main/node.h"
34
35 class Viewport;
36 class CanvasLayer : public Node {
37 GDCLASS(CanvasLayer, Node);
38
39 mutable bool locrotscale_dirty = false;
40 mutable Vector2 ofs;
41 mutable Size2 scale = Vector2(1, 1);
42 mutable real_t rot = 0.0;
43 int layer = 1;
44 Transform2D transform;
45 RID canvas;
46
47 ObjectID custom_viewport_id; // to check validity
48 Viewport *custom_viewport = nullptr;
49
50 RID viewport;
51 Viewport *vp = nullptr;
52
53 int sort_index = 0;
54 bool visible = true;
55
56 bool follow_viewport = false;
57 float follow_viewport_scale = 1.0;
58
59 void _update_xform();
60 void _update_locrotscale() const;
61 void _update_follow_viewport(bool p_force_exit = false);
62
63 protected:
64 void _notification(int p_what);
65 static void _bind_methods();
66
67 public:
68 void update_draw_order();
69
70 void set_layer(int p_xform);
71 int get_layer() const;
72
73 void set_visible(bool p_visible);
74 bool is_visible() const;
75 void show();
76 void hide();
77
78 void set_transform(const Transform2D &p_xform);
79 Transform2D get_transform() const;
80 Transform2D get_final_transform() const;
81
82 void set_offset(const Vector2 &p_offset);
83 Vector2 get_offset() const;
84
85 void set_rotation(real_t p_radians);
86 real_t get_rotation() const;
87
88 void set_scale(const Size2 &p_scale);
89 Size2 get_scale() const;
90
91 Size2 get_viewport_size() const;
92
93 RID get_viewport() const;
94
95 void set_custom_viewport(Node *p_viewport);
96 Node *get_custom_viewport() const;
97
98 void reset_sort_index();
99 int get_sort_index();
100
101 void set_follow_viewport(bool p_enable);
102 bool is_following_viewport() const;
103
104 void set_follow_viewport_scale(float p_ratio);
105 float get_follow_viewport_scale() const;
106
107 RID get_canvas() const;
108
109 CanvasLayer();
110 ~CanvasLayer();
111 };