summaryrefslogtreecommitdiff
path: root/main/tests/test_physics_2d.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-15 09:49:58 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-15 09:50:27 -0300
commit52e2a1e98df9f1a7d69c2b35c7be9edc1a8e9753 (patch)
treee2aabb4d21d102ad4f6da8b47e08ea3edcdb782b /main/tests/test_physics_2d.cpp
parenta7854d3ae6a81093b1cf23da3dd99b57b1aebc34 (diff)
fixed to 2D physics, makes it work again
Diffstat (limited to 'main/tests/test_physics_2d.cpp')
-rw-r--r--main/tests/test_physics_2d.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp
index 8a6a8c78f9..76d1afd2ac 100644
--- a/main/tests/test_physics_2d.cpp
+++ b/main/tests/test_physics_2d.cpp
@@ -63,7 +63,7 @@ class TestPhysics2DMainLoop : public MainLoop {
};
- BodyShapeData body_shape_data[6];
+ BodyShapeData body_shape_data[8];
void _create_body_shape_data() {
@@ -191,7 +191,7 @@ class TestPhysics2DMainLoop : public MainLoop {
Image image(convex_png);
- body_shape_data[Physics2DServer::SHAPE_CUSTOM+1].image=vs->texture_create_from_image(image);
+ body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].image=vs->texture_create_from_image(image);
RID convex_polygon_shape = ps->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON);
@@ -206,7 +206,7 @@ class TestPhysics2DMainLoop : public MainLoop {
arr.push_back(Point2(11,7)-sb);
ps->shape_set_data(convex_polygon_shape,arr);
- body_shape_data[Physics2DServer::SHAPE_CUSTOM+1].shape = convex_polygon_shape;
+ body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].shape = convex_polygon_shape;
}
@@ -382,8 +382,13 @@ public:
RID vp = vs->viewport_create();
canvas = vs->canvas_create();
+
+ Size2i screen_size = OS::get_singleton()->get_window_size();
vs->viewport_attach_canvas(vp,canvas);
- vs->viewport_attach_to_screen(vp,Rect2(Vector2(),OS::get_singleton()->get_window_size()));
+ vs->viewport_set_size(vp,screen_size.x,screen_size.y);
+ vs->viewport_attach_to_screen(vp,Rect2(Vector2(),screen_size));
+ vs->viewport_set_active(vp,true);
+
Transform2D smaller;
//smaller.scale(Vector2(0.6,0.6));
//smaller.elements[2]=Vector2(100,0);