diff options
author | David Walter Seikel | 2014-04-21 18:28:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-21 18:28:19 +1000 |
commit | 26df7205616dbcf80b60c1ed3c04ebea26975fe9 (patch) | |
tree | 7bc3851bf7eb3232367cdf8dc6894acf6cb51780 /LuaSL/src/LuaSL_test.c | |
parent | GuiLua uses LumbrJack and Runnr from the shared libraries directory at run ti... (diff) | |
download | SledjHamr-26df7205616dbcf80b60c1ed3c04ebea26975fe9.zip SledjHamr-26df7205616dbcf80b60c1ed3c04ebea26975fe9.tar.gz SledjHamr-26df7205616dbcf80b60c1ed3c04ebea26975fe9.tar.bz2 SledjHamr-26df7205616dbcf80b60c1ed3c04ebea26975fe9.tar.xz |
Convert LuaSL to use LumbrJack.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_test.c | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/LuaSL/src/LuaSL_test.c b/LuaSL/src/LuaSL_test.c index 69cbf2c..51fd902 100644 --- a/LuaSL/src/LuaSL_test.c +++ b/LuaSL/src/LuaSL_test.c | |||
@@ -22,31 +22,31 @@ static const char *names[] = | |||
22 | static void | 22 | static void |
23 | _edje_signal_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source) | 23 | _edje_signal_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source) |
24 | { | 24 | { |
25 | // gameGlobals *game = data; | 25 | // gameGlobals *ourGlobals = data; |
26 | } | 26 | } |
27 | 27 | ||
28 | static | 28 | static |
29 | Eina_Bool anim(void *data) | 29 | Eina_Bool anim(void *data) |
30 | { | 30 | { |
31 | gameGlobals *game = data; | 31 | gameGlobals *ourGlobals = data; |
32 | Evas_Object *bub, *sh; | 32 | Evas_Object *bub, *sh; |
33 | Evas_Coord x, y, w, h, vw, vh; | 33 | Evas_Coord x, y, w, h, vw, vh; |
34 | double t, xx, yy, zz, r, fac; | 34 | double t, xx, yy, zz, r, fac; |
35 | double lx, ly; | 35 | double lx, ly; |
36 | unsigned int i; | 36 | unsigned int i; |
37 | 37 | ||
38 | evas_output_viewport_get(game->canvas, 0, 0, &vw, &vh); | 38 | evas_output_viewport_get(ourGlobals->canvas, 0, 0, &vw, &vh); |
39 | r = 48; | 39 | r = 48; |
40 | t = ecore_loop_time_get(); | 40 | t = ecore_loop_time_get(); |
41 | fac = 2.0 / (double)((sizeof(names) / sizeof(char *) / 2)); | 41 | fac = 2.0 / (double)((sizeof(names) / sizeof(char *) / 2)); |
42 | evas_pointer_canvas_xy_get(game->canvas, &x, &y); | 42 | evas_pointer_canvas_xy_get(ourGlobals->canvas, &x, &y); |
43 | lx = x; | 43 | lx = x; |
44 | ly = y; | 44 | ly = y; |
45 | 45 | ||
46 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) | 46 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) |
47 | { | 47 | { |
48 | bub = evas_object_data_get(game->bg, names[i * 2]); | 48 | bub = evas_object_data_get(ourGlobals->bg, names[i * 2]); |
49 | sh = evas_object_data_get(game->bg, names[(i * 2) + 1]); | 49 | sh = evas_object_data_get(ourGlobals->bg, names[(i * 2) + 1]); |
50 | zz = (((2 + sin(t * 6 + (M_PI * (i * fac)))) / 3) * 64) * 2; | 50 | zz = (((2 + sin(t * 6 + (M_PI * (i * fac)))) / 3) * 64) * 2; |
51 | xx = (cos(t * 4 + (M_PI * (i * fac))) * r) * 2; | 51 | xx = (cos(t * 4 + (M_PI * (i * fac))) * r) * 2; |
52 | yy = (sin(t * 6 + (M_PI * (i * fac))) * r) * 2; | 52 | yy = (sin(t * 6 + (M_PI * (i * fac))) * r) * 2; |
@@ -78,7 +78,7 @@ _on_delete(Ecore_Evas *ee __UNUSED__) | |||
78 | 78 | ||
79 | static void dirList_compile(const char *name, const char *path, void *data) | 79 | static void dirList_compile(const char *name, const char *path, void *data) |
80 | { | 80 | { |
81 | gameGlobals *game = data; | 81 | gameGlobals *ourGlobals = data; |
82 | 82 | ||
83 | char *ext = rindex(name, '.'); | 83 | char *ext = rindex(name, '.'); |
84 | 84 | ||
@@ -92,34 +92,34 @@ static void dirList_compile(const char *name, const char *path, void *data) | |||
92 | gettimeofday(&me->startTime, NULL); | 92 | gettimeofday(&me->startTime, NULL); |
93 | snprintf(me->SID, sizeof(me->SID), "%08lx-%04lx-%04lx-%04lx-%012lx", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); | 93 | snprintf(me->SID, sizeof(me->SID), "%08lx-%04lx-%04lx-%04lx-%012lx", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); |
94 | snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); | 94 | snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); |
95 | eina_hash_add(game->scripts, me->SID, me); | 95 | eina_hash_add(ourGlobals->scripts, me->SID, me); |
96 | sendForth(game, me->SID, "compile(%s)", me->fileName); | 96 | sendForth(ourGlobals, me->SID, "compile(%s)", me->fileName); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | static Eina_Bool _timer_cb(void *data) | 101 | static Eina_Bool _timer_cb(void *data) |
102 | { | 102 | { |
103 | gameGlobals *game = data; | 103 | gameGlobals *ourGlobals = data; |
104 | Eina_Iterator *scripts; | 104 | Eina_Iterator *scripts; |
105 | script *me; | 105 | script *me; |
106 | boolean exit = FALSE; | 106 | boolean exit = FALSE; |
107 | 107 | ||
108 | scripts = eina_hash_iterator_data_new(game->scripts); | 108 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); |
109 | while(eina_iterator_next(scripts, (void **) &me)) | 109 | while(eina_iterator_next(scripts, (void **) &me)) |
110 | { | 110 | { |
111 | switch (timedEvent) | 111 | switch (timedEvent) |
112 | { | 112 | { |
113 | case 5 : | 113 | case 5 : |
114 | { | 114 | { |
115 | sendForth(game, me->SID, "events.detectedKeys({\"%s\"})", ownerKey); | 115 | sendForth(ourGlobals, me->SID, "events.detectedKeys({\"%s\"})", ownerKey); |
116 | sendForth(game, me->SID, "events.detectedNames({\"%s\"})", ownerName); | 116 | sendForth(ourGlobals, me->SID, "events.detectedNames({\"%s\"})", ownerName); |
117 | sendForth(game, me->SID, "events.touch_start(1)"); | 117 | sendForth(ourGlobals, me->SID, "events.touch_start(1)"); |
118 | break; | 118 | break; |
119 | } | 119 | } |
120 | case 9 : | 120 | case 9 : |
121 | { | 121 | { |
122 | sendForth(game, me->SID, "quit()"); | 122 | sendForth(ourGlobals, me->SID, "quit()"); |
123 | break; | 123 | break; |
124 | } | 124 | } |
125 | case 11 : | 125 | case 11 : |
@@ -133,7 +133,7 @@ static Eina_Bool _timer_cb(void *data) | |||
133 | 133 | ||
134 | if (exit) | 134 | if (exit) |
135 | { | 135 | { |
136 | sendForth(game, ownerKey, "exit()"); | 136 | sendForth(ourGlobals, ownerKey, "exit()"); |
137 | ecore_main_loop_quit(); | 137 | ecore_main_loop_quit(); |
138 | return ECORE_CALLBACK_CANCEL; | 138 | return ECORE_CALLBACK_CANCEL; |
139 | } | 139 | } |
@@ -142,21 +142,21 @@ static Eina_Bool _timer_cb(void *data) | |||
142 | 142 | ||
143 | static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) | 143 | static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) |
144 | { | 144 | { |
145 | gameGlobals *game = data; | 145 | gameGlobals *ourGlobals = data; |
146 | char buf[PATH_MAX]; | 146 | char buf[PATH_MAX]; |
147 | 147 | ||
148 | game->server = ev->server; | 148 | ourGlobals->server = ev->server; |
149 | gettimeofday(&startTime, NULL); | 149 | gettimeofday(&startTime, NULL); |
150 | snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); | 150 | snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); |
151 | eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game); | 151 | eina_file_dir_list(buf, EINA_TRUE, dirList_compile, ourGlobals); |
152 | // Wait awhile, then start sending events for testing. | 152 | // Wait awhile, then start sending events for testing. |
153 | ecore_timer_add(0.5, _timer_cb, game); | 153 | ecore_timer_add(0.5, _timer_cb, ourGlobals); |
154 | return ECORE_CALLBACK_RENEW; | 154 | return ECORE_CALLBACK_RENEW; |
155 | } | 155 | } |
156 | 156 | ||
157 | static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Data *ev) | 157 | static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Data *ev) |
158 | { | 158 | { |
159 | gameGlobals *game = data; | 159 | gameGlobals *ourGlobals = data; |
160 | 160 | ||
161 | char buf[PATH_MAX]; | 161 | char buf[PATH_MAX]; |
162 | char SID[PATH_MAX]; | 162 | char SID[PATH_MAX]; |
@@ -179,7 +179,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_D | |||
179 | 179 | ||
180 | ext[0] = '\0'; | 180 | ext[0] = '\0'; |
181 | command = ext + 1; | 181 | command = ext + 1; |
182 | me = eina_hash_find(game->scripts, SID); | 182 | me = eina_hash_find(ourGlobals->scripts, SID); |
183 | if (0 == strncmp(command, "compilerWarning(", 16)) | 183 | if (0 == strncmp(command, "compilerWarning(", 16)) |
184 | { | 184 | { |
185 | char *temp; | 185 | char *temp; |
@@ -247,31 +247,31 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_D | |||
247 | PD("TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime)); | 247 | PD("TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime)); |
248 | } | 248 | } |
249 | // PD("The compile of %s worked, running it now.", SID); | 249 | // PD("The compile of %s worked, running it now.", SID); |
250 | sendForth(game, SID, "run()"); | 250 | sendForth(ourGlobals, SID, "run()"); |
251 | } | 251 | } |
252 | else | 252 | else |
253 | { | 253 | { |
254 | // Send back some random or fixed values for testing. | 254 | // Send back some random or fixed values for testing. |
255 | if (0 == strcmp(command, "llGetKey()")) | 255 | if (0 == strcmp(command, "llGetKey()")) |
256 | sendForth(game, SID, "return \"%08lx-%04lx-%04lx-%04lx-%012lx\"", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); | 256 | sendForth(ourGlobals, SID, "return \"%08lx-%04lx-%04lx-%04lx-%012lx\"", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); |
257 | else if (0 == strcmp(command, "llGetOwner()")) | 257 | else if (0 == strcmp(command, "llGetOwner()")) |
258 | sendForth(game, SID, "return \"%s\"", ownerKey); | 258 | sendForth(ourGlobals, SID, "return \"%s\"", ownerKey); |
259 | else if (0 == strcmp(command, "llGetPos()")) | 259 | else if (0 == strcmp(command, "llGetPos()")) |
260 | sendForth(game, SID, "return {x=128.0, y=128.0, z=128.0}"); | 260 | sendForth(ourGlobals, SID, "return {x=128.0, y=128.0, z=128.0}"); |
261 | else if (0 == strcmp(command, "llGetRot()")) | 261 | else if (0 == strcmp(command, "llGetRot()")) |
262 | sendForth(game, SID, "return {x=0.0, y=0.0, z=0.0, s=1.0}"); | 262 | sendForth(ourGlobals, SID, "return {x=0.0, y=0.0, z=0.0, s=1.0}"); |
263 | else if (0 == strcmp(command, "llGetObjectDesc()")) | 263 | else if (0 == strcmp(command, "llGetObjectDesc()")) |
264 | sendForth(game, SID, "return \"\""); | 264 | sendForth(ourGlobals, SID, "return \"\""); |
265 | else if (0 == strncmp(command, "llGetAlpha(", 11)) | 265 | else if (0 == strncmp(command, "llGetAlpha(", 11)) |
266 | sendForth(game, SID, "return 1.0"); | 266 | sendForth(ourGlobals, SID, "return 1.0"); |
267 | else if (0 == strcmp(command, "llGetInventoryNumber(7)")) | 267 | else if (0 == strcmp(command, "llGetInventoryNumber(7)")) |
268 | sendForth(game, SID, "return 3"); | 268 | sendForth(ourGlobals, SID, "return 3"); |
269 | else if (0 == strcmp(command, "llGetInventoryName(7, 2)")) | 269 | else if (0 == strcmp(command, "llGetInventoryName(7, 2)")) |
270 | sendForth(game, SID, "return \".readme\""); | 270 | sendForth(ourGlobals, SID, "return \".readme\""); |
271 | else if (0 == strcmp(command, "llGetInventoryName(7, 1)")) | 271 | else if (0 == strcmp(command, "llGetInventoryName(7, 1)")) |
272 | sendForth(game, SID, "return \".POSITIONS\""); | 272 | sendForth(ourGlobals, SID, "return \".POSITIONS\""); |
273 | else if (0 == strcmp(command, "llGetInventoryName(7, 0)")) | 273 | else if (0 == strcmp(command, "llGetInventoryName(7, 0)")) |
274 | sendForth(game, SID, "return \".MENUITEMS\""); | 274 | sendForth(ourGlobals, SID, "return \".MENUITEMS\""); |
275 | else | 275 | else |
276 | PI("Script %s sent command %s", SID, command); | 276 | PI("Script %s sent command %s", SID, command); |
277 | } | 277 | } |
@@ -286,11 +286,11 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_D | |||
286 | 286 | ||
287 | static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) | 287 | static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) |
288 | { | 288 | { |
289 | gameGlobals *game = data; | 289 | gameGlobals *ourGlobals = data; |
290 | 290 | ||
291 | if (ev->server) | 291 | if (ev->server) |
292 | { | 292 | { |
293 | game->server = NULL; | 293 | ourGlobals->server = NULL; |
294 | ecore_con_server_del(ev->server); | 294 | ecore_con_server_del(ev->server); |
295 | ecore_main_loop_quit(); | 295 | ecore_main_loop_quit(); |
296 | } | 296 | } |
@@ -301,27 +301,27 @@ static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Server_De | |||
301 | int main(int argc, char **argv) | 301 | int main(int argc, char **argv) |
302 | { | 302 | { |
303 | /* put here any init specific to this app like parsing args etc. */ | 303 | /* put here any init specific to this app like parsing args etc. */ |
304 | gameGlobals game; | 304 | gameGlobals ourGlobals; |
305 | char *programName = argv[0]; | 305 | char *programName = argv[0]; |
306 | boolean badArgs = FALSE; | 306 | boolean badArgs = FALSE; |
307 | int result = EXIT_FAILURE; | 307 | int result = EXIT_FAILURE; |
308 | 308 | ||
309 | memset(&game, 0, sizeof(gameGlobals)); | 309 | memset(&ourGlobals, 0, sizeof(gameGlobals)); |
310 | game.address = "127.0.0.1"; | 310 | ourGlobals.address = "127.0.0.1"; |
311 | game.port = 8211; | 311 | ourGlobals.port = 8211; |
312 | 312 | ||
313 | if (eina_init()) | 313 | if (eina_init()) |
314 | { | 314 | { |
315 | loggingStartup(&game); | 315 | ourGlobals.logDom = loggingStartup("LuaSL_test", ourGlobals.logDom); |
316 | game.scripts = eina_hash_string_superfast_new(NULL); | 316 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); |
317 | 317 | ||
318 | if (ecore_con_init()) | 318 | if (ecore_con_init()) |
319 | { | 319 | { |
320 | if ((game.server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, game.address, game.port, &game))) | 320 | if ((ourGlobals.server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port, &ourGlobals))) |
321 | { | 321 | { |
322 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) _add, &game); | 322 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb) _add, &ourGlobals); |
323 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb) _data, &game); | 323 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb) _data, &ourGlobals); |
324 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, &game); | 324 | ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb) _del, &ourGlobals); |
325 | clientStream = eina_strbuf_new(); | 325 | clientStream = eina_strbuf_new(); |
326 | 326 | ||
327 | if (ecore_evas_init()) | 327 | if (ecore_evas_init()) |
@@ -340,7 +340,7 @@ int main(int argc, char **argv) | |||
340 | { | 340 | { |
341 | case 'u': | 341 | case 'u': |
342 | { | 342 | { |
343 | game.ui = TRUE; | 343 | ourGlobals.ui = TRUE; |
344 | break; | 344 | break; |
345 | } | 345 | } |
346 | default: | 346 | default: |
@@ -358,7 +358,7 @@ int main(int argc, char **argv) | |||
358 | printf(" -u: Show the test UI.\n"); | 358 | printf(" -u: Show the test UI.\n"); |
359 | } | 359 | } |
360 | else | 360 | else |
361 | // else if ((game.config) && (game.data)) | 361 | // else if ((ourGlobals.config) && (ourGlobals.data)) |
362 | { | 362 | { |
363 | unsigned int i; | 363 | unsigned int i; |
364 | Evas_Object *bub, *sh; | 364 | Evas_Object *bub, *sh; |
@@ -366,80 +366,80 @@ int main(int argc, char **argv) | |||
366 | char *group = "main"; | 366 | char *group = "main"; |
367 | char buf[PATH_MAX]; | 367 | char buf[PATH_MAX]; |
368 | 368 | ||
369 | if (game.ui) | 369 | if (ourGlobals.ui) |
370 | { | 370 | { |
371 | /* this will give you a window with an Evas canvas under the first engine available */ | 371 | /* this will give you a window with an Evas canvas under the first engine available */ |
372 | game.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); | 372 | ourGlobals.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); |
373 | if (!game.ee) | 373 | if (!ourGlobals.ee) |
374 | { | 374 | { |
375 | PEm("You got to have at least one evas engine built and linked up to ecore-evas for this example to run properly."); | 375 | PEm("You got to have at least one evas engine built and linked up to ecore-evas for this example to run properly."); |
376 | edje_shutdown(); | 376 | edje_shutdown(); |
377 | ecore_evas_shutdown(); | 377 | ecore_evas_shutdown(); |
378 | return -1; | 378 | return -1; |
379 | } | 379 | } |
380 | game.canvas = ecore_evas_get(game.ee); | 380 | ourGlobals.canvas = ecore_evas_get(ourGlobals.ee); |
381 | ecore_evas_title_set(game.ee, "LuaSL test harness"); | 381 | ecore_evas_title_set(ourGlobals.ee, "LuaSL test harness"); |
382 | ecore_evas_show(game.ee); | 382 | ecore_evas_show(ourGlobals.ee); |
383 | 383 | ||
384 | game.bg = evas_object_rectangle_add(game.canvas); | 384 | ourGlobals.bg = evas_object_rectangle_add(ourGlobals.canvas); |
385 | evas_object_color_set(game.bg, 255, 255, 255, 255); /* white bg */ | 385 | evas_object_color_set(ourGlobals.bg, 255, 255, 255, 255); /* white bg */ |
386 | evas_object_move(game.bg, 0, 0); /* at canvas' origin */ | 386 | evas_object_move(ourGlobals.bg, 0, 0); /* at canvas' origin */ |
387 | evas_object_size_hint_weight_set(game.bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | 387 | evas_object_size_hint_weight_set(ourGlobals.bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); |
388 | evas_object_resize(game.bg, WIDTH, HEIGHT); /* covers full canvas */ | 388 | evas_object_resize(ourGlobals.bg, WIDTH, HEIGHT); /* covers full canvas */ |
389 | evas_object_show(game.bg); | 389 | evas_object_show(ourGlobals.bg); |
390 | ecore_evas_object_associate(game.ee, game.bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); | 390 | ecore_evas_object_associate(ourGlobals.ee, ourGlobals.bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); |
391 | evas_object_focus_set(game.bg, EINA_TRUE); | 391 | evas_object_focus_set(ourGlobals.bg, EINA_TRUE); |
392 | 392 | ||
393 | game.edje = edje_object_add(game.canvas); | 393 | ourGlobals.edje = edje_object_add(ourGlobals.canvas); |
394 | snprintf(buf, sizeof(buf), "%s/%s.edj", PACKAGE_DATA_DIR, "LuaSL"); | 394 | snprintf(buf, sizeof(buf), "%s/%s.edj", PACKAGE_DATA_DIR, "LuaSL"); |
395 | if (!edje_object_file_set(game.edje, buf, group)) | 395 | if (!edje_object_file_set(ourGlobals.edje, buf, group)) |
396 | { | 396 | { |
397 | int err = edje_object_load_error_get(game.edje); | 397 | int err = edje_object_load_error_get(ourGlobals.edje); |
398 | const char *errmsg = edje_load_error_str(err); | 398 | const char *errmsg = edje_load_error_str(err); |
399 | PEm("Could not load '%s' from %s: %s\n", group, buf, errmsg); | 399 | PEm("Could not load '%s' from %s: %s\n", group, buf, errmsg); |
400 | 400 | ||
401 | evas_object_del(game.edje); | 401 | evas_object_del(ourGlobals.edje); |
402 | ecore_evas_free(game.ee); | 402 | ecore_evas_free(ourGlobals.ee); |
403 | edje_shutdown(); | 403 | edje_shutdown(); |
404 | ecore_evas_shutdown(); | 404 | ecore_evas_shutdown(); |
405 | return -2; | 405 | return -2; |
406 | } | 406 | } |
407 | evas_object_move(game.edje, 0, 0); | 407 | evas_object_move(ourGlobals.edje, 0, 0); |
408 | evas_object_resize(game.edje, WIDTH, HEIGHT); | 408 | evas_object_resize(ourGlobals.edje, WIDTH, HEIGHT); |
409 | evas_object_show(game.edje); | 409 | evas_object_show(ourGlobals.edje); |
410 | 410 | ||
411 | snprintf(buf, sizeof(buf), "%s/images/bubble_sh.png", PACKAGE_DATA_DIR); | 411 | snprintf(buf, sizeof(buf), "%s/images/bubble_sh.png", PACKAGE_DATA_DIR); |
412 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) | 412 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) |
413 | { | 413 | { |
414 | sh = evas_object_image_filled_add(game.canvas); | 414 | sh = evas_object_image_filled_add(ourGlobals.canvas); |
415 | evas_object_image_file_set(sh, buf, NULL); | 415 | evas_object_image_file_set(sh, buf, NULL); |
416 | evas_object_resize(sh, 64, 64); | 416 | evas_object_resize(sh, 64, 64); |
417 | evas_object_show(sh); | 417 | evas_object_show(sh); |
418 | evas_object_data_set(game.bg, names[(i * 2) + 1], sh); | 418 | evas_object_data_set(ourGlobals.bg, names[(i * 2) + 1], sh); |
419 | } | 419 | } |
420 | 420 | ||
421 | snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR); | 421 | snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR); |
422 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) | 422 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) |
423 | { | 423 | { |
424 | bub = evas_object_image_filled_add(game.canvas); | 424 | bub = evas_object_image_filled_add(ourGlobals.canvas); |
425 | evas_object_image_file_set(bub, buf, NULL); | 425 | evas_object_image_file_set(bub, buf, NULL); |
426 | evas_object_resize(bub, 64, 64); | 426 | evas_object_resize(bub, 64, 64); |
427 | evas_object_show(bub); | 427 | evas_object_show(bub); |
428 | evas_object_data_set(game.bg, names[(i * 2)], bub); | 428 | evas_object_data_set(ourGlobals.bg, names[(i * 2)], bub); |
429 | } | 429 | } |
430 | ani = ecore_animator_add(anim, &game); | 430 | ani = ecore_animator_add(anim, &ourGlobals); |
431 | evas_object_data_set(game.bg, "animator", ani); | 431 | evas_object_data_set(ourGlobals.bg, "animator", ani); |
432 | 432 | ||
433 | // Setup our callbacks. | 433 | // Setup our callbacks. |
434 | ecore_evas_callback_delete_request_set(game.ee, _on_delete); | 434 | ecore_evas_callback_delete_request_set(ourGlobals.ee, _on_delete); |
435 | edje_object_signal_callback_add(game.edje, "*", "game_*", _edje_signal_cb, &game); | 435 | edje_object_signal_callback_add(ourGlobals.edje, "*", "game_*", _edje_signal_cb, &ourGlobals); |
436 | } | 436 | } |
437 | 437 | ||
438 | ecore_main_loop_begin(); | 438 | ecore_main_loop_begin(); |
439 | if (game.ui) | 439 | if (ourGlobals.ui) |
440 | { | 440 | { |
441 | ecore_animator_del(ani); | 441 | ecore_animator_del(ani); |
442 | ecore_evas_free(game.ee); | 442 | ecore_evas_free(ourGlobals.ee); |
443 | } | 443 | } |
444 | } | 444 | } |
445 | 445 | ||