Changeset View
Changeset View
Standalone View
Standalone View
src/examples/ephysics/test_bouncing_ball.c
1 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H | ||
---|---|---|---|---|---|
2 | # include <config.h> | 2 | # include <config.h> | ||
3 | #endif | 3 | #endif | ||
4 | 4 | | |||
5 | #include "ephysics_test.h" | 5 | #include "ephysics_test.h" | ||
6 | 6 | | |||
7 | static Eina_Bool | 7 | static Eina_Bool | ||
8 | _on_keydown(void *data, Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) | 8 | _on_keydown(void *data, Evas_Object *obj EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info) | ||
9 | { | 9 | { | ||
10 | Evas_Event_Key_Down *ev = event_info; | 10 | Evas_Event_Key_Down *ev = event_info; | ||
11 | EPhysics_Body *body = data; | 11 | EPhysics_Body *body = data; | ||
12 | 12 | | |||
13 | if (type != EVAS_CALLBACK_KEY_UP) | 13 | if (type != EVAS_CALLBACK_KEY_UP) | ||
14 | return EINA_FALSE; | 14 | return EINA_FALSE; | ||
15 | 15 | | |||
16 | if (strcmp(ev->key, "Up") == 0) | 16 | if (strcmp(ev->key, "Up") == 0) | ||
Show All 36 Lines | 30 | { | |||
53 | ephysics_body_friction_set(fall_body, 0.1); | 53 | ephysics_body_friction_set(fall_body, 0.1); | ||
54 | ephysics_body_event_callback_add(fall_body, EPHYSICS_CALLBACK_BODY_UPDATE, | 54 | ephysics_body_event_callback_add(fall_body, EPHYSICS_CALLBACK_BODY_UPDATE, | ||
55 | update_object_cb, shadow); | 55 | update_object_cb, shadow); | ||
56 | test_data->bodies = eina_list_append(test_data->bodies, fall_body); | 56 | test_data->bodies = eina_list_append(test_data->bodies, fall_body); | ||
57 | test_data->data = fall_body; | 57 | test_data->data = fall_body; | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | static void | 60 | static void | ||
61 | _restart(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) | 61 | _restart(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) | ||
62 | { | 62 | { | ||
63 | Test_Data *test_data = data; | 63 | Test_Data *test_data = data; | ||
64 | 64 | | |||
65 | DBG("Restart pressed"); | 65 | DBG("Restart pressed"); | ||
66 | elm_object_event_callback_del(test_data->win, _on_keydown, test_data->data); | 66 | elm_object_event_callback_del(test_data->win, _on_keydown, test_data->data); | ||
67 | test_clean(test_data); | 67 | test_clean(test_data); | ||
68 | _world_populate(test_data); | 68 | _world_populate(test_data); | ||
69 | elm_object_event_callback_add(test_data->win, _on_keydown, test_data->data); | 69 | elm_object_event_callback_add(test_data->win, _on_keydown, test_data->data); | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | void | 72 | void | ||
73 | test_bouncing_ball(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | 73 | test_bouncing_ball(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | ||
74 | { | 74 | { | ||
75 | EPhysics_Body *boundary; | 75 | EPhysics_Body *boundary; | ||
76 | EPhysics_World *world; | 76 | EPhysics_World *world; | ||
77 | Test_Data *test_data; | 77 | Test_Data *test_data; | ||
78 | 78 | | |||
79 | if (!ephysics_init()) | 79 | if (!ephysics_init()) | ||
80 | return; | 80 | return; | ||
81 | 81 | | |||
Show All 31 Lines |