diff --git a/legacy/ephysics/doc/examples.dox b/legacy/ephysics/doc/examples.dox index 70cf74a3dc..be6df3647b 100644 --- a/legacy/ephysics/doc/examples.dox +++ b/legacy/ephysics/doc/examples.dox @@ -5,6 +5,7 @@ * * @li @ref tutorial_ephysics_bouncing_ball * @li @ref tutorial_ephysics_bouncing_text + * @li @ref tutorial_ephysics_collision_detection * @li @ref tutorial_ephysics_delete_body * @li @ref tutorial_ephysics_constraint */ @@ -280,6 +281,99 @@ * @example test_bouncing_text.c */ +/** + * @page tutorial_ephysics_collision_detection EPhysics - Collision Detection + * + * The purpose of this example is to demonstrate the EPhysics Collision + * Detection usage - The code adds two balls, one with impulse and the second + * with a collision detection callback, to show an effect. + * + * For this example we'll have an EPhysics_World, and two basic EPhysics_Bodys, + * we'll apply an impulse in one of then and the other will be stopped + * "waiting" for a collision. + * + * The basic concepts like - initializing an EPhysics_World, render geometry, + * physics limiting boundaries, add an Ephysics_Body, associate it to evas + * objects, change restitution, friction and impulse properties, were + * already covered in + * @ref tutorial_ephysics_bouncing_ball + * + * @section add-collstruct Collision Data Struct + * @dontinclude test_collision_detection.c + * + * While in this example we'll be working with a struct to hold some objects + * in our code. For clarity sake we present you the struct declaration in the + * following block. + * + * @skip struct _Collision_Data { + * @until }; + * + * @section add-callbacks Adding the Callback + * + * Calling ephysics_body_event_callback_add() + * will register a callback to a type of physics body event. + * + * @ref EPHYSICS_CALLBACK_BODY_COLLISION : called just after the collision has + * been actually processed by the physics engine. In other words, to be + * notified about a collision between two physical bodies. + * + * @skip ephysics_body_event_callback_add(collision_data->sphere + * @until ); + * + * See + * @ref _EPhysics_Callback_Body_Type + * for more event types. + * + * @section add-collcb Collision Function + * + * The callback function will filter the collision to be sure if that body is + * which we want and then show the effect. + * + * First we need to create a specific variable type to get collision infos: + * @ref EPhysics_Body_Collision + * + * @dontinclude test_collision_detection.c + * + * @skip _collision_cb + * @until int x, y; + * + * Now we want to know which body collides with and filter it. + * + * @skip contact_body = + * @until return; + * + * We just get the collision position, move the impact effect to this + * coordinate and send a signal to edje to show it. + * + * @skip ephysics_body_collision_position_get + * @until "ephysics_test"); + * @skipline } + * + * Here we finish the example. The full source code can be found at + * @ref test_collision_detection_c. + * + */ + + /** + * @page test_collision_detection_c test_collision_detection.c + * + * @section ephysics-test-h ephysics_test.h + * @include ephysics_test.h + * + * @section test-collision_detection-c test_collision_detection.c + * @dontinclude test.c + * + * @skip test_clean + * @until } + * + * @skip test_win_add + * @until } + * + * @include test_collision_detection.c + * + * @example test_collision_detection.c + */ + /** * @page tutorial_ephysics_delete_body EPhysics - Delete Body *