summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-04 22:40:46 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-04 22:40:46 +0000
commit14459c4d745828e13779b116f6b53860eaa67e16 (patch)
treeab961b445530ad8aba188ac12ad12cb81a4e27f5 /legacy
parentd6d51d86f8e9903062945596618d99f52a519cee (diff)
ephysics: add heavy test to check threads work
Simulate 600 small balls. Ok, it's not so huge, but I've tested to add a sleep on step simulation on bullet. Things looks to be working just fine. SVN revision: 77470
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/data/themes/Makefile.am3
-rw-r--r--legacy/ephysics/data/themes/ephysics_test.edc1
-rw-r--r--legacy/ephysics/data/themes/frame.edc26
-rw-r--r--legacy/ephysics/data/themes/images/loading_bar.pngbin0 -> 1159 bytes
-rw-r--r--legacy/ephysics/data/themes/images/loading_knob.pngbin0 -> 1490 bytes
-rw-r--r--legacy/ephysics/data/themes/loading_bar.edc69
-rw-r--r--legacy/ephysics/src/bin/Makefile.am1
-rw-r--r--legacy/ephysics/src/bin/test.c2
-rw-r--r--legacy/ephysics/src/bin/test_heavy.c73
9 files changed, 175 insertions, 0 deletions
diff --git a/legacy/ephysics/data/themes/Makefile.am b/legacy/ephysics/data/themes/Makefile.am
index 0973a55..87fd049 100644
--- a/legacy/ephysics/data/themes/Makefile.am
+++ b/legacy/ephysics/data/themes/Makefile.am
@@ -19,6 +19,7 @@ EXTRA_DIST = \
19 ephysics_test.edc \ 19 ephysics_test.edc \
20 frame.edc \ 20 frame.edc \
21 list.edc \ 21 list.edc \
22 loading_bar.edc \
22 shadows.edc \ 23 shadows.edc \
23 shapes.edc \ 24 shapes.edc \
24 spinner.edc \ 25 spinner.edc \
@@ -47,6 +48,8 @@ EXTRA_DIST = \
47 images/list-item-corner.png \ 48 images/list-item-corner.png \
48 images/list-item-corner-pressed.png \ 49 images/list-item-corner-pressed.png \
49 images/list-item-pressed.png \ 50 images/list-item-pressed.png \
51 images/loading_bar.png \
52 images/loading_knob.png \
50 images/pentagon.png \ 53 images/pentagon.png \
51 images/shadow-ball.png \ 54 images/shadow-ball.png \
52 images/shadow-cube.png \ 55 images/shadow-cube.png \
diff --git a/legacy/ephysics/data/themes/ephysics_test.edc b/legacy/ephysics/data/themes/ephysics_test.edc
index 2e1f427..f0bec3e 100644
--- a/legacy/ephysics/data/themes/ephysics_test.edc
+++ b/legacy/ephysics/data/themes/ephysics_test.edc
@@ -9,6 +9,7 @@ collections {
9#include "effects.edc" 9#include "effects.edc"
10#include "frame.edc" 10#include "frame.edc"
11#include "list.edc" 11#include "list.edc"
12#include "loading_bar.edc"
12#include "shadows.edc" 13#include "shadows.edc"
13#include "shapes.edc" 14#include "shapes.edc"
14#include "spinner.edc" 15#include "spinner.edc"
diff --git a/legacy/ephysics/data/themes/frame.edc b/legacy/ephysics/data/themes/frame.edc
index 67e647b..6bbd23c 100644
--- a/legacy/ephysics/data/themes/frame.edc
+++ b/legacy/ephysics/data/themes/frame.edc
@@ -229,6 +229,24 @@
229 } 229 }
230 } 230 }
231 231
232 part {
233 name: "loading_bar";
234 type: GROUP;
235 source: "loading_bar";
236 mouse_events: 0;
237 description {
238 state: "default" 0.0;
239 align: 0.5 1;
240 visible: 0;
241 rel2.offset: -1 -5;
242 }
243 description {
244 state: "visible" 0.0;
245 inherit: "default" 0.0;
246 visible: 1;
247 }
248 }
249
232 } 250 }
233 251
234 programs { 252 programs {
@@ -268,6 +286,14 @@
268 target: "angular_acc"; 286 target: "angular_acc";
269 } 287 }
270 288
289 program {
290 name: "loading_bar,show";
291 source: "ephysics_test";
292 signal: "loading_bar,show";
293 action: STATE_SET "visible" 0.0;
294 target: "loading_bar";
295 }
296
271 } 297 }
272 298
273 } 299 }
diff --git a/legacy/ephysics/data/themes/images/loading_bar.png b/legacy/ephysics/data/themes/images/loading_bar.png
new file mode 100644
index 0000000..59d23ca
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/loading_bar.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/images/loading_knob.png b/legacy/ephysics/data/themes/images/loading_knob.png
new file mode 100644
index 0000000..a40872b
--- /dev/null
+++ b/legacy/ephysics/data/themes/images/loading_knob.png
Binary files differ
diff --git a/legacy/ephysics/data/themes/loading_bar.edc b/legacy/ephysics/data/themes/loading_bar.edc
new file mode 100644
index 0000000..0b962d9
--- /dev/null
+++ b/legacy/ephysics/data/themes/loading_bar.edc
@@ -0,0 +1,69 @@
1 group {
2 name: "loading_bar";
3 min: 440 16;
4 max: 440 16;
5
6 images {
7 image: "loading_bar.png" COMP;
8 image: "loading_knob.png" COMP;
9 }
10
11 parts {
12
13 part {
14 name: "bar";
15 type: IMAGE;
16 mouse_events: 0;
17 description {
18 state: "default" 0.0;
19 min: 440 8;
20 max: 440 8;
21 image.normal: "loading_bar.png";
22 }
23 }
24
25 part {
26 name: "knob";
27 type: IMAGE;
28 mouse_events: 0;
29 description {
30 state: "default" 0.0;
31 min: 56 16;
32 max: 56 16;
33 rel1.to: "bar";
34 rel2.to: "bar";
35 align: 0 0.5;
36 image.normal: "loading_knob.png";
37 }
38 description {
39 state: "end" 0.0;
40 inherit: "default" 0.0;
41 align: 1 0.5;
42 }
43 }
44
45 }
46
47 programs {
48
49 program {
50 name: "loading_bar,show";
51 source: "ephysics_test";
52 signal: "loading_bar,show";
53 action: STATE_SET "end" 0.0;
54 transition: LINEAR 1.5;
55 target: "knob";
56 after: "knob,restart";
57 }
58
59 program {
60 name: "knob,restart";
61 action: STATE_SET "default" 0.0;
62 transition: LINEAR 1.5;
63 target: "knob";
64 after: "loading_bar,show";
65 }
66
67 }
68
69 }
diff --git a/legacy/ephysics/src/bin/Makefile.am b/legacy/ephysics/src/bin/Makefile.am
index 9bd4eb9..8cb3447 100644
--- a/legacy/ephysics/src/bin/Makefile.am
+++ b/legacy/ephysics/src/bin/Makefile.am
@@ -29,6 +29,7 @@ test_delete.c \
29test_falling_letters.c \ 29test_falling_letters.c \
30test_forces.c \ 30test_forces.c \
31test_growing_balls.c \ 31test_growing_balls.c \
32test_heavy.c \
32test_jumping_balls.c \ 33test_jumping_balls.c \
33test_material.c \ 34test_material.c \
34test_no_gravity.c \ 35test_no_gravity.c \
diff --git a/legacy/ephysics/src/bin/test.c b/legacy/ephysics/src/bin/test.c
index f512356..ce1f7f6 100644
--- a/legacy/ephysics/src/bin/test.c
+++ b/legacy/ephysics/src/bin/test.c
@@ -29,6 +29,7 @@ void test_falling_letters(void *data, Evas_Object *obj, void *event_info);
29void test_flag(void *data, Evas_Object *obj, void *event_info); 29void test_flag(void *data, Evas_Object *obj, void *event_info);
30void test_forces(void *data, Evas_Object *obj, void *event_info); 30void test_forces(void *data, Evas_Object *obj, void *event_info);
31void test_growing_balls(void *data, Evas_Object *obj, void *event_info); 31void test_growing_balls(void *data, Evas_Object *obj, void *event_info);
32void test_heavy(void *data, Evas_Object *obj, void *event_info);
32void test_jumping_balls(void *data, Evas_Object *obj, void *event_info); 33void test_jumping_balls(void *data, Evas_Object *obj, void *event_info);
33void test_material(void *data, Evas_Object *obj, void *event_info); 34void test_material(void *data, Evas_Object *obj, void *event_info);
34void test_no_gravity(void *data, Evas_Object *obj, void *event_info); 35void test_no_gravity(void *data, Evas_Object *obj, void *event_info);
@@ -56,6 +57,7 @@ static const EPhysics_Test tests[] = {
56 {"Flag - Cloth", test_flag}, 57 {"Flag - Cloth", test_flag},
57 {"Forces", test_forces}, 58 {"Forces", test_forces},
58 {"Growing Balls", test_growing_balls}, 59 {"Growing Balls", test_growing_balls},
60 {"Heavy", test_heavy},
59 {"Jumping Balls", test_jumping_balls}, 61 {"Jumping Balls", test_jumping_balls},
60 {"Material", test_material}, 62 {"Material", test_material},
61 {"No Gravity", test_no_gravity}, 63 {"No Gravity", test_no_gravity},
diff --git a/legacy/ephysics/src/bin/test_heavy.c b/legacy/ephysics/src/bin/test_heavy.c
new file mode 100644
index 0000000..ad90b9f
--- /dev/null
+++ b/legacy/ephysics/src/bin/test_heavy.c
@@ -0,0 +1,73 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ephysics_test.h"
6
7static void
8_add_sphere(Test_Data *test_data, int i)
9{
10 EPhysics_Body *body;
11 Evas_Object *sphere;
12 static const char *colors[] = {"blue-ball", "red-ball", "green-ball"};
13
14 sphere = elm_image_add(test_data->win);
15 elm_image_file_set(
16 sphere, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", colors[i % 3]);
17 evas_object_move(sphere, 50 + (i % 34) * 12, 40 + i / 34 * 12);
18 evas_object_resize(sphere, 10, 10);
19 evas_object_show(sphere);
20 test_data->evas_objs = eina_list_append(test_data->evas_objs, sphere);
21
22 body = ephysics_body_circle_add(test_data->world);
23 ephysics_body_restitution_set(body, 0.85);
24 ephysics_body_evas_object_set(body, sphere, EINA_TRUE);
25 test_data->bodies = eina_list_append(test_data->bodies, body);
26}
27
28static void
29_world_populate(Test_Data *test_data)
30{
31 int i;
32 for (i = 0; i < 612; i++)
33 _add_sphere(test_data, i);
34}
35
36static void
37_restart(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
38{
39 test_clean(data);
40 _world_populate(data);
41}
42
43void
44test_heavy(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
45{
46 EPhysics_Body *boundary;
47 EPhysics_World *world;
48 Test_Data *test_data;
49
50 if (!ephysics_init())
51 return;
52
53 test_data = test_data_new();
54 test_win_add(test_data, "Heavy", EINA_TRUE);
55 elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test");
56 elm_layout_signal_callback_add(test_data->layout, "restart", "test-theme",
57 _restart, test_data);
58 elm_layout_signal_emit(test_data->layout, "loading_bar,show",
59 "ephysics_test");
60
61 world = ephysics_world_new();
62 ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40);
63 test_data->world = world;
64
65 boundary = ephysics_body_bottom_boundary_add(test_data->world);
66 ephysics_body_restitution_set(boundary, 1);
67
68 ephysics_body_top_boundary_add(test_data->world);
69 ephysics_body_left_boundary_add(test_data->world);
70 ephysics_body_right_boundary_add(test_data->world);
71
72 _world_populate(test_data);
73}