forked from enlightenment/efl
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
This commit is contained in:
parent
d6d51d86f8
commit
14459c4d74
|
@ -19,6 +19,7 @@ EXTRA_DIST = \
|
|||
ephysics_test.edc \
|
||||
frame.edc \
|
||||
list.edc \
|
||||
loading_bar.edc \
|
||||
shadows.edc \
|
||||
shapes.edc \
|
||||
spinner.edc \
|
||||
|
@ -47,6 +48,8 @@ EXTRA_DIST = \
|
|||
images/list-item-corner.png \
|
||||
images/list-item-corner-pressed.png \
|
||||
images/list-item-pressed.png \
|
||||
images/loading_bar.png \
|
||||
images/loading_knob.png \
|
||||
images/pentagon.png \
|
||||
images/shadow-ball.png \
|
||||
images/shadow-cube.png \
|
||||
|
|
|
@ -9,6 +9,7 @@ collections {
|
|||
#include "effects.edc"
|
||||
#include "frame.edc"
|
||||
#include "list.edc"
|
||||
#include "loading_bar.edc"
|
||||
#include "shadows.edc"
|
||||
#include "shapes.edc"
|
||||
#include "spinner.edc"
|
||||
|
|
|
@ -229,6 +229,24 @@
|
|||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "loading_bar";
|
||||
type: GROUP;
|
||||
source: "loading_bar";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
align: 0.5 1;
|
||||
visible: 0;
|
||||
rel2.offset: -1 -5;
|
||||
}
|
||||
description {
|
||||
state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
programs {
|
||||
|
@ -268,6 +286,14 @@
|
|||
target: "angular_acc";
|
||||
}
|
||||
|
||||
program {
|
||||
name: "loading_bar,show";
|
||||
source: "ephysics_test";
|
||||
signal: "loading_bar,show";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "loading_bar";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,69 @@
|
|||
group {
|
||||
name: "loading_bar";
|
||||
min: 440 16;
|
||||
max: 440 16;
|
||||
|
||||
images {
|
||||
image: "loading_bar.png" COMP;
|
||||
image: "loading_knob.png" COMP;
|
||||
}
|
||||
|
||||
parts {
|
||||
|
||||
part {
|
||||
name: "bar";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 440 8;
|
||||
max: 440 8;
|
||||
image.normal: "loading_bar.png";
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "knob";
|
||||
type: IMAGE;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 56 16;
|
||||
max: 56 16;
|
||||
rel1.to: "bar";
|
||||
rel2.to: "bar";
|
||||
align: 0 0.5;
|
||||
image.normal: "loading_knob.png";
|
||||
}
|
||||
description {
|
||||
state: "end" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
align: 1 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
programs {
|
||||
|
||||
program {
|
||||
name: "loading_bar,show";
|
||||
source: "ephysics_test";
|
||||
signal: "loading_bar,show";
|
||||
action: STATE_SET "end" 0.0;
|
||||
transition: LINEAR 1.5;
|
||||
target: "knob";
|
||||
after: "knob,restart";
|
||||
}
|
||||
|
||||
program {
|
||||
name: "knob,restart";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 1.5;
|
||||
target: "knob";
|
||||
after: "loading_bar,show";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -29,6 +29,7 @@ test_delete.c \
|
|||
test_falling_letters.c \
|
||||
test_forces.c \
|
||||
test_growing_balls.c \
|
||||
test_heavy.c \
|
||||
test_jumping_balls.c \
|
||||
test_material.c \
|
||||
test_no_gravity.c \
|
||||
|
|
|
@ -29,6 +29,7 @@ void test_falling_letters(void *data, Evas_Object *obj, void *event_info);
|
|||
void test_flag(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_forces(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_growing_balls(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_heavy(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_jumping_balls(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_material(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_no_gravity(void *data, Evas_Object *obj, void *event_info);
|
||||
|
@ -56,6 +57,7 @@ static const EPhysics_Test tests[] = {
|
|||
{"Flag - Cloth", test_flag},
|
||||
{"Forces", test_forces},
|
||||
{"Growing Balls", test_growing_balls},
|
||||
{"Heavy", test_heavy},
|
||||
{"Jumping Balls", test_jumping_balls},
|
||||
{"Material", test_material},
|
||||
{"No Gravity", test_no_gravity},
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ephysics_test.h"
|
||||
|
||||
static void
|
||||
_add_sphere(Test_Data *test_data, int i)
|
||||
{
|
||||
EPhysics_Body *body;
|
||||
Evas_Object *sphere;
|
||||
static const char *colors[] = {"blue-ball", "red-ball", "green-ball"};
|
||||
|
||||
sphere = elm_image_add(test_data->win);
|
||||
elm_image_file_set(
|
||||
sphere, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", colors[i % 3]);
|
||||
evas_object_move(sphere, 50 + (i % 34) * 12, 40 + i / 34 * 12);
|
||||
evas_object_resize(sphere, 10, 10);
|
||||
evas_object_show(sphere);
|
||||
test_data->evas_objs = eina_list_append(test_data->evas_objs, sphere);
|
||||
|
||||
body = ephysics_body_circle_add(test_data->world);
|
||||
ephysics_body_restitution_set(body, 0.85);
|
||||
ephysics_body_evas_object_set(body, sphere, EINA_TRUE);
|
||||
test_data->bodies = eina_list_append(test_data->bodies, body);
|
||||
}
|
||||
|
||||
static void
|
||||
_world_populate(Test_Data *test_data)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 612; i++)
|
||||
_add_sphere(test_data, i);
|
||||
}
|
||||
|
||||
static void
|
||||
_restart(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
test_clean(data);
|
||||
_world_populate(data);
|
||||
}
|
||||
|
||||
void
|
||||
test_heavy(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
EPhysics_Body *boundary;
|
||||
EPhysics_World *world;
|
||||
Test_Data *test_data;
|
||||
|
||||
if (!ephysics_init())
|
||||
return;
|
||||
|
||||
test_data = test_data_new();
|
||||
test_win_add(test_data, "Heavy", EINA_TRUE);
|
||||
elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test");
|
||||
elm_layout_signal_callback_add(test_data->layout, "restart", "test-theme",
|
||||
_restart, test_data);
|
||||
elm_layout_signal_emit(test_data->layout, "loading_bar,show",
|
||||
"ephysics_test");
|
||||
|
||||
world = ephysics_world_new();
|
||||
ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40);
|
||||
test_data->world = world;
|
||||
|
||||
boundary = ephysics_body_bottom_boundary_add(test_data->world);
|
||||
ephysics_body_restitution_set(boundary, 1);
|
||||
|
||||
ephysics_body_top_boundary_add(test_data->world);
|
||||
ephysics_body_left_boundary_add(test_data->world);
|
||||
ephysics_body_right_boundary_add(test_data->world);
|
||||
|
||||
_world_populate(test_data);
|
||||
}
|
Loading…
Reference in New Issue