summaryrefslogtreecommitdiff
path: root/scene/resources/rectangle_shape_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/rectangle_shape_2d.cpp')
-rw-r--r--scene/resources/rectangle_shape_2d.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp
index d3332f45a5..7903d88736 100644
--- a/scene/resources/rectangle_shape_2d.cpp
+++ b/scene/resources/rectangle_shape_2d.cpp
@@ -29,7 +29,7 @@
#include "rectangle_shape_2d.h"
#include "servers/physics_2d_server.h"
-
+#include "servers/visual_server.h"
void RectangleShape2D::_update_shape() {
Physics2DServer::get_singleton()->shape_set_data(get_rid(),extents);
@@ -48,6 +48,19 @@ Vector2 RectangleShape2D::get_extents() const {
return extents;
}
+void RectangleShape2D::draw(const RID& p_to_rid,const Color& p_color) {
+
+
+ VisualServer::get_singleton()->canvas_item_add_rect(p_to_rid,Rect2(-extents,extents*2.0),p_color);
+
+}
+
+Rect2 RectangleShape2D::get_rect() const {
+
+ return Rect2(-extents,extents*2.0);
+
+}
+
void RectangleShape2D::_bind_methods() {