ephysics: add event WORLD_UPDATE
authorBruno Dilly <bdilly@profusion.mobi>
Wed, 5 Dec 2012 19:27:53 +0000 (19:27 +0000)
committerBruno Dilly <bdilly@profusion.mobi>
Wed, 5 Dec 2012 19:27:53 +0000 (19:27 +0000)
SVN revision: 80274

legacy/ephysics/src/bin/test_jumping_balls.c
legacy/ephysics/src/lib/EPhysics.h
legacy/ephysics/src/lib/ephysics_world.cpp

index f250a63..999a6bb 100644 (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);
index 5647134..072f409 100644 (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;
 
index 6c9ca35..198e47c 100644 (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)
      {