summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorRicardo de Almeida Gonzaga <ricardo@profusion.mobi>2012-10-08 22:46:19 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-08 22:46:19 +0000
commit8bd4f13b0d0fd40c99e420d4819aa41e149d974f (patch)
tree9c53dacba096d1d19c996eb0aca7da204d479ac8 /legacy
parente084960cf38003b7c17fcf9929137dc91c8d180b (diff)
ephysics: initial commit to sandbox
Patch by: Ricardo de Almeida Gonzaga <ricardo@profusion.mobi> SVN revision: 77592
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/data/themes/Makefile.am10
-rw-r--r--legacy/ephysics/data/themes/ephysics_test.edc1
-rw-r--r--legacy/ephysics/data/themes/images/ball-concrete.pngbin0 -> 9002 bytes
-rw-r--r--legacy/ephysics/data/themes/images/ball-custom.pngbin0 -> 3867 bytes
-rw-r--r--legacy/ephysics/data/themes/images/ball-iron.pngbin0 -> 5049 bytes
-rw-r--r--legacy/ephysics/data/themes/images/ball-plastic.pngbin0 -> 7509 bytes
-rw-r--r--legacy/ephysics/data/themes/images/ball-polystyrene.pngbin0 -> 7810 bytes
-rw-r--r--legacy/ephysics/data/themes/images/ball-rubber.pngbin0 -> 8896 bytes
-rw-r--r--legacy/ephysics/data/themes/images/ball-wood.pngbin0 -> 9961 bytes
-rw-r--r--legacy/ephysics/data/themes/sandbox.edc165
-rw-r--r--legacy/ephysics/src/bin/Makefile.am13
-rw-r--r--legacy/ephysics/src/bin/ephysics_sandbox.c876
12 files changed, 1062 insertions, 3 deletions
diff --git a/legacy/ephysics/data/themes/Makefile.am b/legacy/ephysics/data/themes/Makefile.am
index 87fd049..c9075a5 100644
--- a/legacy/ephysics/data/themes/Makefile.am
+++ b/legacy/ephysics/data/themes/Makefile.am
@@ -20,6 +20,7 @@ EXTRA_DIST = \
20 frame.edc \ 20 frame.edc \
21 list.edc \ 21 list.edc \
22 loading_bar.edc \ 22 loading_bar.edc \
23 sandbox.edc \
23 shadows.edc \ 24 shadows.edc \
24 shapes.edc \ 25 shapes.edc \
25 spinner.edc \ 26 spinner.edc \
@@ -60,7 +61,14 @@ EXTRA_DIST = \
60 images/spinner_bt_right_pressed.png \ 61 images/spinner_bt_right_pressed.png \
61 images/star.png \ 62 images/star.png \
62 images/green-flag.png \ 63 images/green-flag.png \
63 images/brown-pole.png 64 images/brown-pole.png \
65 images/ball-custom.png \
66 images/ball-concrete.png \
67 images/ball-iron.png \
68 images/ball-plastic.png \
69 images/ball-polystyrene.png \
70 images/ball-rubber.png \
71 images/ball-wood.png
64 72
65ephysics_test.edj: Makefile $(EXTRA_DIST) 73ephysics_test.edj: Makefile $(EXTRA_DIST)
66 $(EDJE_CC) $(EDJE_FLAGS) \ 74 $(EDJE_CC) $(EDJE_FLAGS) \
diff --git a/legacy/ephysics/data/themes/ephysics_test.edc b/legacy/ephysics/data/themes/ephysics_test.edc
index f0bec3e..87594cd 100644
--- a/legacy/ephysics/data/themes/ephysics_test.edc
+++ b/legacy/ephysics/data/themes/ephysics_test.edc
@@ -10,6 +10,7 @@ collections {
10#include "frame.edc" 10#include "frame.edc"
11#include "list.edc" 11#include "list.edc"
12#include "loading_bar.edc" 12#include "loading_bar.edc"
13#include "sandbox.edc"
13#include "shadows.edc" 14#include "shadows.edc"
14#include "shapes.edc" 15#include "shapes.edc"
15#include "spinner.edc" 16#include "spinner.edc"
diff --git a/legacy/ephysics/data/themes/images/ball-concrete.png b/legacy/ephysics/data/themes/images/ball-concrete.png
new file mode 100644
index 0000000..d2d1883
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/ball-concrete.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/images/ball-custom.png b/legacy/ephysics/data/themes/images/ball-custom.png
new file mode 100644
index 0000000..3a4af0a
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/ball-custom.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/images/ball-iron.png b/legacy/ephysics/data/themes/images/ball-iron.png
new file mode 100644
index 0000000..f26b5ea
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/ball-iron.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/images/ball-plastic.png b/legacy/ephysics/data/themes/images/ball-plastic.png
new file mode 100644
index 0000000..fb08b23
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/ball-plastic.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/images/ball-polystyrene.png b/legacy/ephysics/data/themes/images/ball-polystyrene.png
new file mode 100644
index 0000000..14f00be
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/ball-polystyrene.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/images/ball-rubber.png b/legacy/ephysics/data/themes/images/ball-rubber.png
new file mode 100644
index 0000000..7a1bd73
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/ball-rubber.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/images/ball-wood.png b/legacy/ephysics/data/themes/images/ball-wood.png
new file mode 100644
index 0000000..acb4599
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/ball-wood.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/sandbox.edc b/legacy/ephysics/data/themes/sandbox.edc
new file mode 100644
index 0000000..b4795dd
--- /dev/null
+++ b/legacy/ephysics/data/themes/sandbox.edc
@@ -0,0 +1,165 @@
1 images {
2 image: "ball-custom.png" COMP;
3 image: "ball-concrete.png" COMP;
4 image: "ball-iron.png" COMP;
5 image: "ball-plastic.png" COMP;
6 image: "ball-polystyrene.png" COMP;
7 image: "ball-rubber.png" COMP;
8 image: "ball-wood.png" COMP;
9 }
10
11 group {
12 name: "sandbox";
13 min: 1280 720;
14 max: 1280 720;
15
16 externals {
17 external: "elm";
18 }
19
20 images{
21 image: "background.jpg" COMP;
22 }
23
24 parts {
25 part {
26 name: "bg";
27 type: EXTERNAL;
28 source: "elm/bg";
29 mouse_events: 0;
30 description {
31 state: "default" 0.0;
32 rel1.relative: 0.7 0;
33 rel2.relative: 1 1;
34 fixed: 1 1;
35 align: 1 0.5;
36 }
37 }
38 part {
39 name: "bg_world";
40 type: IMAGE;
41 description {
42 state: "default" 0.0;
43 rel1.relative: 0.0 0.0;
44 rel2.relative: 0.7 1.0;
45 fixed: 1 1;
46 image.normal: "background.jpg";
47 }
48 }
49 part {
50 name: "swallow";
51 type: SWALLOW;
52 description {
53 state: "default" 0;
54 rel1.relative: 0.7 0;
55 rel2.relative: 1 1;
56 fixed: 1 1;
57 }
58 }
59 }
60 }
61
62 group {
63 name: "0";
64 parts {
65 part {
66 name: "ball";
67 mouse_events: 0;
68 type: IMAGE;
69 description {
70 state: "default" 0.0;
71 image.normal: "ball-custom.png";
72 }
73 }
74 }
75 }
76
77 group {
78 name: "1";
79 parts {
80 part {
81 name: "ball";
82 mouse_events: 0;
83 type: IMAGE;
84 description {
85 state: "default" 0.0;
86 image.normal: "ball-concrete.png";
87 }
88 }
89 }
90 }
91
92 group {
93 name: "2";
94 parts {
95 part {
96 name: "ball";
97 mouse_events: 0;
98 type: IMAGE;
99 description {
100 state: "default" 0.0;
101 image.normal: "ball-iron.png";
102 }
103 }
104 }
105 }
106
107 group {
108 name: "3";
109 parts {
110 part {
111 name: "ball";
112 mouse_events: 0;
113 type: IMAGE;
114 description {
115 state: "default" 0.0;
116 image.normal: "ball-plastic.png";
117 }
118 }
119 }
120 }
121
122 group {
123 name: "4";
124 parts {
125 part {
126 name: "ball";
127 mouse_events: 0;
128 type: IMAGE;
129 description {
130 state: "default" 0.0;
131 image.normal: "ball-polystyrene.png";
132 }
133 }
134 }
135 }
136
137 group {
138 name: "5";
139 parts {
140 part {
141 name: "ball";
142 mouse_events: 0;
143 type: IMAGE;
144 description {
145 state: "default" 0.0;
146 image.normal: "ball-rubber.png";
147 }
148 }
149 }
150 }
151
152 group {
153 name: "6";
154 parts {
155 part {
156 name: "ball";
157 mouse_events: 0;
158 type: IMAGE;
159 description {
160 state: "default" 0.0;
161 image.normal: "ball-wood.png";
162 }
163 }
164 }
165 }
diff --git a/legacy/ephysics/src/bin/Makefile.am b/legacy/ephysics/src/bin/Makefile.am
index e16755a..e3196e5 100644
--- a/legacy/ephysics/src/bin/Makefile.am
+++ b/legacy/ephysics/src/bin/Makefile.am
@@ -10,9 +10,9 @@ AM_CPPFLAGS = \
10 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ 10 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
11 @EPHYSICS_TEST_CFLAGS@ 11 @EPHYSICS_TEST_CFLAGS@
12 12
13bin_PROGRAMS = ephysics_test ephysics_logo 13bin_PROGRAMS = ephysics_test ephysics_logo ephysics_sandbox
14 14
15EXTRA_PROGRAMS = ephysics_test ephysics_logo 15EXTRA_PROGRAMS = ephysics_test ephysics_logo ephysics_sandbox
16 16
17ephysics_test_SOURCES = \ 17ephysics_test_SOURCES = \
18test.c \ 18test.c \
@@ -47,6 +47,9 @@ test_flag.c
47ephysics_logo_SOURCES = \ 47ephysics_logo_SOURCES = \
48ephysics_logo.c 48ephysics_logo.c
49 49
50ephysics_sandbox_SOURCES = \
51ephysics_sandbox.c
52
50ephysics_test_LDADD = \ 53ephysics_test_LDADD = \
51 $(top_builddir)/src/lib/libephysics.la \ 54 $(top_builddir)/src/lib/libephysics.la \
52 @EPHYSICS_TEST_LIBS@ 55 @EPHYSICS_TEST_LIBS@
@@ -55,9 +58,15 @@ ephysics_logo_LDADD = \
55 $(top_builddir)/src/lib/libephysics.la \ 58 $(top_builddir)/src/lib/libephysics.la \
56 @EPHYSICS_TEST_LIBS@ 59 @EPHYSICS_TEST_LIBS@
57 60
61ephysics_sandbox_LDADD = \
62 $(top_builddir)/src/lib/libephysics.la \
63 @EPHYSICS_TEST_LIBS@
64
58ephysics_logo_LDFLAGS = 65ephysics_logo_LDFLAGS =
59 66
60ephysics_test_LDFLAGS = 67ephysics_test_LDFLAGS =
61 68
69ephysics_sandbox_LDFLAGS =
70
62EXTRA_DIST = ephysics_test.h 71EXTRA_DIST = ephysics_test.h
63endif 72endif
diff --git a/legacy/ephysics/src/bin/ephysics_sandbox.c b/legacy/ephysics/src/bin/ephysics_sandbox.c
new file mode 100644
index 0000000..a47232f
--- /dev/null
+++ b/legacy/ephysics/src/bin/ephysics_sandbox.c
@@ -0,0 +1,876 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include<stdio.h>
6#include<string.h>
7#include<Eina.h>
8#include<Elementary.h>
9#include<EPhysics.h>
10
11#define EPHYSICS_TEST_THEME "ephysics_test"
12#define WIDTH (1280)
13#define HEIGHT (720)
14
15typedef struct _Sandie_Data {
16 Evas_Object *win;
17 EPhysics_World *world;
18 EPhysics_Body *body1, *body2;
19} Sandie_Data;
20
21static void
22_body_del(void *data __UNUSED__, EPhysics_Body *body __UNUSED__,
23 void *event_info)
24{
25 if (event_info) evas_object_del(event_info);
26}
27
28static void
29_world_gravity_x_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
30{
31 EPhysics_World *world = data;
32 double gravity_y;
33
34 ephysics_world_gravity_get(world, NULL, &gravity_y);
35 ephysics_world_gravity_set(world, elm_spinner_value_get(obj), gravity_y);
36}
37
38static void
39_world_gravity_y_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
40{
41 EPhysics_World *world = data;
42 double gravity_x;
43
44 ephysics_world_gravity_get(world, &gravity_x, NULL);
45 ephysics_world_gravity_set(world, gravity_x, elm_spinner_value_get(obj));
46}
47
48static void
49_world_rate_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
50{
51 EPhysics_World *world = data;
52
53 ephysics_world_rate_set(world, elm_spinner_value_get(obj));
54}
55
56static void
57_world_max_sleeping_time_cb(void *data, Evas_Object *obj,
58 void *event_info __UNUSED__)
59{
60 EPhysics_World *world = data;
61
62 ephysics_world_max_sleeping_time_set(world, elm_spinner_value_get(obj));
63}
64
65static void
66_world_friction_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
67{
68 Evas_Object *win = data;
69
70 ephysics_body_friction_set(evas_object_data_get(win, "top"),
71 elm_spinner_value_get(obj));
72 ephysics_body_friction_set(evas_object_data_get(win, "bottom"),
73 elm_spinner_value_get(obj));
74 ephysics_body_friction_set(evas_object_data_get(win, "left"),
75 elm_spinner_value_get(obj));
76 ephysics_body_friction_set(evas_object_data_get(win, "right"),
77 elm_spinner_value_get(obj));
78}
79
80static void
81_world_restitution_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
82{
83 Evas_Object *win = data;
84
85 ephysics_body_restitution_set(evas_object_data_get(win, "top"),
86 elm_spinner_value_get(obj));
87 ephysics_body_restitution_set(evas_object_data_get(win, "bottom"),
88 elm_spinner_value_get(obj));
89 ephysics_body_restitution_set(evas_object_data_get(win, "left"),
90 elm_spinner_value_get(obj));
91 ephysics_body_restitution_set(evas_object_data_get(win, "right"),
92 elm_spinner_value_get(obj));
93}
94/*
95static void
96_body_type_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
97{
98 EPhysics_Body *body = data;
99 EPhysics_World *world;
100 Evas_Object *body_image;
101 double mass, rotation, friction, restitution, lin_damping, ang_damping;
102 double lin_sleeping, ang_sleeping;
103
104 mass = ephysics_body_mass_get(body);
105 rotation = ephysics_body_rotation_get(body);
106 friction = ephysics_body_friction_get(body);
107 restitution = ephysics_body_restitution_get(body);
108 ephysics_body_damping_get(body, &lin_damping, &ang_damping);
109 ephysics_body_sleeping_threshold_get(body, &lin_sleeping, &ang_sleeping);
110 body_image = ephysics_body_evas_object_unset(body);
111 world = ephysics_body_world_get(body);
112
113 ephysics_body_del(body);
114
115 if (elm_check_state_get(obj))
116 {
117 body = ephysics_body_soft_circle_add(world);
118 ephysics_body_soft_body_hardness_set(body, 10);
119 elm_object_disabled_set(evas_object_data_get(obj, "hardness"), EINA_FALSE);
120 }
121 else
122 {
123 body = ephysics_body_circle_add(world);
124 elm_object_disabled_set(evas_object_data_get(obj, "hardness"), EINA_TRUE);
125 }
126
127 body_image = ephysics_body_evas_object_set(body, body_image, EINA_TRUE);
128 ephysics_body_mass_set(body, mass);
129 ephysics_body_rotation_set(body, rotation);
130 ephysics_body_friction_set(body, friction);
131}
132*/
133static void
134_body_material_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
135{
136 EPhysics_Body *body = data;
137 //Evas_Object *body_image;
138
139 ephysics_body_material_set(body, elm_spinner_value_get(obj));
140
141 elm_spinner_value_set(evas_object_data_get(obj, "density"),
142 ephysics_body_density_get(body));
143 elm_spinner_value_set(evas_object_data_get(obj, "friction"),
144 ephysics_body_friction_get(body));
145 elm_spinner_value_set(evas_object_data_get(obj, "restitution"),
146 ephysics_body_restitution_get(body));
147/*
148
149 img_name = elm_spinner_value_get(obj); //name if its possible
150 evas_object_del(ephysics_body_evas_object_unset(body));
151
152 body_image = elm_image_add(evas_object_data_get(obj, "win"));
153 elm_image_file_set(
154 body_image, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", img_name);
155 evas_object_resize(body_image, 70, 70);
156 evas_object_move(body_image, 150, 150);//FIX!
157 evas_object_show(body_image);
158 ephysics_body_evas_object_set(body, body_image, EINA_TRUE);
159*/
160}
161
162static void
163_body_mass_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
164{
165 EPhysics_Body *body = data;
166
167 ephysics_body_mass_set(body, elm_spinner_value_get(obj));
168
169 elm_spinner_value_set(evas_object_data_get(obj, "density"), 0);
170}
171
172static void
173_body_density_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
174{
175 EPhysics_Body *body = data;
176
177 ephysics_body_density_set(body, elm_spinner_value_get(obj));
178
179 elm_spinner_value_set(evas_object_data_get(obj, "mass"),
180 ephysics_body_mass_get(body));
181}
182
183static void
184_body_rotation_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
185{
186 EPhysics_Body *body = data;
187
188 ephysics_body_rotation_set(body, elm_spinner_value_get(obj));
189}
190
191static void
192_body_friction_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
193{
194 EPhysics_Body *body = data;
195
196 ephysics_body_friction_set(body, elm_spinner_value_get(obj));
197}
198
199static void
200_body_restitution_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
201{
202 EPhysics_Body *body = data;
203
204 ephysics_body_restitution_set(body, elm_spinner_value_get(obj));
205}
206
207static void
208_body_damping_linear_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
209{
210 EPhysics_Body *body = data;
211 double angular_damping;
212
213 ephysics_body_damping_get(body, NULL, &angular_damping);
214 ephysics_body_damping_set(body, elm_spinner_value_get(obj), angular_damping);
215}
216
217static void
218_body_damping_angular_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
219{
220 EPhysics_Body *body = data;
221 double linear_damping;
222
223 ephysics_body_damping_get(body, &linear_damping, NULL);
224 ephysics_body_damping_set(body, linear_damping, elm_spinner_value_get(obj));
225}
226
227static void
228_body_sleeping_threshold_linear_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
229{
230 EPhysics_Body *body = data;
231 double angular_sleeping;
232
233 ephysics_body_sleeping_threshold_get(body, NULL, &angular_sleeping);
234 ephysics_body_sleeping_threshold_set(body, elm_spinner_value_get(obj),
235 angular_sleeping);
236}
237
238static void
239_body_sleeping_threshold_angular_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
240{
241 EPhysics_Body *body = data;
242 double linear_sleeping;
243
244 ephysics_body_sleeping_threshold_get(body, &linear_sleeping, NULL);
245 ephysics_body_sleeping_threshold_set(body, linear_sleeping,
246 elm_spinner_value_get(obj));
247}
248
249static void
250_body_torque_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
251{
252 EPhysics_Body *body = data;
253
254 ephysics_body_torque_apply(body, elm_spinner_value_get(obj));
255}
256
257static void
258_body_impulse_x_x_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
259{
260 EPhysics_Body *body = data;
261 Evas_Coord rel_x, rel_y;
262 double y;
263
264 y = elm_spinner_value_get(evas_object_data_get(obj, "y"));
265 rel_x = elm_spinner_value_get(evas_object_data_get(obj, "relx"));
266 rel_y = elm_spinner_value_get(evas_object_data_get(obj, "rely"));
267
268 ephysics_body_impulse_apply(body, elm_spinner_value_get(obj), y, rel_x,
269 rel_y);
270}
271
272static void
273_body_impulse_x_rel_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
274{
275 EPhysics_Body *body = data;
276 Evas_Object *aux;
277 Evas_Coord rel_y;
278 double x, y;
279
280 aux = evas_object_data_get(obj, "x");
281
282 x = elm_spinner_value_get(aux);
283 y = elm_spinner_value_get(evas_object_data_get(aux, "y"));
284 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely"));
285
286 ephysics_body_impulse_apply(body, x, y, elm_spinner_value_get(obj), rel_y);
287}
288
289static void
290_body_impulse_y_y_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
291{
292 EPhysics_Body *body = data;
293 Evas_Object *aux;
294 Evas_Coord rel_x, rel_y;
295 double x;
296
297 aux = evas_object_data_get(obj, "x");
298
299 x = elm_spinner_value_get(aux);
300 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx"));
301 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely"));
302
303 ephysics_body_impulse_apply(body, x, elm_spinner_value_get(obj), rel_x,
304 rel_y);
305}
306
307static void
308_body_impulse_y_rel_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
309{
310 EPhysics_Body *body = data;
311 Evas_Object *aux;
312 Evas_Coord rel_x;
313 double x, y;
314
315 aux = evas_object_data_get(obj, "x");
316
317 x = elm_spinner_value_get(aux);
318 y = elm_spinner_value_get(evas_object_data_get(aux, "y"));
319 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx"));
320
321 ephysics_body_impulse_apply(body, x, y, rel_x, elm_spinner_value_get(obj));
322}
323
324static void
325_body_force_x_x_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
326{
327 EPhysics_Body *body = data;
328 Evas_Coord rel_x, rel_y;
329 double y;
330
331 y = elm_spinner_value_get(evas_object_data_get(obj, "y"));
332 rel_x = elm_spinner_value_get(evas_object_data_get(obj, "relx"));
333 rel_y = elm_spinner_value_get(evas_object_data_get(obj, "rely"));
334
335 ephysics_body_force_apply(body, elm_spinner_value_get(obj), y, rel_x, rel_y);
336}
337
338static void
339_body_force_x_rel_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
340{
341 EPhysics_Body *body = data;
342 Evas_Object *aux;
343 Evas_Coord rel_y;
344 double x, y;
345
346 aux = evas_object_data_get(obj, "x");
347
348 x = elm_spinner_value_get(aux);
349 y = elm_spinner_value_get(evas_object_data_get(aux, "y"));
350 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely"));
351
352 ephysics_body_force_apply(body, x, y, elm_spinner_value_get(obj), rel_y);
353}
354
355static void
356_body_force_y_y_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
357{
358 EPhysics_Body *body = data;
359 Evas_Object *aux;
360 Evas_Coord rel_x, rel_y;
361 double x;
362
363 aux = evas_object_data_get(obj, "x");
364
365 x = elm_spinner_value_get(aux);
366 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx"));
367 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely"));
368
369 ephysics_body_force_apply(body, x, elm_spinner_value_get(obj), rel_x, rel_y);
370}
371
372static void
373_body_force_y_rel_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
374{
375 EPhysics_Body *body = data;
376 Evas_Object *aux;
377 Evas_Coord rel_x;
378 double x, y;
379
380 aux = evas_object_data_get(obj, "x");
381
382 x = elm_spinner_value_get(aux);
383 y = elm_spinner_value_get(evas_object_data_get(aux, "y"));
384 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx"));
385
386 ephysics_body_force_apply(body, x, y, rel_x, elm_spinner_value_get(obj));
387}
388
389static void
390_body_linear_velocity_x_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
391{
392 EPhysics_Body *body = data;
393 double ylinear;
394
395 ylinear = elm_spinner_value_get(evas_object_data_get(obj, "y"));
396 ephysics_body_linear_velocity_set(body, elm_spinner_value_get(obj), ylinear);
397}
398
399static void
400_body_linear_velocity_y_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
401{
402 EPhysics_Body *body = data;
403 double xlinear;
404
405 xlinear = elm_spinner_value_get(evas_object_data_get(obj, "x"));
406 ephysics_body_linear_velocity_set(body, xlinear, elm_spinner_value_get(obj));
407}
408
409static void
410_body_angular_velocity_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
411{
412 EPhysics_Body *body = data;
413
414 ephysics_body_angular_velocity_set(body, elm_spinner_value_get(obj));
415}
416/*
417static void
418_body_hardness_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
419{
420 EPhysics_Body *body = data;
421
422 ephysics_body_soft_body_hardness_set(body, elm_spinner_value_get(obj));
423}
424*/
425static void
426_sandie_label_add(Evas_Object *win, Evas_Object *bxparent,
427 const char *subcategory)
428{
429 Evas_Object *label;
430
431 label = elm_label_add(win);
432 elm_object_text_set(label, subcategory);
433 elm_box_pack_end(bxparent, label);
434 evas_object_show(label);
435}
436
437static Evas_Object *
438_sandie_enum_add(Evas_Object *win, Evas_Object *bxparent,
439 const char *subcategory)
440{
441 Evas_Object *sp;
442
443 _sandie_label_add(win, bxparent, subcategory);
444
445 sp = elm_spinner_add(win);
446 elm_spinner_wrap_set(sp, EINA_TRUE);
447 elm_spinner_min_max_set(sp, 0, 6);
448 elm_spinner_value_set(sp, 0);
449 elm_spinner_step_set(sp, 1);
450 elm_spinner_label_format_set(sp, "%.0f");
451 elm_spinner_editable_set(sp, EINA_FALSE);
452
453 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_CUSTOM, "Custom");
454 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_CONCRETE, "Concrete");
455 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_IRON, "Iron");
456 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_PLASTIC, "Plastic");
457 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_POLYSTYRENE, "Polystyrene");
458 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_RUBBER, "Rubber");
459 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_WOOD, "Wood");
460
461 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
462 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
463 elm_box_pack_end(bxparent, sp);
464 evas_object_show(sp);
465
466 evas_object_data_set(sp, "win", win);
467
468 return sp;
469}
470
471static Evas_Object *
472_sandie_toggle_add(Evas_Object *win, Evas_Object *bxparent,
473 const char *subcategory, const char *labeloff,
474 const char *labelon)
475{
476 Evas_Object *tg;
477
478 _sandie_label_add(win, bxparent, subcategory);
479
480 tg = elm_check_add(win);
481 elm_object_style_set(tg, "toggle");
482 elm_object_part_text_set(tg, "off", labeloff);
483 elm_object_part_text_set(tg, "on", labelon);
484 evas_object_size_hint_align_set(tg, 0.5, 0.5);
485 evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
486 elm_box_pack_end(bxparent, tg);
487 evas_object_show(tg);
488
489 return tg;
490}
491
492static Evas_Object *
493_sandie_spinner_add(Evas_Object *win, Evas_Object *bxparent,
494 const char *subcategory, const char *itemlb, float min,
495 float max, float initial, float step)
496{
497 Evas_Object *sp;
498
499 _sandie_label_add(win, bxparent, subcategory);
500
501 sp = elm_spinner_add(win);
502 elm_spinner_label_format_set(sp, itemlb);
503 elm_spinner_step_set(sp, step);
504 elm_spinner_wrap_set(sp, ELM_WRAP_CHAR);
505 elm_spinner_value_set(sp, initial);
506 elm_spinner_min_max_set(sp, min, max);
507 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
508 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
509 elm_box_pack_end(bxparent, sp);
510 evas_object_show(sp);
511
512 return sp;
513}
514
515static Evas_Object *
516_sandie_double_spinner_box_add(Evas_Object *win, Evas_Object *bxparent,
517 const char *subcategory)
518{
519 Evas_Object *dbx;
520
521 _sandie_label_add(win, bxparent, subcategory);
522
523 dbx = elm_box_add(win);
524 elm_box_horizontal_set(dbx, EINA_TRUE);
525 evas_object_size_hint_weight_set(dbx, EVAS_HINT_EXPAND, 0.0);
526 evas_object_size_hint_align_set(dbx, EVAS_HINT_FILL, 0.0);
527 elm_box_align_set(dbx, 0.0, 0.5);
528 elm_box_pack_end(bxparent, dbx);
529 evas_object_show(dbx);
530
531 return dbx;
532}
533
534static Evas_Object *
535_category_add(Evas_Object *win, Evas_Object *bxparent, const char *label)
536{
537 Evas_Object *cfr, *cbx;
538
539 cfr = elm_frame_add(win);
540 elm_frame_autocollapse_set(cfr, EINA_TRUE);
541 elm_object_text_set(cfr, label);
542 evas_object_size_hint_weight_set(cfr, EVAS_HINT_EXPAND, 0.0);
543 evas_object_size_hint_fill_set(cfr, EVAS_HINT_FILL, 0.0);
544 elm_box_pack_end(bxparent, cfr);
545 evas_object_show(cfr);
546
547 cbx = elm_box_add(win);
548 elm_box_horizontal_set(cbx, EINA_FALSE);
549 evas_object_size_hint_weight_set(cbx, EVAS_HINT_EXPAND, 0.0);
550 evas_object_size_hint_align_set(cbx, EVAS_HINT_FILL, 0.0);
551 elm_box_align_set(cbx, 0.0, 0.5);
552 elm_object_content_set(cfr, cbx);
553 evas_object_show(cbx);
554
555 return cbx;
556}
557
558static void
559_menu_body_items_create(Evas_Object *win, Evas_Object *bxparent,
560 const char *category, EPhysics_Body *body)
561{
562 Evas_Object *bx, *dbx, *widget, *aux_widget, *material_widget, *type_widget;
563
564 bx = _category_add(win, bxparent, category);
565 type_widget = _sandie_toggle_add(win, bx, "Body Type", "Solid", "Soft");
566 material_widget = _sandie_enum_add(win, bx, "Body Material");
567 aux_widget = _sandie_spinner_add(win, bx, "Mass", "%1.3f kg",
568 0, 100, 15, 2);
569 widget = _sandie_spinner_add(win, bx, "Density", "%1.3f kg/m³",
570 0, 9999, 0, 2);
571 evas_object_data_set(aux_widget, "density", widget);
572 evas_object_data_set(material_widget, "density", widget);
573 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_mass_cb, body);
574 evas_object_data_set(widget, "mass", aux_widget);
575 evas_object_smart_callback_add(widget, "delay,changed", _body_density_cb, body);
576 widget = _sandie_spinner_add(win, bx, "Rotation", "%1.0fº",
577 -360, 360, 0, 2);
578 evas_object_smart_callback_add(widget, "delay,changed", _body_rotation_cb, body);
579 widget = _sandie_spinner_add(win, bx, "Friction", "%1.3f",
580 0, 1, 0.5, 0.05);
581 evas_object_data_set(material_widget, "friction", widget);
582 evas_object_smart_callback_add(widget, "delay,changed", _body_friction_cb, body);
583 widget = _sandie_spinner_add(win, bx, "Restitution", "%1.3f",
584 0, 1, 0, 0.05);
585 evas_object_data_set(material_widget, "restitution", widget);
586 evas_object_smart_callback_add(material_widget, "delay,changed", _body_material_cb, body);
587 evas_object_smart_callback_add(widget, "delay,changed", _body_restitution_cb, body);
588 dbx = _sandie_double_spinner_box_add(win, bx, "Damping");
589 widget = _sandie_spinner_add(win, dbx, "Linear:", "%1.3f",
590 0, 1, 0, 0.05);
591 evas_object_smart_callback_add(widget, "delay,changed", _body_damping_linear_cb, body);
592 widget = _sandie_spinner_add(win, dbx, "Angular:", "%1.3f",
593 0, 1, 0, 0.05);
594 evas_object_smart_callback_add(widget, "delay,changed", _body_damping_angular_cb, body);
595 dbx = _sandie_double_spinner_box_add(win, bx, "Sleeping Threshold");
596 widget = _sandie_spinner_add(win, dbx, "Linear:", "%1.2f p/s",
597 0, 100, 0, 2);
598 evas_object_smart_callback_add(widget, "delay,changed", _body_sleeping_threshold_linear_cb, body);
599 widget = _sandie_spinner_add(win, dbx, "Angular:", "%1.2f º/s",
600 0, 360, 0, 2);
601 evas_object_smart_callback_add(widget, "delay,changed", _body_sleeping_threshold_angular_cb, body);
602 widget = _sandie_spinner_add(win, bx, "Torque", "%1.3f",
603 0, 1, 0.5, 0.05);
604 evas_object_smart_callback_add(widget, "delay,changed", _body_torque_cb, body);
605
606 //Impulse needs four values
607 dbx = _sandie_double_spinner_box_add(win, bx, "Impulse X");
608 aux_widget = _sandie_spinner_add(win, dbx, "X:", "%1.3f kg * p/s",
609 -360, 360, 0, 2);
610 widget = _sandie_spinner_add(win, dbx, "Rel Position X:", "%1.2f",
611 0, 360, 0, 2);
612 evas_object_data_set(aux_widget, "relx", widget);
613 dbx = _sandie_double_spinner_box_add(win, bx, "Impulse Y");
614 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.3f kg * p/s",
615 -360, 360, 0, 2);
616 evas_object_data_set(aux_widget, "y", widget);
617 widget = _sandie_spinner_add(win, dbx, "Rel Position Y:", "%1.2f",
618 0, 360, 0, 2);
619 evas_object_data_set(aux_widget, "rely", widget);
620 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_impulse_x_x_cb, body);
621 evas_object_data_set(widget, "x", aux_widget);
622 evas_object_smart_callback_add(widget, "delay,changed", _body_impulse_x_rel_cb, body);
623 widget = evas_object_data_get(aux_widget, "y");
624 evas_object_data_set(widget, "x", aux_widget);
625 evas_object_smart_callback_add(widget, "delay,changed", _body_impulse_y_y_cb, body);
626 widget = evas_object_data_get(aux_widget, "relx");
627 evas_object_data_set(widget, "x", aux_widget);
628 evas_object_smart_callback_add(widget, "delay,changed", _body_impulse_y_rel_cb, body);
629
630 //Force needs four values
631 dbx = _sandie_double_spinner_box_add(win, bx, "Force X");
632 aux_widget = _sandie_spinner_add(win, dbx, "X:", "%1.3f kg * p/s/s",
633 -360, 360, 0, 2);
634 widget = _sandie_spinner_add(win, dbx, "Rel Position X:", "%1.2f",
635 0, 360, 0, 2);
636 evas_object_data_set(aux_widget, "relx", widget);
637 dbx = _sandie_double_spinner_box_add(win, bx, "Force Y");
638 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.3f kg * p/s/s",
639 -360, 360, 0, 2);
640 evas_object_data_set(aux_widget, "y", widget);
641 widget = _sandie_spinner_add(win, dbx, "Rel Position Y:", "%1.2f",
642 0, 360, 0, 2);
643 evas_object_data_set(aux_widget, "rely", widget);
644 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_force_x_x_cb, body);
645 evas_object_data_set(widget, "x", aux_widget);
646 evas_object_smart_callback_add(widget, "delay,changed", _body_force_x_rel_cb, body);
647 widget = evas_object_data_get(aux_widget, "y");
648 evas_object_data_set(widget, "x", aux_widget);
649 evas_object_smart_callback_add(widget, "delay,changed", _body_force_y_y_cb, body);
650 widget = evas_object_data_get(aux_widget, "relx");
651 evas_object_data_set(widget, "x", aux_widget);
652 evas_object_smart_callback_add(widget, "delay,changed", _body_force_y_rel_cb, body);
653
654 dbx = _sandie_double_spinner_box_add(win, bx, "Linear Velocity");
655 aux_widget = _sandie_spinner_add(win, dbx, "X:", "%1.2f p/s",
656 -800, 800, 0, 2);
657 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.2f p/s",
658 -800, 800, 0, 2);
659 evas_object_data_set(aux_widget, "y", widget);
660 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_linear_velocity_x_cb, body);
661 evas_object_data_set(widget, "x", aux_widget);
662 evas_object_smart_callback_add(widget, "delay,changed", _body_linear_velocity_y_cb, body);
663
664 widget = _sandie_spinner_add(win, bx, "Angular Velocity", "%1.2f º/s",
665 0, 360, 0, 2);
666 evas_object_smart_callback_add(widget, "delay,changed", _body_angular_velocity_cb, body);
667/* widget = _sandie_spinner_add(win, bx, "Soft Body Hardness", "%1.2f%%",
668 0, 100, 100, 2);
669 elm_object_disabled_set(widget, EINA_TRUE);
670 evas_object_smart_callback_add(widget, "delay,changed", _body_hardness_cb, body);
671 evas_object_data_set(type_widget, "hardness", widget);
672 evas_object_smart_callback_add(type_widget, "changed", _body_type_cb, body);//FIX CB
673*/
674}
675
676static EPhysics_Body *
677_sandie_body_add(Evas_Object *win, EPhysics_World *world, int x, int y)
678{
679 Evas_Object *body_image;
680 EPhysics_Body *body;
681
682 body_image = elm_image_add(win);
683 elm_image_file_set(
684 body_image, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", "big-blue-ball");
685 evas_object_resize(body_image, 70, 70);
686 evas_object_move(body_image, x, y);
687 evas_object_show(body_image);
688
689 body = ephysics_body_circle_add(world);
690 ephysics_body_evas_object_set(body, body_image, EINA_TRUE);
691 ephysics_body_mass_set(body, 20);
692 ephysics_body_central_impulse_apply(body, 8201, 2110);
693 ephysics_body_event_callback_add(body, EPHYSICS_CALLBACK_BODY_DEL,
694 _body_del, NULL);
695
696 return body;
697}
698static void
699_menu_items_create(Evas_Object *win, Evas_Object *bxparent,
700 EPhysics_World *world)
701{
702 Evas_Object *bx, *dbx, *widget;
703
704 bx = _category_add(win, bxparent, "EPhysics World");
705 dbx = _sandie_double_spinner_box_add(win, bx, "Gravity");
706 widget = _sandie_spinner_add(win, dbx, "X:", "%1.2f m/s²",
707 0, 100, 0, 2);
708 evas_object_smart_callback_add(widget, "delay,changed", _world_gravity_x_cb, world);
709 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.2f m/s²",
710 0, 100, 9.81, 2);
711 evas_object_smart_callback_add(widget, "delay,changed", _world_gravity_y_cb, world);
712 widget = _sandie_spinner_add(win, bx, "Rate", "%1.0f pixel/meter",
713 0, 100, 20, 2);
714 evas_object_smart_callback_add(widget, "delay,changed", _world_rate_cb, world);
715 widget = _sandie_spinner_add(win, bx, "Max Sleeping Time", "%1.0f s",
716 0, 100, 2, 2);
717 evas_object_smart_callback_add(widget, "delay,changed", _world_max_sleeping_time_cb, world);
718
719 bx = _category_add(win, bxparent, "EPhysics Boundaries");
720 widget = _sandie_spinner_add(win, bx, "Friction", "%1.3f",
721 0, 1, 0.5, 0.05);
722 evas_object_data_set(widget, "win", win);
723 evas_object_smart_callback_add(widget, "delay,changed", _world_friction_cb, win);
724 widget = _sandie_spinner_add(win, bx, "Restitution", "%1.3f",
725 0, 1, 0, 0.05);
726 evas_object_smart_callback_add(widget, "delay,changed", _world_restitution_cb, win);
727}
728
729static void
730_world_populate(Sandie_Data *sandie, Evas_Object *bxparent)
731{
732 sandie->body1 = _sandie_body_add(sandie->win, sandie->world, (int) WIDTH / 4,
733 (int) HEIGHT / 5);
734 sandie->body2 = _sandie_body_add(sandie->win, sandie->world, (int) WIDTH / 4,
735 (int) HEIGHT / 2);
736
737 _menu_body_items_create(sandie->win, bxparent, "EPhysics Body 1",
738 sandie->body1);
739 _menu_body_items_create(sandie->win, bxparent, "EPhysics Body 2",
740 sandie->body2);
741
742}
743
744static void
745_restart(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
746{
747 Sandie_Data *sandie = data;
748
749 ephysics_body_del(sandie->body1);
750 ephysics_body_del(sandie->body2);
751}
752
753static Evas_Object *
754_menu_create(Sandie_Data *sandie)
755{
756 Evas_Object *bx0, *fr, *lb, *bt, *sc, *bxparent, *layout;
757
758 layout = evas_object_data_get(sandie->win, "layout");
759
760 bx0 = elm_box_add(sandie->win);
761 evas_object_size_hint_weight_set(bx0, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
762 elm_object_part_content_set(layout, "swallow", bx0);
763 evas_object_show(bx0);
764
765 fr = elm_frame_add(sandie->win);
766 elm_frame_autocollapse_set(fr, EINA_TRUE);
767 elm_object_text_set(fr, "Information");
768 elm_box_pack_end(bx0, fr);
769 evas_object_show(fr);
770
771 lb = elm_label_add(sandie->win);
772 elm_object_text_set(lb,
773 "Please modify physical parameters below<br/>"
774 "the test button to show the test window.");
775 elm_object_content_set(fr, lb);
776 evas_object_show(lb);
777
778 bt = elm_button_add(sandie->win);
779 elm_object_text_set(bt, " Try ");
780 elm_box_pack_end(bx0, bt);
781 evas_object_show(bt);
782 evas_object_smart_callback_add(bt, "clicked", _restart, sandie);
783
784 sc = elm_scroller_add(sandie->win);
785 elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
786 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON);
787 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
788 evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
789 elm_box_pack_end(bx0, sc);
790 evas_object_show(sc);
791
792 bxparent = elm_box_add(sandie->win);
793 evas_object_size_hint_weight_set(bxparent, EVAS_HINT_EXPAND, 0.0);
794 evas_object_size_hint_align_set(bxparent, EVAS_HINT_FILL, 0.0);
795 elm_object_content_set(sc, bxparent);
796 evas_object_show(bxparent);
797
798 _menu_items_create(sandie->win, bxparent, sandie->world);
799
800 return bxparent;
801}
802
803static EPhysics_World *
804_sandie_world_add(Evas_Object *win)
805{
806 EPhysics_World *world;
807
808 world = ephysics_world_new();
809 ephysics_world_render_geometry_set(world, 80, 80, (int) WIDTH * 0.7 - 160,
810 HEIGHT - 160);
811 evas_object_data_set(win, "top", ephysics_body_top_boundary_add(world));
812 evas_object_data_set(win, "bottom", ephysics_body_bottom_boundary_add(world));
813 evas_object_data_set(win, "left", ephysics_body_left_boundary_add(world));
814 evas_object_data_set(win, "right", ephysics_body_right_boundary_add(world));
815
816 return world;
817}
818
819EAPI int
820elm_main()
821{
822 Sandie_Data *sandie;
823 Evas_Object *layout, *bxparent;
824 short int r = 0;
825
826 if (!ephysics_init())
827 {
828 printf("\nFailed to init ephysics");//ERR
829 r = -1;
830 goto shutdown;
831 }
832
833 sandie = calloc(1, sizeof(Sandie_Data));
834 if (!sandie)
835 {
836 printf("Failed to alloc sandie data");//ERR
837 r = -1;
838 return r;
839 }
840
841 elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj");
842
843 sandie->win = elm_win_add(NULL, "Sandbox", ELM_WIN_BASIC);
844
845 elm_win_title_set(sandie->win, "EPhysics Sandbox");
846 evas_object_resize(sandie->win, WIDTH, HEIGHT);
847 elm_win_screen_constrain_set(sandie->win, EINA_TRUE);
848 elm_win_autodel_set(sandie->win, EINA_TRUE);
849 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
850
851 layout = elm_layout_add(sandie->win);
852 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
853 elm_win_resize_object_add(sandie->win, layout);
854 elm_layout_file_set(layout, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj",
855 "sandbox");
856 evas_object_show(layout);
857 evas_object_data_set(sandie->win, "layout", layout);
858
859 evas_object_show(sandie->win);
860
861 sandie->world = _sandie_world_add(sandie->win);
862
863 bxparent = _menu_create(sandie);
864
865 _world_populate(sandie, bxparent);
866
867 elm_run();
868
869shutdown:
870 ephysics_shutdown();
871
872 elm_shutdown();
873
874 return r;
875}
876ELM_MAIN()