From 17fa1d77567d2919bff87176bdd671cc86dbd447 Mon Sep 17 00:00:00 2001 From: Leandro Dorileo Date: Wed, 10 Oct 2012 19:18:15 +0000 Subject: [PATCH] EPhysics: add depth parameter to boundary api Patch by: Leandro Dorileo SVN revision: 77785 --- legacy/ephysics/src/bin/ephysics_sandbox.c | 9 ++++---- legacy/ephysics/src/bin/test_bouncing_ball.c | 8 +++---- legacy/ephysics/src/bin/test_bouncing_text.c | 2 +- .../ephysics/src/bin/test_colliding_balls.c | 8 +++---- .../src/bin/test_collision_detection.c | 8 +++---- .../ephysics/src/bin/test_collision_filter.c | 8 +++---- .../ephysics/src/bin/test_collision_speed.c | 8 +++---- legacy/ephysics/src/bin/test_constraint.c | 2 +- legacy/ephysics/src/bin/test_delete.c | 6 ++--- .../ephysics/src/bin/test_falling_letters.c | 2 +- legacy/ephysics/src/bin/test_flag.c | 8 +++---- legacy/ephysics/src/bin/test_forces.c | 8 +++---- legacy/ephysics/src/bin/test_grab.c | 8 +++---- legacy/ephysics/src/bin/test_growing_balls.c | 8 +++---- legacy/ephysics/src/bin/test_heavy.c | 8 +++---- legacy/ephysics/src/bin/test_jumping_balls.c | 8 +++---- legacy/ephysics/src/bin/test_material.c | 2 +- legacy/ephysics/src/bin/test_no_gravity.c | 8 +++---- legacy/ephysics/src/bin/test_rotate.c | 2 +- legacy/ephysics/src/bin/test_shapes.c | 8 +++---- .../src/bin/test_sleeping_threshold.c | 8 +++---- legacy/ephysics/src/bin/test_slider.c | 4 ++-- legacy/ephysics/src/bin/test_soft_body.c | 8 +++---- legacy/ephysics/src/bin/test_velocity.c | 8 +++---- legacy/ephysics/src/bin/test_win_resize.c | 8 +++---- legacy/ephysics/src/lib/EPhysics.h | 12 ++++++---- legacy/ephysics/src/lib/ephysics_body.cpp | 22 +++++++++---------- 27 files changed, 102 insertions(+), 97 deletions(-) diff --git a/legacy/ephysics/src/bin/ephysics_sandbox.c b/legacy/ephysics/src/bin/ephysics_sandbox.c index edea23d1a1..935af2e586 100644 --- a/legacy/ephysics/src/bin/ephysics_sandbox.c +++ b/legacy/ephysics/src/bin/ephysics_sandbox.c @@ -846,11 +846,12 @@ _sandie_world_add(Evas_Object *win) world = ephysics_world_new(); ephysics_world_render_geometry_set(world, 80, 80, (int) WIDTH * 0.7 - 160, HEIGHT - 160); - evas_object_data_set(win, "top", ephysics_body_top_boundary_add(world)); + evas_object_data_set(win, "top", ephysics_body_top_boundary_add(world, 10)); evas_object_data_set(win, "bottom", - ephysics_body_bottom_boundary_add(world)); - evas_object_data_set(win, "left", ephysics_body_left_boundary_add(world)); - evas_object_data_set(win, "right", ephysics_body_right_boundary_add(world)); + ephysics_body_bottom_boundary_add(world, 10)); + evas_object_data_set(win, "left", ephysics_body_left_boundary_add(world, 10)); + evas_object_data_set(win, "right", ephysics_body_right_boundary_add(world, + 10)); return world; } diff --git a/legacy/ephysics/src/bin/test_bouncing_ball.c b/legacy/ephysics/src/bin/test_bouncing_ball.c index 7ba51b0680..aa56f8e1b6 100644 --- a/legacy/ephysics/src/bin/test_bouncing_ball.c +++ b/legacy/ephysics/src/bin/test_bouncing_ball.c @@ -91,19 +91,19 @@ test_bouncing_ball(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 4); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - ephysics_body_top_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); _world_populate(test_data); elm_object_event_callback_add(test_data->win, _on_keydown, test_data->data); diff --git a/legacy/ephysics/src/bin/test_bouncing_text.c b/legacy/ephysics/src/bin/test_bouncing_text.c index 6170c8834d..166d118907 100644 --- a/legacy/ephysics/src/bin/test_bouncing_text.c +++ b/legacy/ephysics/src/bin/test_bouncing_text.c @@ -58,7 +58,7 @@ test_bouncing_text(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 2); diff --git a/legacy/ephysics/src/bin/test_colliding_balls.c b/legacy/ephysics/src/bin/test_colliding_balls.c index 44b4723b74..e27e4c21e3 100644 --- a/legacy/ephysics/src/bin/test_colliding_balls.c +++ b/legacy/ephysics/src/bin/test_colliding_balls.c @@ -77,13 +77,13 @@ test_colliding_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *e ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 2); - ephysics_body_top_boundary_add(test_data->world); - ephysics_body_left_boundary_add(test_data->world); - ephysics_body_right_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); + ephysics_body_left_boundary_add(test_data->world, 10); + ephysics_body_right_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_collision_detection.c b/legacy/ephysics/src/bin/test_collision_detection.c index b5a4359640..7b7122e875 100644 --- a/legacy/ephysics/src/bin/test_collision_detection.c +++ b/legacy/ephysics/src/bin/test_collision_detection.c @@ -168,15 +168,15 @@ test_collision(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); collision_data->base.world = world; - boundary = ephysics_body_bottom_boundary_add(collision_data->base.world); + boundary = ephysics_body_bottom_boundary_add(collision_data->base.world, 10); ephysics_body_restitution_set(boundary, 0); ephysics_body_friction_set(boundary, 20); - boundary = ephysics_body_right_boundary_add(collision_data->base.world); + boundary = ephysics_body_right_boundary_add(collision_data->base.world, 10); ephysics_body_restitution_set(boundary, 0.8); - ephysics_body_left_boundary_add(collision_data->base.world); - ephysics_body_top_boundary_add(collision_data->base.world); + ephysics_body_left_boundary_add(collision_data->base.world, 10); + ephysics_body_top_boundary_add(collision_data->base.world, 10); _world_populate(collision_data); diff --git a/legacy/ephysics/src/bin/test_collision_filter.c b/legacy/ephysics/src/bin/test_collision_filter.c index 4759b6103f..5b5302ca88 100644 --- a/legacy/ephysics/src/bin/test_collision_filter.c +++ b/legacy/ephysics/src/bin/test_collision_filter.c @@ -70,7 +70,7 @@ test_collision_filter(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void * ephysics_world_render_geometry_set(world, 60, 40, WIDTH - 120, FLOOR_Y - 32); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 30); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 2); @@ -82,9 +82,9 @@ test_collision_filter(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void * ephysics_body_mass_set(boundary, 0); ephysics_body_collision_group_add(boundary, "blue-ball"); - ephysics_body_top_boundary_add(test_data->world); - ephysics_body_left_boundary_add(test_data->world); - ephysics_body_right_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 30); + ephysics_body_left_boundary_add(test_data->world, 30); + ephysics_body_right_boundary_add(test_data->world, 30); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_collision_speed.c b/legacy/ephysics/src/bin/test_collision_speed.c index 6c4ce25a4b..a788cf5d5b 100644 --- a/legacy/ephysics/src/bin/test_collision_speed.c +++ b/legacy/ephysics/src/bin/test_collision_speed.c @@ -130,19 +130,19 @@ test_collision_speed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *e ephysics_world_simulation_set(world, 1/260.f, 5); speed_data->base.world = world; - boundary = ephysics_body_bottom_boundary_add(world); + boundary = ephysics_body_bottom_boundary_add(world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 4); - boundary = ephysics_body_right_boundary_add(world); + boundary = ephysics_body_right_boundary_add(world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - boundary = ephysics_body_left_boundary_add(world); + boundary = ephysics_body_left_boundary_add(world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - ephysics_body_top_boundary_add(world); + ephysics_body_top_boundary_add(world, 10); _world_populate(speed_data); } diff --git a/legacy/ephysics/src/bin/test_constraint.c b/legacy/ephysics/src/bin/test_constraint.c index 946d4943ac..c484111bbf 100644 --- a/legacy/ephysics/src/bin/test_constraint.c +++ b/legacy/ephysics/src/bin/test_constraint.c @@ -96,7 +96,7 @@ test_constraint(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_ ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 3); diff --git a/legacy/ephysics/src/bin/test_delete.c b/legacy/ephysics/src/bin/test_delete.c index 781910bb32..dadd8f65ac 100644 --- a/legacy/ephysics/src/bin/test_delete.c +++ b/legacy/ephysics/src/bin/test_delete.c @@ -176,12 +176,12 @@ test_delete(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); collision_data->base.world = world; - boundary = ephysics_body_bottom_boundary_add(collision_data->base.world); + boundary = ephysics_body_bottom_boundary_add(collision_data->base.world, 10); ephysics_body_restitution_set(boundary, 0); ephysics_body_friction_set(boundary, 20); - ephysics_body_left_boundary_add(collision_data->base.world); - ephysics_body_right_boundary_add(collision_data->base.world); + ephysics_body_left_boundary_add(collision_data->base.world, 10); + ephysics_body_right_boundary_add(collision_data->base.world, 10); _world_populate(collision_data); diff --git a/legacy/ephysics/src/bin/test_falling_letters.c b/legacy/ephysics/src/bin/test_falling_letters.c index 3fb8c3da89..e45107d2ea 100644 --- a/legacy/ephysics/src/bin/test_falling_letters.c +++ b/legacy/ephysics/src/bin/test_falling_letters.c @@ -67,7 +67,7 @@ test_falling_letters(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *e ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.3); _world_populate(test_data); diff --git a/legacy/ephysics/src/bin/test_flag.c b/legacy/ephysics/src/bin/test_flag.c index 85fd728086..a6cca69ffe 100644 --- a/legacy/ephysics/src/bin/test_flag.c +++ b/legacy/ephysics/src/bin/test_flag.c @@ -77,18 +77,18 @@ test_flag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _ ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 4); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - ephysics_body_top_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_forces.c b/legacy/ephysics/src/bin/test_forces.c index d5628c1a82..87dd10e241 100644 --- a/legacy/ephysics/src/bin/test_forces.c +++ b/legacy/ephysics/src/bin/test_forces.c @@ -91,19 +91,19 @@ test_forces(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); - boundary = ephysics_body_top_boundary_add(test_data->world); + boundary = ephysics_body_top_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); diff --git a/legacy/ephysics/src/bin/test_grab.c b/legacy/ephysics/src/bin/test_grab.c index 8da3da3cd1..8968179573 100644 --- a/legacy/ephysics/src/bin/test_grab.c +++ b/legacy/ephysics/src/bin/test_grab.c @@ -156,19 +156,19 @@ test_grab(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _ ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 4); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - ephysics_body_top_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_growing_balls.c b/legacy/ephysics/src/bin/test_growing_balls.c index cc246ad605..9c54a35611 100644 --- a/legacy/ephysics/src/bin/test_growing_balls.c +++ b/legacy/ephysics/src/bin/test_growing_balls.c @@ -107,14 +107,14 @@ test_growing_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.8); - boundary = ephysics_body_top_boundary_add(test_data->world); + boundary = ephysics_body_top_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.8); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.8); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.8); _world_populate(test_data); diff --git a/legacy/ephysics/src/bin/test_heavy.c b/legacy/ephysics/src/bin/test_heavy.c index ad90b9fd1f..6622929448 100644 --- a/legacy/ephysics/src/bin/test_heavy.c +++ b/legacy/ephysics/src/bin/test_heavy.c @@ -62,12 +62,12 @@ test_heavy(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); - ephysics_body_top_boundary_add(test_data->world); - ephysics_body_left_boundary_add(test_data->world); - ephysics_body_right_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); + ephysics_body_left_boundary_add(test_data->world, 10); + ephysics_body_right_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_jumping_balls.c b/legacy/ephysics/src/bin/test_jumping_balls.c index 0bd15f7495..7236d90a38 100644 --- a/legacy/ephysics/src/bin/test_jumping_balls.c +++ b/legacy/ephysics/src/bin/test_jumping_balls.c @@ -130,13 +130,13 @@ test_jumping_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve ephysics_world_event_callback_add(world, EPHYSICS_CALLBACK_WORLD_STOPPED, _world_stopped_cb, bt); - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 2); - ephysics_body_top_boundary_add(test_data->world); - ephysics_body_left_boundary_add(test_data->world); - ephysics_body_right_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); + ephysics_body_left_boundary_add(test_data->world, 10); + ephysics_body_right_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_material.c b/legacy/ephysics/src/bin/test_material.c index 7b2c3fc295..ae96d62446 100644 --- a/legacy/ephysics/src/bin/test_material.c +++ b/legacy/ephysics/src/bin/test_material.c @@ -114,7 +114,7 @@ test_material(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); _world_populate(test_data); diff --git a/legacy/ephysics/src/bin/test_no_gravity.c b/legacy/ephysics/src/bin/test_no_gravity.c index b659ea0963..365edd55d5 100644 --- a/legacy/ephysics/src/bin/test_no_gravity.c +++ b/legacy/ephysics/src/bin/test_no_gravity.c @@ -111,19 +111,19 @@ test_no_gravity(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_ ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); - boundary = ephysics_body_top_boundary_add(test_data->world); + boundary = ephysics_body_top_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1); ephysics_body_friction_set(boundary, 0); diff --git a/legacy/ephysics/src/bin/test_rotate.c b/legacy/ephysics/src/bin/test_rotate.c index 53f6436ab9..310deb46fb 100644 --- a/legacy/ephysics/src/bin/test_rotate.c +++ b/legacy/ephysics/src/bin/test_rotate.c @@ -90,7 +90,7 @@ test_rotate(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 3); diff --git a/legacy/ephysics/src/bin/test_shapes.c b/legacy/ephysics/src/bin/test_shapes.c index 5af0fa549c..453f53d044 100644 --- a/legacy/ephysics/src/bin/test_shapes.c +++ b/legacy/ephysics/src/bin/test_shapes.c @@ -98,12 +98,12 @@ test_shapes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); - ephysics_body_top_boundary_add(test_data->world); - ephysics_body_left_boundary_add(test_data->world); - ephysics_body_right_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); + ephysics_body_left_boundary_add(test_data->world, 10); + ephysics_body_right_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_sleeping_threshold.c b/legacy/ephysics/src/bin/test_sleeping_threshold.c index c78d642cee..5526632a32 100644 --- a/legacy/ephysics/src/bin/test_sleeping_threshold.c +++ b/legacy/ephysics/src/bin/test_sleeping_threshold.c @@ -104,15 +104,15 @@ test_sleeping(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in test_data->world = world; ephysics_world_max_sleeping_time_set(world, 0.3); - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0); ephysics_body_friction_set(boundary, 20); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.8); - ephysics_body_left_boundary_add(test_data->world); - ephysics_body_top_boundary_add(test_data->world); + ephysics_body_left_boundary_add(test_data->world, 10); + ephysics_body_top_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_slider.c b/legacy/ephysics/src/bin/test_slider.c index 3dea4a0bf0..b90222553a 100644 --- a/legacy/ephysics/src/bin/test_slider.c +++ b/legacy/ephysics/src/bin/test_slider.c @@ -160,11 +160,11 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 3); - ephysics_body_left_boundary_add(test_data->world); + ephysics_body_left_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_soft_body.c b/legacy/ephysics/src/bin/test_soft_body.c index 83798255bf..e3d50b9cf1 100644 --- a/legacy/ephysics/src/bin/test_soft_body.c +++ b/legacy/ephysics/src/bin/test_soft_body.c @@ -146,19 +146,19 @@ test_soft_body(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 4); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - ephysics_body_top_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/bin/test_velocity.c b/legacy/ephysics/src/bin/test_velocity.c index e2149d7834..de6d9d34d4 100644 --- a/legacy/ephysics/src/bin/test_velocity.c +++ b/legacy/ephysics/src/bin/test_velocity.c @@ -184,19 +184,19 @@ test_velocity(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); velocity_data->base.world = world; - boundary = ephysics_body_bottom_boundary_add(velocity_data->base.world); + boundary = ephysics_body_bottom_boundary_add(velocity_data->base.world, 10); ephysics_body_restitution_set(boundary, 0.65); ephysics_body_friction_set(boundary, 4); - boundary = ephysics_body_right_boundary_add(velocity_data->base.world); + boundary = ephysics_body_right_boundary_add(velocity_data->base.world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - boundary = ephysics_body_left_boundary_add(velocity_data->base.world); + boundary = ephysics_body_left_boundary_add(velocity_data->base.world, 10); ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); - ephysics_body_top_boundary_add(velocity_data->base.world); + ephysics_body_top_boundary_add(velocity_data->base.world, 10); _world_populate(velocity_data); elm_object_event_callback_add(velocity_data->base.win, _on_keydown, diff --git a/legacy/ephysics/src/bin/test_win_resize.c b/legacy/ephysics/src/bin/test_win_resize.c index a1462f4558..1ed5528353 100644 --- a/legacy/ephysics/src/bin/test_win_resize.c +++ b/legacy/ephysics/src/bin/test_win_resize.c @@ -182,16 +182,16 @@ test_win_resize(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_ ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); test_data->world = world; - boundary = ephysics_body_bottom_boundary_add(test_data->world); + boundary = ephysics_body_bottom_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1.0); - boundary = ephysics_body_right_boundary_add(test_data->world); + boundary = ephysics_body_right_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1.0); - boundary = ephysics_body_left_boundary_add(test_data->world); + boundary = ephysics_body_left_boundary_add(test_data->world, 10); ephysics_body_restitution_set(boundary, 1.0); - ephysics_body_top_boundary_add(test_data->world); + ephysics_body_top_boundary_add(test_data->world, 10); _world_populate(test_data); } diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h index 2d294b6850..1603fd5fdf 100644 --- a/legacy/ephysics/src/lib/EPhysics.h +++ b/legacy/ephysics/src/lib/EPhysics.h @@ -1796,12 +1796,13 @@ EAPI EPhysics_Body *ephysics_body_shape_add(EPhysics_World *world, EPhysics_Shap * @ref ephysics_world_render_geometry_set(). * * @param world The world this body will belong to. + * @param d The boundary depth, in pixels. * @return a new body or @c NULL, on erros. * @see ephysics_world_render_geometry_set() * * @ingroup EPhysics_Body */ -EAPI EPhysics_Body *ephysics_body_top_boundary_add(EPhysics_World *world); +EAPI EPhysics_Body *ephysics_body_top_boundary_add(EPhysics_World *world, Evas_Coord d); /** * @brief @@ -1812,12 +1813,13 @@ EAPI EPhysics_Body *ephysics_body_top_boundary_add(EPhysics_World *world); * @ref ephysics_world_render_geometry_set(). * * @param world The world this body will belong to. + * @param d The boundary depth, in pixels. * @return a new body or @c NULL, on erros. * @see ephysics_world_render_geometry_set() * * @ingroup EPhysics_Body */ -EAPI EPhysics_Body *ephysics_body_bottom_boundary_add(EPhysics_World *world); +EAPI EPhysics_Body *ephysics_body_bottom_boundary_add(EPhysics_World *world, Evas_Coord d); /** * @brief @@ -1828,12 +1830,13 @@ EAPI EPhysics_Body *ephysics_body_bottom_boundary_add(EPhysics_World *world); * @ref ephysics_world_render_geometry_set(). * * @param world The world this body will belong to. + * @param d The boundary depth, in pixels. * @return a new body or @c NULL, on erros. * @see ephysics_world_render_geometry_set() * * @ingroup EPhysics_Body */ -EAPI EPhysics_Body *ephysics_body_left_boundary_add(EPhysics_World *world); +EAPI EPhysics_Body *ephysics_body_left_boundary_add(EPhysics_World *world, Evas_Coord d); /** * @brief @@ -1844,12 +1847,13 @@ EAPI EPhysics_Body *ephysics_body_left_boundary_add(EPhysics_World *world); * @ref ephysics_world_render_geometry_set(). * * @param world The world this body will belong to. + * @param d The boundary depth, in pixels. * @return a new body or @c NULL, on erros. * @see ephysics_world_render_geometry_set() * * @ingroup EPhysics_Body */ -EAPI EPhysics_Body *ephysics_body_right_boundary_add(EPhysics_World *world); +EAPI EPhysics_Body *ephysics_body_right_boundary_add(EPhysics_World *world, Evas_Coord d); /** * @brief diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp index aa66cbc916..b48bb435f3 100644 --- a/legacy/ephysics/src/lib/ephysics_body.cpp +++ b/legacy/ephysics/src/lib/ephysics_body.cpp @@ -1771,7 +1771,7 @@ ephysics_body_world_boundaries_resize(EPhysics_World *world) } static EPhysics_Body * -_ephysics_body_boundary_add(EPhysics_World *world, EPhysics_World_Boundary boundary, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +_ephysics_body_boundary_add(EPhysics_World *world, EPhysics_World_Boundary boundary, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Coord d) { EPhysics_Body *body; @@ -1791,56 +1791,56 @@ _ephysics_body_boundary_add(EPhysics_World *world, EPhysics_World_Boundary bound ephysics_body_mass_set(body, 0); ephysics_world_boundary_set(world, boundary, body); - ephysics_body_geometry_set(body, x, y, -5, w, h, 10); - + ephysics_body_geometry_set(body, x, y, -20, w, h, + d * ephysics_world_rate_get(body->world)); return body; } EAPI EPhysics_Body * -ephysics_body_top_boundary_add(EPhysics_World *world) +ephysics_body_top_boundary_add(EPhysics_World *world, Evas_Coord d) { EPhysics_Body *body; Evas_Coord x, y, w; ephysics_world_render_geometry_get(world, &x, &y, &w, NULL); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_TOP, - 0, y - 10, x + w, 10); + 0, y - 10, x + w, 10, d); return body; } EAPI EPhysics_Body * -ephysics_body_bottom_boundary_add(EPhysics_World *world) +ephysics_body_bottom_boundary_add(EPhysics_World *world, Evas_Coord d) { Evas_Coord x, y, w, h; EPhysics_Body *body; ephysics_world_render_geometry_get(world, &x, &y, &w, &h); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_BOTTOM, - x, y + h, w, 10); + x, y + h, w, 10, d); return body; } EAPI EPhysics_Body * -ephysics_body_left_boundary_add(EPhysics_World *world) +ephysics_body_left_boundary_add(EPhysics_World *world, Evas_Coord d) { EPhysics_Body *body; Evas_Coord x, y, h; ephysics_world_render_geometry_get(world, &x, &y, NULL, &h); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_LEFT, - x - 10, 0, 10, y + h); + x - 10, 0, 10, y + h, d); return body; } EAPI EPhysics_Body * -ephysics_body_right_boundary_add(EPhysics_World *world) +ephysics_body_right_boundary_add(EPhysics_World *world, Evas_Coord d) { Evas_Coord x, y, w, h; EPhysics_Body *body; ephysics_world_render_geometry_get(world, &x, &y, &w, &h); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_RIGHT, - x + w, 0, 10, y + h); + x + w, 0, 10, y + h, d); return body; }