EPhysics: add depth parameter to boundary api

Patch by: Leandro Dorileo <dorileo@profusion.mobi>



SVN revision: 77785
This commit is contained in:
Leandro Dorileo 2012-10-10 19:18:15 +00:00 committed by Bruno Dilly
parent 21e6264deb
commit 17fa1d7756
27 changed files with 102 additions and 97 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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,

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}