diff options
Diffstat (limited to '')
-rw-r--r-- | src/extantz/Evas_3D_demo.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/extantz/Evas_3D_demo.c b/src/extantz/Evas_3D_demo.c index 5f33fed..df05838 100644 --- a/src/extantz/Evas_3D_demo.c +++ b/src/extantz/Evas_3D_demo.c | |||
@@ -268,13 +268,16 @@ _sphere_init(int precision) | |||
268 | 268 | ||
269 | Eina_Bool _animate_scene(void *data) | 269 | Eina_Bool _animate_scene(void *data) |
270 | { | 270 | { |
271 | globals *ourGlobals = data; | ||
272 | |||
271 | static float angle = 0.0f; | 273 | static float angle = 0.0f; |
272 | static float earthAngle = 0.0f; | 274 | static float earthAngle = 0.0f; |
273 | static int frame = 0; | 275 | static int frame = 0; |
274 | static int inc = 1; | 276 | static int inc = 1; |
275 | static int sonicFrame = 0; | 277 | static int sonicFrame = 0; |
278 | Evas_Real x, y, z; | ||
276 | 279 | ||
277 | Scene_Data *scene = (Scene_Data *)data; | 280 | Scene_Data *scene = ourGlobals->scene; |
278 | 281 | ||
279 | // Animate cube. | 282 | // Animate cube. |
280 | angle += 0.5; | 283 | angle += 0.5; |
@@ -303,6 +306,13 @@ Eina_Bool _animate_scene(void *data) | |||
303 | evas_3d_node_orientation_angle_axis_set(angle, 0.0, 1.0, 0.0) | 306 | evas_3d_node_orientation_angle_axis_set(angle, 0.0, 1.0, 0.0) |
304 | ); | 307 | ); |
305 | 308 | ||
309 | // Camera movement. | ||
310 | eo_do(scene->camera_node, evas_3d_node_position_get(EVAS_3D_SPACE_PARENT, &x, &y, &z)); | ||
311 | x += ourGlobals->gld.move->x; | ||
312 | y += ourGlobals->gld.move->y; | ||
313 | z += ourGlobals->gld.move->z; | ||
314 | eo_do(scene->camera_node, evas_3d_node_position_set(x, y, z)); | ||
315 | |||
306 | return EINA_TRUE; | 316 | return EINA_TRUE; |
307 | } | 317 | } |
308 | 318 | ||
@@ -602,7 +612,10 @@ static void _on_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void | |||
602 | elm_object_tooltip_show(scene->image); | 612 | elm_object_tooltip_show(scene->image); |
603 | } | 613 | } |
604 | else | 614 | else |
615 | { | ||
616 | elm_object_tooltip_text_set(scene->image, ""); | ||
605 | elm_object_tooltip_hide(scene->image); | 617 | elm_object_tooltip_hide(scene->image); |
618 | } | ||
606 | } | 619 | } |
607 | 620 | ||
608 | static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo) | 621 | static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo) |
@@ -619,6 +632,9 @@ static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void | |||
619 | Eina_Bool pick; | 632 | Eina_Bool pick; |
620 | char *name = NULL; | 633 | char *name = NULL; |
621 | 634 | ||
635 | // Set the focus onto us. | ||
636 | elm_object_focus_set(o, EINA_TRUE); | ||
637 | |||
622 | evas_object_geometry_get(o, &x, &y, &w, &h); | 638 | evas_object_geometry_get(o, &x, &y, &w, &h); |
623 | 639 | ||
624 | obj_x = ev->canvas.x - x; | 640 | obj_x = ev->canvas.x - x; |
@@ -673,15 +689,18 @@ void Evas_3D_Demo_add(globals *ourGlobals) | |||
673 | // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas calbacks instead. | 689 | // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas calbacks instead. |
674 | evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, &ourScene); | 690 | evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, &ourScene); |
675 | evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourScene); | 691 | evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourScene); |
692 | cameraAdd(obj, &ourGlobals->gld); | ||
676 | elm_win_resize_object_add(ourGlobals->win, obj); | 693 | elm_win_resize_object_add(ourGlobals->win, obj); |
677 | // elm_box_pack_end(ourGlobals->gld.bx, obj); | 694 | // elm_box_pack_end(ourGlobals->gld.bx, obj); |
678 | 695 | ||
679 | // Add animation timer callback. | 696 | // Add animation timer callback. |
680 | // ecore_timer_add(0.016, _animate_scene, &ourScene); | 697 | // ecore_timer_add(0.016, _animate_scene, &ourScene); |
698 | ourGlobals->gld.move = calloc(1, sizeof(cameraMove)); | ||
681 | } | 699 | } |
682 | 700 | ||
683 | void Evas_3D_Demo_fini() | 701 | void Evas_3D_Demo_fini(globals *ourGlobals) |
684 | { | 702 | { |
685 | free(sphere_vertices); | 703 | eo_unref(ourGlobals->scene->image); |
686 | free(sphere_indices); | 704 | free(sphere_vertices); |
687 | } \ No newline at end of file | 705 | free(sphere_indices); |
706 | } | ||