summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src/bin/ephysics_sandbox.c
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-08 22:46:58 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-08 22:46:58 +0000
commit0955e6258c8bdceb89730fc3bd28058b386b06ff (patch)
tree6031786e12b35eda742bad9ddc096645c72371d8 /legacy/ephysics/src/bin/ephysics_sandbox.c
parentf5f0427c9bb2b0283e79c653c4662548ff3f9ed1 (diff)
ephysics: cosmetic clean up on sandbox code
Respect 80 cols, remove extra blank lines and blank spaces. SVN revision: 77595
Diffstat (limited to '')
-rw-r--r--legacy/ephysics/src/bin/ephysics_sandbox.c171
1 files changed, 99 insertions, 72 deletions
diff --git a/legacy/ephysics/src/bin/ephysics_sandbox.c b/legacy/ephysics/src/bin/ephysics_sandbox.c
index 78a91dab7a..e9d4d61923 100644
--- a/legacy/ephysics/src/bin/ephysics_sandbox.c
+++ b/legacy/ephysics/src/bin/ephysics_sandbox.c
@@ -49,7 +49,6 @@ static void
49_world_rate_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 49_world_rate_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
50{ 50{
51 EPhysics_World *world = data; 51 EPhysics_World *world = data;
52
53 ephysics_world_rate_set(world, elm_spinner_value_get(obj)); 52 ephysics_world_rate_set(world, elm_spinner_value_get(obj));
54} 53}
55 54
@@ -58,8 +57,7 @@ _world_max_sleeping_time_cb(void *data, Evas_Object *obj,
58 void *event_info __UNUSED__) 57 void *event_info __UNUSED__)
59{ 58{
60 EPhysics_World *world = data; 59 EPhysics_World *world = data;
61 60 ephysics_world_max_sleeping_time_set(world, elm_spinner_value_get(obj));
62 ephysics_world_max_sleeping_time_set(world, elm_spinner_value_get(obj));
63} 61}
64 62
65static void 63static void
@@ -68,13 +66,13 @@ _world_friction_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
68 Evas_Object *win = data; 66 Evas_Object *win = data;
69 67
70 ephysics_body_friction_set(evas_object_data_get(win, "top"), 68 ephysics_body_friction_set(evas_object_data_get(win, "top"),
71 elm_spinner_value_get(obj)); 69 elm_spinner_value_get(obj));
72 ephysics_body_friction_set(evas_object_data_get(win, "bottom"), 70 ephysics_body_friction_set(evas_object_data_get(win, "bottom"),
73 elm_spinner_value_get(obj)); 71 elm_spinner_value_get(obj));
74 ephysics_body_friction_set(evas_object_data_get(win, "left"), 72 ephysics_body_friction_set(evas_object_data_get(win, "left"),
75 elm_spinner_value_get(obj)); 73 elm_spinner_value_get(obj));
76 ephysics_body_friction_set(evas_object_data_get(win, "right"), 74 ephysics_body_friction_set(evas_object_data_get(win, "right"),
77 elm_spinner_value_get(obj)); 75 elm_spinner_value_get(obj));
78} 76}
79 77
80static void 78static void
@@ -83,13 +81,13 @@ _world_restitution_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
83 Evas_Object *win = data; 81 Evas_Object *win = data;
84 82
85 ephysics_body_restitution_set(evas_object_data_get(win, "top"), 83 ephysics_body_restitution_set(evas_object_data_get(win, "top"),
86 elm_spinner_value_get(obj)); 84 elm_spinner_value_get(obj));
87 ephysics_body_restitution_set(evas_object_data_get(win, "bottom"), 85 ephysics_body_restitution_set(evas_object_data_get(win, "bottom"),
88 elm_spinner_value_get(obj)); 86 elm_spinner_value_get(obj));
89 ephysics_body_restitution_set(evas_object_data_get(win, "left"), 87 ephysics_body_restitution_set(evas_object_data_get(win, "left"),
90 elm_spinner_value_get(obj)); 88 elm_spinner_value_get(obj));
91 ephysics_body_restitution_set(evas_object_data_get(win, "right"), 89 ephysics_body_restitution_set(evas_object_data_get(win, "right"),
92 elm_spinner_value_get(obj)); 90 elm_spinner_value_get(obj));
93} 91}
94/* 92/*
95static void 93static void
@@ -163,9 +161,7 @@ static void
163_body_mass_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 161_body_mass_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
164{ 162{
165 EPhysics_Body *body = data; 163 EPhysics_Body *body = data;
166
167 ephysics_body_mass_set(body, elm_spinner_value_get(obj)); 164 ephysics_body_mass_set(body, elm_spinner_value_get(obj));
168
169 elm_spinner_value_set(evas_object_data_get(obj, "density"), 0); 165 elm_spinner_value_set(evas_object_data_get(obj, "density"), 0);
170} 166}
171 167
@@ -173,9 +169,7 @@ static void
173_body_density_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 169_body_density_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
174{ 170{
175 EPhysics_Body *body = data; 171 EPhysics_Body *body = data;
176
177 ephysics_body_density_set(body, elm_spinner_value_get(obj)); 172 ephysics_body_density_set(body, elm_spinner_value_get(obj));
178
179 elm_spinner_value_set(evas_object_data_get(obj, "mass"), 173 elm_spinner_value_set(evas_object_data_get(obj, "mass"),
180 ephysics_body_mass_get(body)); 174 ephysics_body_mass_get(body));
181} 175}
@@ -184,73 +178,73 @@ static void
184_body_rotation_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 178_body_rotation_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
185{ 179{
186 EPhysics_Body *body = data; 180 EPhysics_Body *body = data;
187 181 ephysics_body_rotation_set(body, elm_spinner_value_get(obj));
188 ephysics_body_rotation_set(body, elm_spinner_value_get(obj));
189} 182}
190 183
191static void 184static void
192_body_friction_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 185_body_friction_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
193{ 186{
194 EPhysics_Body *body = data; 187 EPhysics_Body *body = data;
195 188 ephysics_body_friction_set(body, elm_spinner_value_get(obj));
196 ephysics_body_friction_set(body, elm_spinner_value_get(obj));
197} 189}
198 190
199static void 191static void
200_body_restitution_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 192_body_restitution_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
201{ 193{
202 EPhysics_Body *body = data; 194 EPhysics_Body *body = data;
203 195 ephysics_body_restitution_set(body, elm_spinner_value_get(obj));
204 ephysics_body_restitution_set(body, elm_spinner_value_get(obj));
205} 196}
206 197
207static void 198static void
208_body_damping_linear_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 199_body_damping_linear_cb(void *data, Evas_Object *obj,
200 void *event_info __UNUSED__)
209{ 201{
210 EPhysics_Body *body = data; 202 EPhysics_Body *body = data;
211 double angular_damping; 203 double angular_damping;
212 204
213 ephysics_body_damping_get(body, NULL, &angular_damping); 205 ephysics_body_damping_get(body, NULL, &angular_damping);
214 ephysics_body_damping_set(body, elm_spinner_value_get(obj), angular_damping); 206 ephysics_body_damping_set(body, elm_spinner_value_get(obj), angular_damping);
215} 207}
216 208
217static void 209static void
218_body_damping_angular_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 210_body_damping_angular_cb(void *data, Evas_Object *obj,
211 void *event_info __UNUSED__)
219{ 212{
220 EPhysics_Body *body = data; 213 EPhysics_Body *body = data;
221 double linear_damping; 214 double linear_damping;
222 215
223 ephysics_body_damping_get(body, &linear_damping, NULL); 216 ephysics_body_damping_get(body, &linear_damping, NULL);
224 ephysics_body_damping_set(body, linear_damping, elm_spinner_value_get(obj)); 217 ephysics_body_damping_set(body, linear_damping, elm_spinner_value_get(obj));
225} 218}
226 219
227static void 220static void
228_body_sleeping_threshold_linear_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 221_body_sleeping_threshold_linear_cb(void *data, Evas_Object *obj,
222 void *event_info __UNUSED__)
229{ 223{
230 EPhysics_Body *body = data; 224 EPhysics_Body *body = data;
231 double angular_sleeping; 225 double angular_sleeping;
232 226
233 ephysics_body_sleeping_threshold_get(body, NULL, &angular_sleeping); 227 ephysics_body_sleeping_threshold_get(body, NULL, &angular_sleeping);
234 ephysics_body_sleeping_threshold_set(body, elm_spinner_value_get(obj), 228 ephysics_body_sleeping_threshold_set(body, elm_spinner_value_get(obj),
235 angular_sleeping); 229 angular_sleeping);
236} 230}
237 231
238static void 232static void
239_body_sleeping_threshold_angular_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 233_body_sleeping_threshold_angular_cb(void *data, Evas_Object *obj,
234 void *event_info __UNUSED__)
240{ 235{
241 EPhysics_Body *body = data; 236 EPhysics_Body *body = data;
242 double linear_sleeping; 237 double linear_sleeping;
243 238
244 ephysics_body_sleeping_threshold_get(body, &linear_sleeping, NULL); 239 ephysics_body_sleeping_threshold_get(body, &linear_sleeping, NULL);
245 ephysics_body_sleeping_threshold_set(body, linear_sleeping, 240 ephysics_body_sleeping_threshold_set(body, linear_sleeping,
246 elm_spinner_value_get(obj)); 241 elm_spinner_value_get(obj));
247} 242}
248 243
249static void 244static void
250_body_torque_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 245_body_torque_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
251{ 246{
252 EPhysics_Body *body = data; 247 EPhysics_Body *body = data;
253
254 ephysics_body_torque_apply(body, elm_spinner_value_get(obj)); 248 ephysics_body_torque_apply(body, elm_spinner_value_get(obj));
255} 249}
256 250
@@ -270,7 +264,8 @@ _body_impulse_x_x_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
270} 264}
271 265
272static void 266static void
273_body_impulse_x_rel_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 267_body_impulse_x_rel_cb(void *data, Evas_Object *obj,
268 void *event_info __UNUSED__)
274{ 269{
275 EPhysics_Body *body = data; 270 EPhysics_Body *body = data;
276 Evas_Object *aux; 271 Evas_Object *aux;
@@ -305,7 +300,8 @@ _body_impulse_y_y_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
305} 300}
306 301
307static void 302static void
308_body_impulse_y_rel_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 303_body_impulse_y_rel_cb(void *data, Evas_Object *obj,
304 void *event_info __UNUSED__)
309{ 305{
310 EPhysics_Body *body = data; 306 EPhysics_Body *body = data;
311 Evas_Object *aux; 307 Evas_Object *aux;
@@ -387,30 +383,32 @@ _body_force_y_rel_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
387} 383}
388 384
389static void 385static void
390_body_linear_velocity_x_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 386_body_linear_velocity_x_cb(void *data, Evas_Object *obj,
387 void *event_info __UNUSED__)
391{ 388{
392 EPhysics_Body *body = data; 389 EPhysics_Body *body = data;
393 double ylinear; 390 double ylinear;
394 391
395 ylinear = elm_spinner_value_get(evas_object_data_get(obj, "y")); 392 ylinear = elm_spinner_value_get(evas_object_data_get(obj, "y"));
396 ephysics_body_linear_velocity_set(body, elm_spinner_value_get(obj), ylinear); 393 ephysics_body_linear_velocity_set(body, elm_spinner_value_get(obj), ylinear);
397} 394}
398 395
399static void 396static void
400_body_linear_velocity_y_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 397_body_linear_velocity_y_cb(void *data, Evas_Object *obj,
398 void *event_info __UNUSED__)
401{ 399{
402 EPhysics_Body *body = data; 400 EPhysics_Body *body = data;
403 double xlinear; 401 double xlinear;
404 402
405 xlinear = elm_spinner_value_get(evas_object_data_get(obj, "x")); 403 xlinear = elm_spinner_value_get(evas_object_data_get(obj, "x"));
406 ephysics_body_linear_velocity_set(body, xlinear, elm_spinner_value_get(obj)); 404 ephysics_body_linear_velocity_set(body, xlinear, elm_spinner_value_get(obj));
407} 405}
408 406
409static void 407static void
410_body_angular_velocity_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 408_body_angular_velocity_cb(void *data, Evas_Object *obj,
409 void *event_info __UNUSED__)
411{ 410{
412 EPhysics_Body *body = data; 411 EPhysics_Body *body = data;
413
414 ephysics_body_angular_velocity_set(body, elm_spinner_value_get(obj)); 412 ephysics_body_angular_velocity_set(body, elm_spinner_value_get(obj));
415} 413}
416/* 414/*
@@ -451,10 +449,12 @@ _sandie_enum_add(Evas_Object *win, Evas_Object *bxparent,
451 elm_spinner_editable_set(sp, EINA_FALSE); 449 elm_spinner_editable_set(sp, EINA_FALSE);
452 450
453 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_CUSTOM, "Custom"); 451 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_CUSTOM, "Custom");
454 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_CONCRETE, "Concrete"); 452 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_CONCRETE,
453 "Concrete");
455 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_IRON, "Iron"); 454 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_IRON, "Iron");
456 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_PLASTIC, "Plastic"); 455 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_PLASTIC, "Plastic");
457 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_POLYSTYRENE, "Polystyrene"); 456 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_POLYSTYRENE,
457 "Polystyrene");
458 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_RUBBER, "Rubber"); 458 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_RUBBER, "Rubber");
459 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_WOOD, "Wood"); 459 elm_spinner_special_value_add(sp, EPHYSICS_BODY_MATERIAL_WOOD, "Wood");
460 460
@@ -570,38 +570,49 @@ _menu_body_items_create(Evas_Object *win, Evas_Object *bxparent,
570 0, 9999, 0, 2); 570 0, 9999, 0, 2);
571 evas_object_data_set(aux_widget, "density", widget); 571 evas_object_data_set(aux_widget, "density", widget);
572 evas_object_data_set(material_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); 573 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_mass_cb,
574 body);
574 evas_object_data_set(widget, "mass", aux_widget); 575 evas_object_data_set(widget, "mass", aux_widget);
575 evas_object_smart_callback_add(widget, "delay,changed", _body_density_cb, body); 576 evas_object_smart_callback_add(widget, "delay,changed", _body_density_cb,
577 body);
576 widget = _sandie_spinner_add(win, bx, "Rotation", "%1.0fº", 578 widget = _sandie_spinner_add(win, bx, "Rotation", "%1.0fº",
577 -360, 360, 0, 2); 579 -360, 360, 0, 2);
578 evas_object_smart_callback_add(widget, "delay,changed", _body_rotation_cb, body); 580 evas_object_smart_callback_add(widget, "delay,changed", _body_rotation_cb,
581 body);
579 widget = _sandie_spinner_add(win, bx, "Friction", "%1.3f", 582 widget = _sandie_spinner_add(win, bx, "Friction", "%1.3f",
580 0, 1, 0.5, 0.05); 583 0, 1, 0.5, 0.05);
581 evas_object_data_set(material_widget, "friction", widget); 584 evas_object_data_set(material_widget, "friction", widget);
582 evas_object_smart_callback_add(widget, "delay,changed", _body_friction_cb, body); 585 evas_object_smart_callback_add(widget, "delay,changed", _body_friction_cb,
586 body);
583 widget = _sandie_spinner_add(win, bx, "Restitution", "%1.3f", 587 widget = _sandie_spinner_add(win, bx, "Restitution", "%1.3f",
584 0, 1, 0, 0.05); 588 0, 1, 0, 0.05);
585 evas_object_data_set(material_widget, "restitution", widget); 589 evas_object_data_set(material_widget, "restitution", widget);
586 evas_object_smart_callback_add(material_widget, "delay,changed", _body_material_cb, body); 590 evas_object_smart_callback_add(material_widget, "delay,changed",
587 evas_object_smart_callback_add(widget, "delay,changed", _body_restitution_cb, body); 591 _body_material_cb, body);
592 evas_object_smart_callback_add(widget, "delay,changed",
593 _body_restitution_cb, body);
588 dbx = _sandie_double_spinner_box_add(win, bx, "Damping"); 594 dbx = _sandie_double_spinner_box_add(win, bx, "Damping");
589 widget = _sandie_spinner_add(win, dbx, "Linear:", "%1.3f", 595 widget = _sandie_spinner_add(win, dbx, "Linear:", "%1.3f",
590 0, 1, 0, 0.05); 596 0, 1, 0, 0.05);
591 evas_object_smart_callback_add(widget, "delay,changed", _body_damping_linear_cb, body); 597 evas_object_smart_callback_add(widget, "delay,changed",
598 _body_damping_linear_cb, body);
592 widget = _sandie_spinner_add(win, dbx, "Angular:", "%1.3f", 599 widget = _sandie_spinner_add(win, dbx, "Angular:", "%1.3f",
593 0, 1, 0, 0.05); 600 0, 1, 0, 0.05);
594 evas_object_smart_callback_add(widget, "delay,changed", _body_damping_angular_cb, body); 601 evas_object_smart_callback_add(widget, "delay,changed",
602 _body_damping_angular_cb, body);
595 dbx = _sandie_double_spinner_box_add(win, bx, "Sleeping Threshold"); 603 dbx = _sandie_double_spinner_box_add(win, bx, "Sleeping Threshold");
596 widget = _sandie_spinner_add(win, dbx, "Linear:", "%1.2f p/s", 604 widget = _sandie_spinner_add(win, dbx, "Linear:", "%1.2f p/s",
597 0, 100, 0, 2); 605 0, 100, 0, 2);
598 evas_object_smart_callback_add(widget, "delay,changed", _body_sleeping_threshold_linear_cb, body); 606 evas_object_smart_callback_add(widget, "delay,changed",
607 _body_sleeping_threshold_linear_cb, body);
599 widget = _sandie_spinner_add(win, dbx, "Angular:", "%1.2f º/s", 608 widget = _sandie_spinner_add(win, dbx, "Angular:", "%1.2f º/s",
600 0, 360, 0, 2); 609 0, 360, 0, 2);
601 evas_object_smart_callback_add(widget, "delay,changed", _body_sleeping_threshold_angular_cb, body); 610 evas_object_smart_callback_add(widget, "delay,changed",
611 _body_sleeping_threshold_angular_cb, body);
602 widget = _sandie_spinner_add(win, bx, "Torque", "%1.3f", 612 widget = _sandie_spinner_add(win, bx, "Torque", "%1.3f",
603 0, 1, 0.5, 0.05); 613 0, 1, 0.5, 0.05);
604 evas_object_smart_callback_add(widget, "delay,changed", _body_torque_cb, body); 614 evas_object_smart_callback_add(widget, "delay,changed", _body_torque_cb,
615 body);
605 616
606 //Impulse needs four values 617 //Impulse needs four values
607 dbx = _sandie_double_spinner_box_add(win, bx, "Impulse X"); 618 dbx = _sandie_double_spinner_box_add(win, bx, "Impulse X");
@@ -617,15 +628,19 @@ _menu_body_items_create(Evas_Object *win, Evas_Object *bxparent,
617 widget = _sandie_spinner_add(win, dbx, "Rel Position Y:", "%1.2f", 628 widget = _sandie_spinner_add(win, dbx, "Rel Position Y:", "%1.2f",
618 0, 360, 0, 2); 629 0, 360, 0, 2);
619 evas_object_data_set(aux_widget, "rely", widget); 630 evas_object_data_set(aux_widget, "rely", widget);
620 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_impulse_x_x_cb, body); 631 evas_object_smart_callback_add(aux_widget, "delay,changed",
632 _body_impulse_x_x_cb, body);
621 evas_object_data_set(widget, "x", aux_widget); 633 evas_object_data_set(widget, "x", aux_widget);
622 evas_object_smart_callback_add(widget, "delay,changed", _body_impulse_x_rel_cb, body); 634 evas_object_smart_callback_add(widget, "delay,changed",
635 _body_impulse_x_rel_cb, body);
623 widget = evas_object_data_get(aux_widget, "y"); 636 widget = evas_object_data_get(aux_widget, "y");
624 evas_object_data_set(widget, "x", aux_widget); 637 evas_object_data_set(widget, "x", aux_widget);
625 evas_object_smart_callback_add(widget, "delay,changed", _body_impulse_y_y_cb, body); 638 evas_object_smart_callback_add(widget, "delay,changed",
639 _body_impulse_y_y_cb, body);
626 widget = evas_object_data_get(aux_widget, "relx"); 640 widget = evas_object_data_get(aux_widget, "relx");
627 evas_object_data_set(widget, "x", aux_widget); 641 evas_object_data_set(widget, "x", aux_widget);
628 evas_object_smart_callback_add(widget, "delay,changed", _body_impulse_y_rel_cb, body); 642 evas_object_smart_callback_add(widget, "delay,changed",
643 _body_impulse_y_rel_cb, body);
629 644
630 //Force needs four values 645 //Force needs four values
631 dbx = _sandie_double_spinner_box_add(win, bx, "Force X"); 646 dbx = _sandie_double_spinner_box_add(win, bx, "Force X");
@@ -641,15 +656,19 @@ _menu_body_items_create(Evas_Object *win, Evas_Object *bxparent,
641 widget = _sandie_spinner_add(win, dbx, "Rel Position Y:", "%1.2f", 656 widget = _sandie_spinner_add(win, dbx, "Rel Position Y:", "%1.2f",
642 0, 360, 0, 2); 657 0, 360, 0, 2);
643 evas_object_data_set(aux_widget, "rely", widget); 658 evas_object_data_set(aux_widget, "rely", widget);
644 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_force_x_x_cb, body); 659 evas_object_smart_callback_add(aux_widget, "delay,changed",
660 _body_force_x_x_cb, body);
645 evas_object_data_set(widget, "x", aux_widget); 661 evas_object_data_set(widget, "x", aux_widget);
646 evas_object_smart_callback_add(widget, "delay,changed", _body_force_x_rel_cb, body); 662 evas_object_smart_callback_add(widget, "delay,changed",
663 _body_force_x_rel_cb, body);
647 widget = evas_object_data_get(aux_widget, "y"); 664 widget = evas_object_data_get(aux_widget, "y");
648 evas_object_data_set(widget, "x", aux_widget); 665 evas_object_data_set(widget, "x", aux_widget);
649 evas_object_smart_callback_add(widget, "delay,changed", _body_force_y_y_cb, body); 666 evas_object_smart_callback_add(widget, "delay,changed",
667 _body_force_y_y_cb, body);
650 widget = evas_object_data_get(aux_widget, "relx"); 668 widget = evas_object_data_get(aux_widget, "relx");
651 evas_object_data_set(widget, "x", aux_widget); 669 evas_object_data_set(widget, "x", aux_widget);
652 evas_object_smart_callback_add(widget, "delay,changed", _body_force_y_rel_cb, body); 670 evas_object_smart_callback_add(widget, "delay,changed",
671 _body_force_y_rel_cb, body);
653 672
654 dbx = _sandie_double_spinner_box_add(win, bx, "Linear Velocity"); 673 dbx = _sandie_double_spinner_box_add(win, bx, "Linear Velocity");
655 aux_widget = _sandie_spinner_add(win, dbx, "X:", "%1.2f p/s", 674 aux_widget = _sandie_spinner_add(win, dbx, "X:", "%1.2f p/s",
@@ -657,13 +676,16 @@ _menu_body_items_create(Evas_Object *win, Evas_Object *bxparent,
657 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.2f p/s", 676 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.2f p/s",
658 -800, 800, 0, 2); 677 -800, 800, 0, 2);
659 evas_object_data_set(aux_widget, "y", widget); 678 evas_object_data_set(aux_widget, "y", widget);
660 evas_object_smart_callback_add(aux_widget, "delay,changed", _body_linear_velocity_x_cb, body); 679 evas_object_smart_callback_add(aux_widget, "delay,changed",
680 _body_linear_velocity_x_cb, body);
661 evas_object_data_set(widget, "x", aux_widget); 681 evas_object_data_set(widget, "x", aux_widget);
662 evas_object_smart_callback_add(widget, "delay,changed", _body_linear_velocity_y_cb, body); 682 evas_object_smart_callback_add(widget, "delay,changed",
683 _body_linear_velocity_y_cb, body);
663 684
664 widget = _sandie_spinner_add(win, bx, "Angular Velocity", "%1.2f º/s", 685 widget = _sandie_spinner_add(win, bx, "Angular Velocity", "%1.2f º/s",
665 0, 360, 0, 2); 686 0, 360, 0, 2);
666 evas_object_smart_callback_add(widget, "delay,changed", _body_angular_velocity_cb, body); 687 evas_object_smart_callback_add(widget, "delay,changed",
688 _body_angular_velocity_cb, body);
667/* widget = _sandie_spinner_add(win, bx, "Soft Body Hardness", "%1.2f%%", 689/* widget = _sandie_spinner_add(win, bx, "Soft Body Hardness", "%1.2f%%",
668 0, 100, 100, 2); 690 0, 100, 100, 2);
669 elm_object_disabled_set(widget, EINA_TRUE); 691 elm_object_disabled_set(widget, EINA_TRUE);
@@ -685,7 +707,7 @@ _sandie_body_add(Evas_Object *win, EPhysics_World *world, int x, int y)
685 evas_object_resize(body_image, 70, 70); 707 evas_object_resize(body_image, 70, 70);
686 evas_object_move(body_image, x, y); 708 evas_object_move(body_image, x, y);
687 evas_object_show(body_image); 709 evas_object_show(body_image);
688 710
689 body = ephysics_body_circle_add(world); 711 body = ephysics_body_circle_add(world);
690 ephysics_body_evas_object_set(body, body_image, EINA_TRUE); 712 ephysics_body_evas_object_set(body, body_image, EINA_TRUE);
691 ephysics_body_mass_set(body, 20); 713 ephysics_body_mass_set(body, 20);
@@ -705,25 +727,31 @@ _menu_items_create(Evas_Object *win, Evas_Object *bxparent,
705 dbx = _sandie_double_spinner_box_add(win, bx, "Gravity"); 727 dbx = _sandie_double_spinner_box_add(win, bx, "Gravity");
706 widget = _sandie_spinner_add(win, dbx, "X:", "%1.2f m/s²", 728 widget = _sandie_spinner_add(win, dbx, "X:", "%1.2f m/s²",
707 0, 100, 0, 2); 729 0, 100, 0, 2);
708 evas_object_smart_callback_add(widget, "delay,changed", _world_gravity_x_cb, world); 730 evas_object_smart_callback_add(widget, "delay,changed", _world_gravity_x_cb,
731 world);
709 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.2f m/s²", 732 widget = _sandie_spinner_add(win, dbx, "Y:", "%1.2f m/s²",
710 0, 100, 9.81, 2); 733 0, 100, 9.81, 2);
711 evas_object_smart_callback_add(widget, "delay,changed", _world_gravity_y_cb, world); 734 evas_object_smart_callback_add(widget, "delay,changed",
735 _world_gravity_y_cb, world);
712 widget = _sandie_spinner_add(win, bx, "Rate", "%1.0f pixel/meter", 736 widget = _sandie_spinner_add(win, bx, "Rate", "%1.0f pixel/meter",
713 0, 100, 20, 2); 737 0, 100, 20, 2);
714 evas_object_smart_callback_add(widget, "delay,changed", _world_rate_cb, world); 738 evas_object_smart_callback_add(widget, "delay,changed", _world_rate_cb,
739 world);
715 widget = _sandie_spinner_add(win, bx, "Max Sleeping Time", "%1.0f s", 740 widget = _sandie_spinner_add(win, bx, "Max Sleeping Time", "%1.0f s",
716 0, 100, 2, 2); 741 0, 100, 2, 2);
717 evas_object_smart_callback_add(widget, "delay,changed", _world_max_sleeping_time_cb, world); 742 evas_object_smart_callback_add(widget, "delay,changed",
743 _world_max_sleeping_time_cb, world);
718 744
719 bx = _category_add(win, bxparent, "EPhysics Boundaries"); 745 bx = _category_add(win, bxparent, "EPhysics Boundaries");
720 widget = _sandie_spinner_add(win, bx, "Friction", "%1.3f", 746 widget = _sandie_spinner_add(win, bx, "Friction", "%1.3f",
721 0, 1, 0.5, 0.05); 747 0, 1, 0.5, 0.05);
722 evas_object_data_set(widget, "win", win); 748 evas_object_data_set(widget, "win", win);
723 evas_object_smart_callback_add(widget, "delay,changed", _world_friction_cb, win); 749 evas_object_smart_callback_add(widget, "delay,changed",
750 _world_friction_cb, win);
724 widget = _sandie_spinner_add(win, bx, "Restitution", "%1.3f", 751 widget = _sandie_spinner_add(win, bx, "Restitution", "%1.3f",
725 0, 1, 0, 0.05); 752 0, 1, 0, 0.05);
726 evas_object_smart_callback_add(widget, "delay,changed", _world_restitution_cb, win); 753 evas_object_smart_callback_add(widget, "delay,changed",
754 _world_restitution_cb, win);
727} 755}
728 756
729static void 757static void
@@ -738,14 +766,12 @@ _world_populate(Sandie_Data *sandie, Evas_Object *bxparent)
738 sandie->body1); 766 sandie->body1);
739 _menu_body_items_create(sandie->win, bxparent, "EPhysics Body 2", 767 _menu_body_items_create(sandie->win, bxparent, "EPhysics Body 2",
740 sandie->body2); 768 sandie->body2);
741
742} 769}
743 770
744static void 771static void
745_restart(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 772_restart(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
746{ 773{
747 Sandie_Data *sandie = data; 774 Sandie_Data *sandie = data;
748
749 ephysics_body_del(sandie->body1); 775 ephysics_body_del(sandie->body1);
750 ephysics_body_del(sandie->body2); 776 ephysics_body_del(sandie->body2);
751} 777}
@@ -809,7 +835,8 @@ _sandie_world_add(Evas_Object *win)
809 ephysics_world_render_geometry_set(world, 80, 80, (int) WIDTH * 0.7 - 160, 835 ephysics_world_render_geometry_set(world, 80, 80, (int) WIDTH * 0.7 - 160,
810 HEIGHT - 160); 836 HEIGHT - 160);
811 evas_object_data_set(win, "top", ephysics_body_top_boundary_add(world)); 837 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)); 838 evas_object_data_set(win, "bottom",
839 ephysics_body_bottom_boundary_add(world));
813 evas_object_data_set(win, "left", ephysics_body_left_boundary_add(world)); 840 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)); 841 evas_object_data_set(win, "right", ephysics_body_right_boundary_add(world));
815 842