diff options
author | David Walter Seikel | 2014-05-14 09:04:07 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-14 09:04:07 +1000 |
commit | a11322d5de7959e98695445ddb270e0f28c421d5 (patch) | |
tree | 8779dd03c6eae945be5570488c1bdd406a4c4e6a /src | |
parent | Starting up and closing down the servers gets some love. Needs more love. (diff) | |
download | SledjHamr-a11322d5de7959e98695445ddb270e0f28c421d5.zip SledjHamr-a11322d5de7959e98695445ddb270e0f28c421d5.tar.gz SledjHamr-a11322d5de7959e98695445ddb270e0f28c421d5.tar.bz2 SledjHamr-a11322d5de7959e98695445ddb270e0f28c421d5.tar.xz |
Implement a half arsed touch_start() from extantz.
Diffstat (limited to 'src')
-rw-r--r-- | src/extantz/extantz.c | 24 | ||||
-rw-r--r-- | src/extantz/extantz.h | 2 | ||||
-rw-r--r-- | src/extantz/scenri.c | 2 | ||||
-rw-r--r-- | src/love/love.c | 61 |
4 files changed, 38 insertions, 51 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 848bc9a..e16db3c 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -83,6 +83,27 @@ static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) | |||
83 | return ECORE_CALLBACK_RENEW; | 83 | return ECORE_CALLBACK_RENEW; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void _onWorldClick(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo) | ||
87 | { | ||
88 | Evas_3D_Node *n = data; | ||
89 | // Evas_Event_Mouse_Down *ev = einfo; | ||
90 | |||
91 | if (n) | ||
92 | { | ||
93 | char *name = NULL; | ||
94 | |||
95 | name = evas_object_data_get(n, "Name"); | ||
96 | if (strcmp("cube", name) == 0) | ||
97 | { | ||
98 | char SID[64]; | ||
99 | |||
100 | // CUBE_UUID.events.touch_start(1), but we just make one up for now. | ||
101 | snprintf(SID, sizeof(SID), "%08lx-%04lx-%04lx-%04lx-%012lx", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); | ||
102 | sendForth(ourGlobals.server, SID, "events.touch_start(1)"); | ||
103 | } | ||
104 | } | ||
105 | } | ||
106 | |||
86 | static void gldata_init(GLData *gld) | 107 | static void gldata_init(GLData *gld) |
87 | { | 108 | { |
88 | gld->useIrr = USE_IRR; | 109 | gld->useIrr = USE_IRR; |
@@ -644,6 +665,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
644 | else | 665 | else |
645 | PC("Failed to connect to server!"); | 666 | PC("Failed to connect to server!"); |
646 | 667 | ||
668 | // Setup our callback for clicking in world. | ||
669 | ourGlobals.scene->clickCb = _onWorldClick; | ||
670 | |||
647 | elm_run(); | 671 | elm_run(); |
648 | 672 | ||
649 | if (ourGlobals.server) ecore_con_server_del(ourGlobals.server); | 673 | if (ourGlobals.server) ecore_con_server_del(ourGlobals.server); |
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index 0bbf76f..bfab4cb 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -158,6 +158,8 @@ typedef struct _Scene_Data | |||
158 | Evas_3D_Texture *texture_diffuse; | 158 | Evas_3D_Texture *texture_diffuse; |
159 | 159 | ||
160 | cameraMove *move; | 160 | cameraMove *move; |
161 | |||
162 | Evas_Object_Event_Cb clickCb; | ||
161 | } Scene_Data; | 163 | } Scene_Data; |
162 | 164 | ||
163 | // Elm GL view related data here. | 165 | // Elm GL view related data here. |
diff --git a/src/extantz/scenri.c b/src/extantz/scenri.c index 051d39f..eaec88e 100644 --- a/src/extantz/scenri.c +++ b/src/extantz/scenri.c | |||
@@ -75,6 +75,7 @@ static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void | |||
75 | { | 75 | { |
76 | name = evas_object_data_get(n, "Name"); | 76 | name = evas_object_data_get(n, "Name"); |
77 | printf("Picked : "); | 77 | printf("Picked : "); |
78 | if (scene->clickCb) scene->clickCb(n, e, o, einfo); | ||
78 | } | 79 | } |
79 | else | 80 | else |
80 | printf("Not picked : "); | 81 | printf("Not picked : "); |
@@ -83,6 +84,7 @@ static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void | |||
83 | 84 | ||
84 | printf("output(%d, %d) canvas(%d, %d) object(%d, %d) scene(%f, %f) texcoord(%f, %f) node(%p) %s mesh(%p)\n", | 85 | printf("output(%d, %d) canvas(%d, %d) object(%d, %d) scene(%f, %f) texcoord(%f, %f) node(%p) %s mesh(%p)\n", |
85 | ev->output.x, ev->output.y, ev->canvas.x, ev->canvas.y, obj_x, obj_y, scene_x, scene_y, s, t, n, name, m); | 86 | ev->output.x, ev->output.y, ev->canvas.x, ev->canvas.y, obj_x, obj_y, scene_x, scene_y, s, t, n, name, m); |
87 | |||
86 | } | 88 | } |
87 | 89 | ||
88 | Scene_Data *scenriAdd(Evas_Object *win) | 90 | Scene_Data *scenriAdd(Evas_Object *win) |
diff --git a/src/love/love.c b/src/love/love.c index e30c292..5fe3c84 100644 --- a/src/love/love.c +++ b/src/love/love.c | |||
@@ -372,7 +372,7 @@ static Eina_Bool _addClient(void *data, int type, Ecore_Con_Event_Client_Add *ev | |||
372 | 372 | ||
373 | static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *ev) | 373 | static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *ev) |
374 | { | 374 | { |
375 | // gameGlobals *ourGlobals = data; | 375 | gameGlobals *ourGlobals = data; |
376 | // char buf[PATH_MAX]; | 376 | // char buf[PATH_MAX]; |
377 | char SID[PATH_MAX]; | 377 | char SID[PATH_MAX]; |
378 | const char *command; | 378 | const char *command; |
@@ -393,63 +393,22 @@ static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data * | |||
393 | ext[0] = '\0'; | 393 | ext[0] = '\0'; |
394 | command = ext + 1; | 394 | command = ext + 1; |
395 | 395 | ||
396 | #if 0 // Replace this with code to parse what viewers send. | 396 | if (0 == strncmp(command, "events.touch_start(", 19)) |
397 | if (0 == strncmp(command, "compile(", 8)) | ||
398 | { | ||
399 | char *temp; | ||
400 | char *file; | ||
401 | |||
402 | strcpy(buf, &command[8]); | ||
403 | temp = buf; | ||
404 | file = temp; | ||
405 | while (')' != temp[0]) | ||
406 | temp++; | ||
407 | temp[0] = '\0'; | ||
408 | |||
409 | PD("Compiling %s, %s.", SID, file); | ||
410 | if (compileLSL(ourGlobals, ev->client, SID, file, FALSE)) | ||
411 | { | ||
412 | script *me = calloc(1, sizeof(script)); | ||
413 | |||
414 | gettimeofday(&me->startTime, NULL); | ||
415 | strncpy(me->SID, SID, sizeof(me->SID)); | ||
416 | strncpy(me->fileName, file, sizeof(me->fileName)); | ||
417 | me->game = ourGlobals; | ||
418 | me->client = ev->client; | ||
419 | eina_hash_add(ourGlobals->scripts, me->SID, me); | ||
420 | eina_hash_add(ourGlobals->names, me->fileName, me); | ||
421 | sendBack(ev->client, SID, "compiled(true)"); | ||
422 | } | ||
423 | else | ||
424 | sendBack(ev->client, SID, "compiled(false)"); | ||
425 | } | ||
426 | else if (0 == strcmp(command, "run()")) | ||
427 | { | 397 | { |
398 | Eina_Iterator *scripts; | ||
428 | script *me; | 399 | script *me; |
429 | char buf[PATH_MAX]; | ||
430 | 400 | ||
431 | me = eina_hash_find(ourGlobals->scripts, SID); | 401 | // TODO - For now, just send it to everyone. |
432 | if (me) | 402 | scripts = eina_hash_iterator_data_new(ourGlobals->scripts); |
403 | while(eina_iterator_next(scripts, (void **) &me)) | ||
433 | { | 404 | { |
434 | sprintf(buf, "%s.lua.out", me->fileName); | 405 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedKeys({\"%s\"})", ownerKey); |
435 | newProc(buf, TRUE, me); | 406 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName); |
407 | sendForth(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)"); | ||
436 | } | 408 | } |
437 | } | 409 | } |
438 | else if (0 == strcmp(command, "exit()")) | ||
439 | { | ||
440 | PD("Told to exit."); | ||
441 | ecore_main_loop_quit(); | ||
442 | } | ||
443 | else | 410 | else |
444 | { | 411 | PW("Unknown command from client - %s", command); |
445 | const char *status = NULL; | ||
446 | |||
447 | status = sendToChannel(ourGlobals, SID, command); | ||
448 | if (status) | ||
449 | PE("Error sending command %s to script %s : %s", command, SID, status); | ||
450 | } | ||
451 | #endif | ||
452 | |||
453 | } | 412 | } |
454 | 413 | ||
455 | // Get the next blob to check it. | 414 | // Get the next blob to check it. |