|
|
|
@ -4,7 +4,7 @@ |
|
|
|
|
* Here is a page with examples. |
|
|
|
|
* |
|
|
|
|
* @li @ref tutorial_ephysics_bouncing_ball |
|
|
|
|
* @li @ref ephysics_logo_c |
|
|
|
|
* @li @ref tutorial_ephysics_delete_body |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -206,3 +206,87 @@ |
|
|
|
|
* @example ephysics_logo.c |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @page tutorial_ephysics_delete_body EPhysics - Delete Body |
|
|
|
|
* |
|
|
|
|
* The purpose of this example is to demonstrate the EPhysics Callbacks usage - |
|
|
|
|
* The code adds two balls, one with impulse and the second with a collision |
|
|
|
|
* detection callback, to delete the body. |
|
|
|
|
* |
|
|
|
|
* 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-callbacks Adding Callbacks |
|
|
|
|
* @dontinclude test_delete.c |
|
|
|
|
* |
|
|
|
|
* Calling ephysics_body_event_callback_add() |
|
|
|
|
* registers a callback to a given EPhysics_Body event type. |
|
|
|
|
* |
|
|
|
|
* We'll use two types: |
|
|
|
|
* |
|
|
|
|
* @ref EPHYSICS_CALLBACK_BODY_DEL : called when a body deletion has been issued |
|
|
|
|
* and just before the deletion actually happens. In other words, to know that |
|
|
|
|
* body has been marked for |
|
|
|
|
* deletion. Typically to free some data associated with the body. |
|
|
|
|
* |
|
|
|
|
* @skipline ephysics_body_event_callback_add(sphere_body1, |
|
|
|
|
* @skip EPHYSICS_CALLBACK_BODY_DEL |
|
|
|
|
* @until ); |
|
|
|
|
* |
|
|
|
|
* The callback function will receive the collision_data and free some data |
|
|
|
|
* associated with the body. |
|
|
|
|
* |
|
|
|
|
* @dontinclude test_delete.c |
|
|
|
|
* |
|
|
|
|
* @skip _del_cb(void *data, |
|
|
|
|
* @until } |
|
|
|
|
* |
|
|
|
|
* @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 ); |
|
|
|
|
* |
|
|
|
|
* The callback function will get the collision body and check if its body is |
|
|
|
|
* equal to which we want to delete. |
|
|
|
|
* |
|
|
|
|
* @dontinclude test_delete.c |
|
|
|
|
* |
|
|
|
|
* @skip _collision_cb(void *data, |
|
|
|
|
* @until } |
|
|
|
|
* |
|
|
|
|
* See |
|
|
|
|
* @ref _EPhysics_Callback_Body_Type |
|
|
|
|
* for more event types. |
|
|
|
|
* |
|
|
|
|
* Here we finish the example. The full source code can be found at |
|
|
|
|
* @ref test_delete_c. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @page test_delete_c test_delete.c |
|
|
|
|
* |
|
|
|
|
* @section ephysics-test-h ephysics_test.h |
|
|
|
|
* @include ephysics_test.h |
|
|
|
|
* |
|
|
|
|
* @section test-delete-c test_delete.c |
|
|
|
|
* @dontinclude test.c |
|
|
|
|
* @skip test_clean |
|
|
|
|
* @until } |
|
|
|
|
* |
|
|
|
|
* @skip test_win_add |
|
|
|
|
* @until } |
|
|
|
|
* |
|
|
|
|
* @include test_delete.c |
|
|
|
|
* |
|
|
|
|
* @example test_delete.c |
|
|
|
|
*/ |
|
|
|
|