ephysics: add event WORLD_UPDATE

SVN revision: 80274
This commit is contained in:
Bruno Dilly 2012-12-05 19:27:53 +00:00
parent 1a2daa057d
commit f9293909d9
3 changed files with 12 additions and 0 deletions

View File

@ -100,6 +100,12 @@ _world_stopped_cb(void *data, EPhysics_World *world __UNUSED__, void *event_info
INF("World stopped\n");
}
static void
_world_update_cb(void *data __UNUSED__, EPhysics_World *world __UNUSED__, void *event_info __UNUSED__)
{
INF("World update\n");
}
void
test_jumping_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
@ -130,6 +136,8 @@ test_jumping_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
test_data->data = bt;
ephysics_world_event_callback_add(world, EPHYSICS_CALLBACK_WORLD_STOPPED,
_world_stopped_cb, bt);
ephysics_world_event_callback_add(world, EPHYSICS_CALLBACK_WORLD_UPDATE,
_world_update_cb, NULL);
boundary = ephysics_body_bottom_boundary_add(test_data->world);
ephysics_body_restitution_set(boundary, 0.65);

View File

@ -893,6 +893,7 @@ typedef enum _EPhysics_Callback_World_Type
EPHYSICS_CALLBACK_WORLD_DEL, /**< World being deleted (called before free) */
EPHYSICS_CALLBACK_WORLD_STOPPED, /**< no objects are moving any more */
EPHYSICS_CALLBACK_WORLD_CAMERA_MOVED, /**< camera position changed */
EPHYSICS_CALLBACK_WORLD_UPDATE, /**< world being updated */
EPHYSICS_CALLBACK_WORLD_LAST, /**< kept as sentinel, not really an event */
} EPhysics_Callback_World_Type;

View File

@ -266,6 +266,9 @@ _ephysics_world_tick(btDynamicsWorld *dynamics_world)
NULL);
body_del:
if (world_active)
_ephysics_world_event_callback_call(world, EPHYSICS_CALLBACK_WORLD_UPDATE,
NULL);
world->pending_ticks--;
if (!world->pending_ticks)
{