aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/ephysics_demo.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-03 18:33:58 +1000
committerDavid Walter Seikel2014-05-03 18:33:58 +1000
commit3c0fb329ecc4a719bd8d80257298d08f80b1bfd3 (patch)
treea0bb12ea6772588b90b0d26c855aeb802b6e56c3 /src/extantz/ephysics_demo.c
parentRemove Evas_3d example stuff from GuiLua, now that it's in extantz. (diff)
downloadSledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.zip
SledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.tar.gz
SledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.tar.bz2
SledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.tar.xz
Move non GL_View stuff from gld -> ourGlobals. Plus some white space fixes.
Diffstat (limited to 'src/extantz/ephysics_demo.c')
-rw-r--r--src/extantz/ephysics_demo.c120
1 files changed, 61 insertions, 59 deletions
diff --git a/src/extantz/ephysics_demo.c b/src/extantz/ephysics_demo.c
index e3aa62f..a47ca17 100644
--- a/src/extantz/ephysics_demo.c
+++ b/src/extantz/ephysics_demo.c
@@ -5,65 +5,67 @@
5 5
6#define EPHYSICS_TEST_THEME "extantz" 6#define EPHYSICS_TEST_THEME "extantz"
7 7
8EPhysics_World *ephysicsAdd(GLData *gld) 8EPhysics_World *ephysicsAdd(globals *ourGlobals)
9{ 9{
10 EPhysics_Body *boundary; 10// GLData *gld = &ourGlobals->gld;
11 EPhysics_World *world; 11
12 EPhysics_Body *box_body1, *box_body2; 12 EPhysics_Body *boundary;
13 Evas_Object *box1, *box2; 13 EPhysics_World *world;
14 char buf[PATH_MAX]; 14 EPhysics_Body *box_body1, *box_body2;
15 15 Evas_Object *box1, *box2;
16 // ePhysics stuff. 16 char buf[PATH_MAX];
17 world = ephysics_world_new(); 17
18 ephysics_world_render_geometry_set(world, 0, 0, -50, gld->win_w, gld->win_h, 100); 18 // ePhysics stuff.
19 19 world = ephysics_world_new();
20 boundary = ephysics_body_bottom_boundary_add(world); 20 ephysics_world_render_geometry_set(world, 0, 0, -50, ourGlobals->win_w, ourGlobals->win_h, 100);
21 ephysics_body_restitution_set(boundary, 1); 21
22 ephysics_body_friction_set(boundary, 0); 22 boundary = ephysics_body_bottom_boundary_add(world);
23 23 ephysics_body_restitution_set(boundary, 1);
24 boundary = ephysics_body_top_boundary_add(world); 24 ephysics_body_friction_set(boundary, 0);
25 ephysics_body_restitution_set(boundary, 1); 25
26 ephysics_body_friction_set(boundary, 0); 26 boundary = ephysics_body_top_boundary_add(world);
27 27 ephysics_body_restitution_set(boundary, 1);
28 boundary = ephysics_body_left_boundary_add(world); 28 ephysics_body_friction_set(boundary, 0);
29 ephysics_body_restitution_set(boundary, 1); 29
30 ephysics_body_friction_set(boundary, 0); 30 boundary = ephysics_body_left_boundary_add(world);
31 31 ephysics_body_restitution_set(boundary, 1);
32 boundary = ephysics_body_right_boundary_add(world); 32 ephysics_body_friction_set(boundary, 0);
33 ephysics_body_restitution_set(boundary, 1); 33
34 ephysics_body_friction_set(boundary, 0); 34 boundary = ephysics_body_right_boundary_add(world);
35 35 ephysics_body_restitution_set(boundary, 1);
36 box1 = elm_image_add(gld->win); 36 ephysics_body_friction_set(boundary, 0);
37 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); 37
38 elm_image_file_set(box1, strdup(buf), "blue-cube"); 38 box1 = elm_image_add(ourGlobals->win);
39 evas_object_move(box1, gld->win_w / 2 - 80, gld->win_h - 200); 39 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME);
40 evas_object_resize(box1, 70, 70); 40 elm_image_file_set(box1, strdup(buf), "blue-cube");
41 evas_object_show(box1); 41 evas_object_move(box1, ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200);
42 42 evas_object_resize(box1, 70, 70);
43 box_body1 = ephysics_body_box_add(world); 43 evas_object_show(box1);
44 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE); 44
45 ephysics_body_restitution_set(box_body1, 0.7); 45 box_body1 = ephysics_body_box_add(world);
46 ephysics_body_friction_set(box_body1, 0); 46 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE);
47 ephysics_body_linear_velocity_set(box_body1, -150, 200, 0); 47 ephysics_body_restitution_set(box_body1, 0.7);
48 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36); 48 ephysics_body_friction_set(box_body1, 0);
49 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); 49 ephysics_body_linear_velocity_set(box_body1, -150, 200, 0);
50 50 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36);
51 box2 = elm_image_add(gld->win); 51 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1);
52 elm_image_file_set(box2, strdup(buf), "purple-cube"); 52
53 evas_object_move(box2, gld->win_w / 2 + 10, gld->win_h - 200); 53 box2 = elm_image_add(ourGlobals->win);
54 evas_object_resize(box2, 70, 70); 54 elm_image_file_set(box2, strdup(buf), "purple-cube");
55 evas_object_show(box2); 55 evas_object_move(box2, ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200);
56 56 evas_object_resize(box2, 70, 70);
57 box_body2 = ephysics_body_box_add(world); 57 evas_object_show(box2);
58 ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE); 58
59 ephysics_body_restitution_set(box_body2, 0.7); 59 box_body2 = ephysics_body_box_add(world);
60 ephysics_body_friction_set(box_body2, 0); 60 ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE);
61 ephysics_body_linear_velocity_set(box_body2, 80, -60, 0); 61 ephysics_body_restitution_set(box_body2, 0.7);
62 ephysics_body_angular_velocity_set(box_body2, 0, 0, 360); 62 ephysics_body_friction_set(box_body2, 0);
63 ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1); 63 ephysics_body_linear_velocity_set(box_body2, 80, -60, 0);
64 64 ephysics_body_angular_velocity_set(box_body2, 0, 0, 360);
65 ephysics_world_gravity_set(world, 0, 0, 0); 65 ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1);
66 66
67 return world; 67 ephysics_world_gravity_set(world, 0, 0, 0);
68
69 return world;
68} 70}
69#endif 71#endif