aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-02 05:52:13 +1000
committerDavid Walter Seikel2014-05-02 05:52:13 +1000
commit944b26cca9ff4967021cbd12ff9750e86705ad9b (patch)
tree388bf81461a4b4b951f2a8d52f625cde20c3f8e2 /src
parentAdd tooltips for 3D objects. (diff)
downloadSledjHamr-944b26cca9ff4967021cbd12ff9750e86705ad9b.zip
SledjHamr-944b26cca9ff4967021cbd12ff9750e86705ad9b.tar.gz
SledjHamr-944b26cca9ff4967021cbd12ff9750e86705ad9b.tar.bz2
SledjHamr-944b26cca9ff4967021cbd12ff9750e86705ad9b.tar.xz
Minor cleanups.
Diffstat (limited to 'src')
-rw-r--r--src/GuiLua/GuiLua.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c
index e01da80..46e0d1e 100644
--- a/src/GuiLua/GuiLua.c
+++ b/src/GuiLua/GuiLua.c
@@ -149,7 +149,6 @@ static const char *globName = "ourGlobals";
149 149
150 150
151 151
152
153typedef struct _Scene_Data 152typedef struct _Scene_Data
154{ 153{
155 Evas_Object *image; // Our Elm image. 154 Evas_Object *image; // Our Elm image.
@@ -466,12 +465,11 @@ _animate_scene(void *data)
466 465
467 Scene_Data *scene = (Scene_Data *)data; 466 Scene_Data *scene = (Scene_Data *)data;
468 467
469 // Rotate cube 468 // Animate cube.
470 angle += 0.5; 469 angle += 0.5;
471 if (angle > 360.0) angle -= 360.0f; 470 if (angle > 360.0) angle -= 360.0f;
472 471
473 frame += inc; 472 frame += inc;
474
475 if (frame >= 20) inc = -1; 473 if (frame >= 20) inc = -1;
476 else if (frame <= 0) inc = 1; 474 else if (frame <= 0) inc = 1;
477 475
@@ -541,8 +539,7 @@ _light_setup(globals *ourGlobals, Scene_Data *scene)
541 ); 539 );
542} 540}
543 541
544static void 542static void _cube_setup(globals *ourGlobals, Scene_Data *scene)
545_mesh_setup(globals *ourGlobals, Scene_Data *scene)
546{ 543{
547 // Setup cube materials. 544 // Setup cube materials.
548 scene->material0 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas); 545 scene->material0 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas);
@@ -616,8 +613,10 @@ _mesh_setup(globals *ourGlobals, Scene_Data *scene)
616 evas_3d_node_position_set(40.0, 3.5, 23.0), 613 evas_3d_node_position_set(40.0, 3.5, 23.0),
617 evas_3d_node_mesh_add(scene->mesh) 614 evas_3d_node_mesh_add(scene->mesh)
618 ); 615 );
616}
619 617
620 618static void _sonic_setup(globals *ourGlobals, Scene_Data *scene)
619{
621 // Setup an MD2 mesh. 620 // Setup an MD2 mesh.
622 scene->mesh2 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas); 621 scene->mesh2 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas);
623 eo_do(scene->mesh2, 622 eo_do(scene->mesh2,
@@ -662,8 +661,10 @@ _mesh_setup(globals *ourGlobals, Scene_Data *scene)
662 eo_do(scene->mesh2, 661 eo_do(scene->mesh2,
663 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG) 662 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)
664 ); 663 );
664}
665 665
666 666static void _earth_setup(globals *ourGlobals, Scene_Data *scene)
667{
667 // Setup earth material. 668 // Setup earth material.
668 scene->material3 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas); 669 scene->material3 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas);
669 670
@@ -733,7 +734,9 @@ _scene_setup(globals *ourGlobals, Scene_Data *scene)
733 734
734 _camera_setup(ourGlobals, scene); 735 _camera_setup(ourGlobals, scene);
735 _light_setup(ourGlobals, scene); 736 _light_setup(ourGlobals, scene);
736 _mesh_setup(ourGlobals, scene); 737 _cube_setup(ourGlobals, scene);
738 _sonic_setup(ourGlobals, scene);
739 _earth_setup(ourGlobals, scene);
737 740
738 eo_do(scene->scene, 741 eo_do(scene->scene,
739 evas_3d_scene_root_node_set(scene->root_node), 742 evas_3d_scene_root_node_set(scene->root_node),
@@ -985,7 +988,6 @@ static int window(lua_State *L)
985 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 988 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
986 elm_obj_image_fill_outside_set(EINA_TRUE), 989 elm_obj_image_fill_outside_set(EINA_TRUE),
987 elm_obj_image_file_set("../../media/sky_01.jpg", NULL), 990 elm_obj_image_file_set("../../media/sky_01.jpg", NULL),
988 evas_obj_position_set(0, 0),
989 evas_obj_visibility_set(EINA_TRUE) 991 evas_obj_visibility_set(EINA_TRUE)
990 ); 992 );
991 elm_win_resize_object_add(ourGlobals->win, obj); 993 elm_win_resize_object_add(ourGlobals->win, obj);
@@ -997,7 +999,6 @@ static int window(lua_State *L)
997 eo_do(obj, 999 eo_do(obj,
998 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 1000 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
999 elm_obj_image_fill_outside_set(EINA_TRUE), 1001 elm_obj_image_fill_outside_set(EINA_TRUE),
1000 evas_obj_position_set(0, 0),
1001 evas_obj_visibility_set(EINA_TRUE), 1002 evas_obj_visibility_set(EINA_TRUE),
1002 temp = elm_obj_image_object_get() 1003 temp = elm_obj_image_object_get()
1003 ); 1004 );
@@ -1010,7 +1011,6 @@ static int window(lua_State *L)
1010 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, &ourScene); 1011 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, &ourScene);
1011 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourScene); 1012 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourScene);
1012 elm_win_resize_object_add(ourGlobals->win, obj); 1013 elm_win_resize_object_add(ourGlobals->win, obj);
1013 eo_unref(obj);
1014 1014
1015 // Add animation timer callback. 1015 // Add animation timer callback.
1016 ecore_timer_add(0.016, _animate_scene, &ourScene); 1016 ecore_timer_add(0.016, _animate_scene, &ourScene);
@@ -1076,6 +1076,7 @@ static int closeWindow(lua_State *L)
1076 { 1076 {
1077 eo_unref(wid->obj); 1077 eo_unref(wid->obj);
1078 } 1078 }
1079 eo_unref(ourScene.image);
1079 evas_object_del(ourGlobals->win); 1080 evas_object_del(ourGlobals->win);
1080 _sphere_fini(); 1081 _sphere_fini();
1081 } 1082 }