aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/ephysics_demo.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-10 14:14:08 +1000
committerDavid Walter Seikel2014-05-10 14:14:08 +1000
commit81283b584a7f7c38b697c438858a8b70294dd276 (patch)
treefa8eecfb71c369cbeeda38145403be0ab2e6e4c6 /src/extantz/ephysics_demo.c
parentA note about a useful web site. (diff)
downloadSledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.zip
SledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.tar.gz
SledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.tar.bz2
SledjHamr-81283b584a7f7c38b697c438858a8b70294dd276.tar.xz
Add physics to the windows.
Sure, it's just an annoying gimmick right now, but there's plans for this to be actually useful.
Diffstat (limited to 'src/extantz/ephysics_demo.c')
-rw-r--r--src/extantz/ephysics_demo.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/extantz/ephysics_demo.c b/src/extantz/ephysics_demo.c
index 6697cc9..4655dbb 100644
--- a/src/extantz/ephysics_demo.c
+++ b/src/extantz/ephysics_demo.c
@@ -2,8 +2,6 @@
2#include <EPhysics.h> 2#include <EPhysics.h>
3 3
4 4
5#if USE_PHYSICS
6
7#define EPHYSICS_TEST_THEME "extantz" 5#define EPHYSICS_TEST_THEME "extantz"
8 6
9EPhysics_World *ephysicsAdd(globals *ourGlobals) 7EPhysics_World *ephysicsAdd(globals *ourGlobals)
@@ -34,37 +32,42 @@ EPhysics_World *ephysicsAdd(globals *ourGlobals)
34 ephysics_body_restitution_set(boundary, 1); 32 ephysics_body_restitution_set(boundary, 1);
35 ephysics_body_friction_set(boundary, 0); 33 ephysics_body_friction_set(boundary, 0);
36 34
37 box1 = elm_image_add(ourGlobals->win);
38 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); 35 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME);
39 elm_image_file_set(box1, strdup(buf), "blue-cube"); 36 box1 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win,
40 evas_object_move(box1, ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200); 37 elm_obj_image_file_set(strdup(buf), "blue-cube"),
41 evas_object_resize(box1, 70, 70); 38 evas_obj_size_set(70, 70),
42 evas_object_show(box1); 39 evas_obj_position_set(ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200),
40 evas_obj_visibility_set(EINA_TRUE)
41 );
43 42
44 box_body1 = ephysics_body_box_add(world); 43 box_body1 = ephysics_body_box_add(world);
45 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE); 44 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE);
46 ephysics_body_restitution_set(box_body1, 0.7); 45 ephysics_body_restitution_set(box_body1, 0.7);
47 ephysics_body_friction_set(box_body1, 0); 46 ephysics_body_friction_set(box_body1, 0);
48 ephysics_body_linear_velocity_set(box_body1, -150, 200, 0); 47 ephysics_body_linear_velocity_set(box_body1, -1500, 2000, 0);
49 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36); 48 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36);
50 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); 49 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1);
50 eo_unref(box1);
51
51 52
52 box2 = elm_image_add(ourGlobals->win); 53 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME);
53 elm_image_file_set(box2, strdup(buf), "purple-cube"); 54 box2 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win,
54 evas_object_move(box2, ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200); 55 elm_obj_image_file_set(strdup(buf), "purple-cube"),
55 evas_object_resize(box2, 70, 70); 56 evas_obj_size_set(70, 70),
56 evas_object_show(box2); 57 evas_obj_position_set(ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200),
58 evas_obj_visibility_set(EINA_TRUE)
59 );
57 60
58 box_body2 = ephysics_body_box_add(world); 61 box_body2 = ephysics_body_box_add(world);
59 ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE); 62 ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE);
60 ephysics_body_restitution_set(box_body2, 0.7); 63 ephysics_body_restitution_set(box_body2, 0.7);
61 ephysics_body_friction_set(box_body2, 0); 64 ephysics_body_friction_set(box_body2, 0);
62 ephysics_body_linear_velocity_set(box_body2, 80, -60, 0); 65 ephysics_body_linear_velocity_set(box_body2, 800, -600, 0);
63 ephysics_body_angular_velocity_set(box_body2, 0, 0, 360); 66 ephysics_body_angular_velocity_set(box_body2, 0, 0, 360);
64 ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1); 67 ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1);
68 eo_unref(box2);
65 69
66 ephysics_world_gravity_set(world, 0, 0, 0); 70 ephysics_world_gravity_set(world, 0, 0, 0);
67 71
68 return world; 72 return world;
69} 73}
70#endif