diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h index 2b88d847b4..2a1a2cd933 100644 --- a/legacy/ephysics/src/lib/EPhysics.h +++ b/legacy/ephysics/src/lib/EPhysics.h @@ -88,42 +88,6 @@ extern "C" { * */ -/** - * @enum _EPhysics_Callback_Type - * @typedef EPhysics_Callback_Type - * - * Identifier of callbacks to be set for EPhysics bodies and worlds. - * - * @see ephysics_body_event_callback_add() - * @see ephysics_world_event_callback_add() - * - * @ingroup EPhysics - */ -typedef enum _EPhysics_Callback_Type -{ - /* - * The following events are only for use with EPhysics world objects, with - * @ref ephysics_world_event_callback_add(): - */ - EPHYSICS_CALLBACK_WORLD_FIRST, /**< kept as sentinel, not really an event */ - EPHYSICS_CALLBACK_WORLD_DEL, /**< World being deleted (called before free) */ - EPHYSICS_CALLBACK_WORLD_STOPPED, /**< no objects are moving any more */ - EPHYSICS_CALLBACK_WORLD_LAST, /**< kept as sentinel, not really an event */ - - /* - * The following events are only for use with EPhysics body objects, with - * @ref ephysics_body_event_callback_add(): - */ - EPHYSICS_CALLBACK_BODY_FIRST, /**< kept as sentinel, not really an event */ - EPHYSICS_CALLBACK_BODY_UPDATE, /**< Body being updated */ - EPHYSICS_CALLBACK_BODY_COLLISION, /**< Body collided with other body */ - EPHYSICS_CALLBACK_BODY_DEL, /**< Body being deleted (called before free) */ - EPHYSICS_CALLBACK_BODY_STOPPED, /**< Body is not moving any more */ - EPHYSICS_CALLBACK_BODY_LAST, /**< kept as sentinel, not really an event */ - - EPHYSICS_CALLBACK_LAST /**< kept as sentinel, not really an event */ -} EPhysics_Callback_Type; /**< The types of events triggering a callback */ - /** * Initialize EPhysics * @@ -287,6 +251,25 @@ EAPI double ephysics_camera_zoom_get(const EPhysics_Camera *camera); typedef struct _EPhysics_World EPhysics_World; /**< World handle, most basic type of EPhysics. Created with @ref ephysics_world_new() and deleted with @ref ephysics_world_del(). */ +/** + * @enum _EPhysics_Callback_World_Type + * @typedef EPhysics_Callback_World_Type + * + * Identifier of callbacks to be set for EPhysics worlds. + * + * @see ephysics_world_event_callback_add() + * @see ephysics_world_event_callback_del() + * @see ephysics_world_event_callback_del_full() + * + * @ingroup EPhysics_World + */ +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_LAST, /**< kept as sentinel, not really an event */ +} EPhysics_Callback_World_Type; + /** * @typedef EPhysics_World_Event_Cb * @@ -544,7 +527,7 @@ EAPI EPhysics_Camera *ephysics_world_camera_get(const EPhysics_World *world); * * @ingroup EPhysics_World */ -EAPI void ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Callback_Type type, EPhysics_World_Event_Cb func, const void *data); +EAPI void ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Callback_World_Type type, EPhysics_World_Event_Cb func, const void *data); /** * @brief @@ -565,7 +548,7 @@ EAPI void ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Call * * @ingroup EPhysics_World */ -EAPI void *ephysics_world_event_callback_del(EPhysics_World *world, EPhysics_Callback_Type type, EPhysics_World_Event_Cb func); +EAPI void *ephysics_world_event_callback_del(EPhysics_World *world, EPhysics_Callback_World_Type type, EPhysics_World_Event_Cb func); /** * @brief @@ -587,7 +570,7 @@ EAPI void *ephysics_world_event_callback_del(EPhysics_World *world, EPhysics_Cal * * @ingroup EPhysics_World */ -EAPI void *ephysics_world_event_callback_del_full(EPhysics_World *world, EPhysics_Callback_Type type, EPhysics_World_Event_Cb func, void *data); +EAPI void *ephysics_world_event_callback_del_full(EPhysics_World *world, EPhysics_Callback_World_Type type, EPhysics_World_Event_Cb func, void *data); /** * @brief @@ -668,6 +651,28 @@ EAPI double ephysics_world_linear_slop_get(EPhysics_World *world); typedef struct _EPhysics_Body EPhysics_Body; /**< Body handle, represents an object on EPhysics world. Created with @ref ephysics_body_circle_add() or @ref ephysics_body_box_add() and deleted with @ref ephysics_body_del(). */ +/** + * @enum _EPhysics_Callback_Body_Type + * @typedef EPhysics_Callback_Body_Type + * + * Identifier of callbacks to be set for EPhysics bodies. + * + * @see ephysics_body_event_callback_add() + * @see ephysics_body_event_callback_del() + * @see ephysics_body_event_callback_del_full() + * + * @ingroup EPhysics_Body + */ +typedef enum _EPhysics_Callback_Body_Type +{ + EPHYSICS_CALLBACK_BODY_UPDATE, /**< Body being updated */ + EPHYSICS_CALLBACK_BODY_COLLISION, /**< Body collided with other body */ + EPHYSICS_CALLBACK_BODY_DEL, /**< Body being deleted (called before free) */ + EPHYSICS_CALLBACK_BODY_STOPPED, /**< Body is not moving any more */ + EPHYSICS_CALLBACK_BODY_LAST, /**< kept as sentinel, not really an event */ +} EPhysics_Callback_Body_Type; /**< The types of events triggering a callback */ + + /** * @typedef EPhysics_Body_Event_Cb * @@ -1049,7 +1054,7 @@ EAPI void ephysics_body_evas_object_update(EPhysics_Body *body); * * @ingroup EPhysics_Body */ -EAPI void ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callback_Type type, EPhysics_Body_Event_Cb func, const void *data); +EAPI void ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func, const void *data); /** * @brief @@ -1070,7 +1075,7 @@ EAPI void ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callbac * * @ingroup EPhysics_Body */ -EAPI void *ephysics_body_event_callback_del(EPhysics_Body *body, EPhysics_Callback_Type type, EPhysics_Body_Event_Cb func); +EAPI void *ephysics_body_event_callback_del(EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func); /** * @brief @@ -1092,7 +1097,7 @@ EAPI void *ephysics_body_event_callback_del(EPhysics_Body *body, EPhysics_Callba * * @ingroup EPhysics_Body */ -EAPI void *ephysics_body_event_callback_del_full(EPhysics_Body *body, EPhysics_Callback_Type type, EPhysics_Body_Event_Cb func, void *data); +EAPI void *ephysics_body_event_callback_del_full(EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func, void *data); /** * @brief diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp index ba35db5721..b179c3a14e 100644 --- a/legacy/ephysics/src/lib/ephysics_body.cpp +++ b/legacy/ephysics/src/lib/ephysics_body.cpp @@ -18,7 +18,7 @@ struct _EPhysics_Body_Callback { EINA_INLIST; void (*func) (void *data, EPhysics_Body *body, void *event_info); void *data; - EPhysics_Callback_Type type; + EPhysics_Callback_Body_Type type; }; struct _EPhysics_Body { @@ -560,7 +560,7 @@ ephysics_body_evas_object_update(EPhysics_Body *body) } EAPI void -ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callback_Type type, EPhysics_Body_Event_Cb func, const void *data) +ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func, const void *data) { EPhysics_Body_Callback *cb; @@ -576,8 +576,7 @@ ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callback_Type typ return; } - if ((type <= EPHYSICS_CALLBACK_BODY_FIRST) || - (type >= EPHYSICS_CALLBACK_BODY_LAST)) + if ((type < 0) || (type >= EPHYSICS_CALLBACK_BODY_LAST)) { ERR("Can't set body event callback, callback type is wrong."); return; @@ -598,7 +597,7 @@ ephysics_body_event_callback_add(EPhysics_Body *body, EPhysics_Callback_Type typ } EAPI void * -ephysics_body_event_callback_del(EPhysics_Body *body, EPhysics_Callback_Type type, EPhysics_Body_Event_Cb func) +ephysics_body_event_callback_del(EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func) { EPhysics_Body_Callback *cb; void *cb_data; @@ -624,7 +623,7 @@ ephysics_body_event_callback_del(EPhysics_Body *body, EPhysics_Callback_Type typ } EAPI void * -ephysics_body_event_callback_del_full(EPhysics_Body *body, EPhysics_Callback_Type type, EPhysics_Body_Event_Cb func, void *data) +ephysics_body_event_callback_del_full(EPhysics_Body *body, EPhysics_Callback_Body_Type type, EPhysics_Body_Event_Cb func, void *data) { EPhysics_Body_Callback *cb; void *cb_data; diff --git a/legacy/ephysics/src/lib/ephysics_world.cpp b/legacy/ephysics/src/lib/ephysics_world.cpp index 0eafe47b81..c50a372bd0 100644 --- a/legacy/ephysics/src/lib/ephysics_world.cpp +++ b/legacy/ephysics/src/lib/ephysics_world.cpp @@ -16,7 +16,7 @@ struct _EPhysics_World_Callback { EINA_INLIST; void (*func) (void *data, EPhysics_World *world, void *event_info); void *data; - EPhysics_Callback_Type type; + EPhysics_Callback_World_Type type; }; struct _EPhysics_World { @@ -529,7 +529,7 @@ ephysics_world_camera_get(const EPhysics_World *world) } EAPI void -ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Callback_Type type, EPhysics_World_Event_Cb func, const void *data) +ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Callback_World_Type type, EPhysics_World_Event_Cb func, const void *data) { EPhysics_World_Callback *cb; @@ -545,8 +545,7 @@ ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Callback_Type return; } - if ((type <= EPHYSICS_CALLBACK_WORLD_FIRST) || - (type >= EPHYSICS_CALLBACK_WORLD_LAST)) + if ((type < 0) || (type >= EPHYSICS_CALLBACK_WORLD_LAST)) { ERR("Can't set world event callback, callback type is wrong."); return; @@ -567,7 +566,7 @@ ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Callback_Type } EAPI void * -ephysics_world_event_callback_del(EPhysics_World *world, EPhysics_Callback_Type type, EPhysics_World_Event_Cb func) +ephysics_world_event_callback_del(EPhysics_World *world, EPhysics_Callback_World_Type type, EPhysics_World_Event_Cb func) { EPhysics_World_Callback *cb; void *cb_data; @@ -593,7 +592,7 @@ ephysics_world_event_callback_del(EPhysics_World *world, EPhysics_Callback_Type } EAPI void * -ephysics_world_event_callback_del_full(EPhysics_World *world, EPhysics_Callback_Type type, EPhysics_World_Event_Cb func, void *data) +ephysics_world_event_callback_del_full(EPhysics_World *world, EPhysics_Callback_World_Type type, EPhysics_World_Event_Cb func, void *data) { EPhysics_World_Callback *cb; void *cb_data;