diff options
Diffstat (limited to 'src/extantz')
-rw-r--r-- | src/extantz/extantz.c | 24 | ||||
-rw-r--r-- | src/extantz/extantz.h | 2 | ||||
-rw-r--r-- | src/extantz/scenri.c | 2 |
3 files changed, 28 insertions, 0 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) |