EPhysics: test_soft_ellipsoid.c becomes test_soft_sphere.c
authorLeandro Dorileo <dorileo@profusion.mobi>
Tue, 11 Dec 2012 21:11:25 +0000 (21:11 +0000)
committerLeandro Dorileo <dorileo@profusion.mobi>
Tue, 11 Dec 2012 21:11:25 +0000 (21:11 +0000)
Following the renaming wave test_soft_ellipsoid.c is renamed to its
sphere counter part.

SVN revision: 80721

legacy/ephysics/src/bin/Makefile.am
legacy/ephysics/src/bin/test.c
legacy/ephysics/src/bin/test_soft_ellipsoid.c [deleted file]
legacy/ephysics/src/bin/test_soft_sphere.c [new file with mode: 0644]

index 6d93e3dd64d59a29e6f2f11f5b446b81dd95d1b8..285f942a26066177f88f4ef70155c11c3e6fdfd9 100644 (file)
@@ -50,7 +50,7 @@ test_sleeping_threshold.c \
 test_slider.c \
 test_soft_body.c \
 test_soft_button.c \
-test_soft_ellipsoid.c \
+test_soft_sphere.c \
 test_win_resize.c
 
 ephysics_logo_SOURCES = \
index 8f554891508b7d057dd42225427cbe1fd7218e64..39fe46e07d5eeb1774eff496889b9933f8ce6029 100644 (file)
@@ -49,7 +49,7 @@ void test_sleeping(void *data, Evas_Object *obj, void *event_info);
 void test_slider(void *data, Evas_Object *obj, void *event_info);
 void test_soft_body(void *data, Evas_Object *obj, void *event_info);
 void test_soft_button(void *data, Evas_Object *obj, void *event_info);
-void test_soft_ellipsoid(void *data, Evas_Object *obj, void *event_info);
+void test_soft_sphere(void *data, Evas_Object *obj, void *event_info);
 void test_win_resize(void *data, Evas_Object *obj, void *event_info);
 
 static const EPhysics_Test tests[] = {
@@ -87,7 +87,7 @@ static const EPhysics_Test tests[] = {
        {"Slider", test_slider},
        {"Soft Body", test_soft_body},
        {"Soft Button", test_soft_button},
-       {"Soft Ellipsoid", test_soft_ellipsoid},
+       {"Soft Sphere", test_soft_sphere},
        {"Win Resize", test_win_resize},
 };
 
diff --git a/legacy/ephysics/src/bin/test_soft_ellipsoid.c b/legacy/ephysics/src/bin/test_soft_ellipsoid.c
deleted file mode 100644 (file)
index 393f17d..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "ephysics_test.h"
-
-static void
-_mouse_down_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
-{
-   EPhysics_Body *body = data;
-   Evas_Event_Mouse_Down *mdown = event_info;
-   Evas_Coord w, h, x, y, z, d;
-   Eina_List *triangles;
-   int *ldata;
-
-   ephysics_body_geometry_get(body, NULL, NULL, &z, NULL, NULL, &d);
-
-   w = 20;
-   h = 20;
-   x = mdown->output.x - (w / 2);
-   y = mdown->output.y - (h / 2);
-   d = d / 2;
-
-   triangles = ephysics_body_soft_body_triangles_inside_get(body, x, y, z,
-                                                            w, h, d);
-   ephysics_body_soft_body_triangle_list_impulse_apply(body, triangles, 0, 0,
-                                                       10);
-   EINA_LIST_FREE(triangles, ldata)
-     free(ldata);
-}
-
-static void
-_soft_ellipsoid_add(Test_Data *test_data, Evas_Object *front_face, Evas_Object *back_face)
-{
-   EPhysics_Body *body;
-   Evas_Coord w, h;
-
-
-   body = ephysics_body_soft_sphere_add(test_data->world, 100);
-
-   ephysics_body_face_evas_object_set(body,
-                 EPHYSICS_BODY_SPHERE_FACE_FRONT, front_face, EINA_TRUE);
-
-   ephysics_body_face_evas_object_set(body,
-                   EPHYSICS_BODY_SPHERE_FACE_BACK, back_face, EINA_TRUE);
-
-   ephysics_body_geometry_get(body, NULL, NULL, NULL, &w, &h, NULL);
-   ephysics_body_resize(body, w, h, h);
-   test_data->bodies = eina_list_append(test_data->bodies, body);
-
-   ephysics_body_linear_movement_enable_set(body, EINA_FALSE, EINA_FALSE,
-                                            EINA_TRUE);
-   ephysics_body_angular_movement_enable_set(body, EINA_TRUE, EINA_TRUE,
-                                             EINA_TRUE);
-
-   evas_object_event_callback_add(front_face, EVAS_CALLBACK_MOUSE_DOWN,
-                                  _mouse_down_cb, body);
-
-   evas_object_event_callback_add(back_face, EVAS_CALLBACK_MOUSE_DOWN,
-                                  _mouse_down_cb, body);
-}
-
-static void
-_world_populate(Test_Data *test_data)
-{
-   Evas_Object *front_face, *back_face;
-
-   front_face = elm_image_add(test_data->win);
-   elm_image_file_set(
-     front_face, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", "purple-cube");
-   evas_object_move(front_face, WIDTH / 2 - 35, HEIGHT / 2 - 35);
-   evas_object_resize(front_face, 70, 70);
-   evas_object_show(front_face);
-   test_data->evas_objs = eina_list_append(test_data->evas_objs, front_face);
-
-   back_face = elm_image_add(test_data->win);
-   elm_image_file_set(
-      back_face, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", "purple-cube");
-   evas_object_move(back_face, WIDTH / 2 - 35, HEIGHT / 2 - 35);
-   evas_object_resize(back_face, 70, 70);
-   evas_object_show(back_face);
-   test_data->evas_objs = eina_list_append(test_data->evas_objs, back_face);
-
-   _soft_ellipsoid_add(test_data, front_face, back_face);
-}
-
-static void
-_restart(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
-   Test_Data *test_data = data;
-
-   DBG("Restart pressed");
-   test_clean(test_data);
-   _world_populate(test_data);
-}
-
-void
-test_soft_ellipsoid(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
-   EPhysics_World *world;
-   Test_Data *test_data;
-
-   if (!ephysics_init())
-     return;
-
-   test_data = test_data_new();
-   test_win_add(test_data, "Soft Ellipsoid", EINA_TRUE);
-
-   elm_layout_signal_callback_add(test_data->layout, "restart", "test-theme",
-                                  _restart, test_data);
-   elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test");
-
-   world = ephysics_world_new();
-   ephysics_world_simulation_set(world, 1/150.f, 5);
-   ephysics_world_render_geometry_set(world, 50, 40, -50,
-                                      WIDTH - 100, FLOOR_Y - 40, DEPTH);
-   test_data->world = world;
-
-   ephysics_world_point_light_position_set(world, 300, 50, -200);
-
-   _world_populate(test_data);
-}
diff --git a/legacy/ephysics/src/bin/test_soft_sphere.c b/legacy/ephysics/src/bin/test_soft_sphere.c
new file mode 100644 (file)
index 0000000..55353dc
--- /dev/null
@@ -0,0 +1,122 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "ephysics_test.h"
+
+static void
+_mouse_down_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+   EPhysics_Body *body = data;
+   Evas_Event_Mouse_Down *mdown = event_info;
+   Evas_Coord w, h, x, y, z, d;
+   Eina_List *triangles;
+   int *ldata;
+
+   ephysics_body_geometry_get(body, NULL, NULL, &z, NULL, NULL, &d);
+
+   w = 20;
+   h = 20;
+   x = mdown->output.x - (w / 2);
+   y = mdown->output.y - (h / 2);
+   d = d / 2;
+
+   triangles = ephysics_body_soft_body_triangles_inside_get(body, x, y, z,
+                                                            w, h, d);
+   ephysics_body_soft_body_triangle_list_impulse_apply(body, triangles, 0, 0,
+                                                       10);
+   EINA_LIST_FREE(triangles, ldata)
+     free(ldata);
+}
+
+static void
+_soft_sphere_add(Test_Data *test_data, Evas_Object *front_face, Evas_Object *back_face)
+{
+   EPhysics_Body *body;
+   Evas_Coord w, h;
+
+
+   body = ephysics_body_soft_sphere_add(test_data->world, 100);
+
+   ephysics_body_face_evas_object_set(body,
+                 EPHYSICS_BODY_SPHERE_FACE_FRONT, front_face, EINA_TRUE);
+
+   ephysics_body_face_evas_object_set(body,
+                   EPHYSICS_BODY_SPHERE_FACE_BACK, back_face, EINA_TRUE);
+
+   ephysics_body_geometry_get(body, NULL, NULL, NULL, &w, &h, NULL);
+   ephysics_body_resize(body, w, h, h);
+   test_data->bodies = eina_list_append(test_data->bodies, body);
+
+   ephysics_body_linear_movement_enable_set(body, EINA_FALSE, EINA_FALSE,
+                                            EINA_TRUE);
+   ephysics_body_angular_movement_enable_set(body, EINA_TRUE, EINA_TRUE,
+                                             EINA_TRUE);
+
+   evas_object_event_callback_add(front_face, EVAS_CALLBACK_MOUSE_DOWN,
+                                  _mouse_down_cb, body);
+
+   evas_object_event_callback_add(back_face, EVAS_CALLBACK_MOUSE_DOWN,
+                                  _mouse_down_cb, body);
+}
+
+static void
+_world_populate(Test_Data *test_data)
+{
+   Evas_Object *front_face, *back_face;
+
+   front_face = elm_image_add(test_data->win);
+   elm_image_file_set(
+     front_face, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", "purple-cube");
+   evas_object_move(front_face, WIDTH / 2 - 35, HEIGHT / 2 - 35);
+   evas_object_resize(front_face, 70, 70);
+   evas_object_show(front_face);
+   test_data->evas_objs = eina_list_append(test_data->evas_objs, front_face);
+
+   back_face = elm_image_add(test_data->win);
+   elm_image_file_set(
+      back_face, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", "purple-cube");
+   evas_object_move(back_face, WIDTH / 2 - 35, HEIGHT / 2 - 35);
+   evas_object_resize(back_face, 70, 70);
+   evas_object_show(back_face);
+   test_data->evas_objs = eina_list_append(test_data->evas_objs, back_face);
+
+   _soft_sphere_add(test_data, front_face, back_face);
+}
+
+static void
+_restart(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   Test_Data *test_data = data;
+
+   DBG("Restart pressed");
+   test_clean(test_data);
+   _world_populate(test_data);
+}
+
+void
+test_soft_sphere(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   EPhysics_World *world;
+   Test_Data *test_data;
+
+   if (!ephysics_init())
+     return;
+
+   test_data = test_data_new();
+   test_win_add(test_data, "Soft Sphere", EINA_TRUE);
+
+   elm_layout_signal_callback_add(test_data->layout, "restart", "test-theme",
+                                  _restart, test_data);
+   elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test");
+
+   world = ephysics_world_new();
+   ephysics_world_simulation_set(world, 1/150.f, 5);
+   ephysics_world_render_geometry_set(world, 50, 40, -50,
+                                      WIDTH - 100, FLOOR_Y - 40, DEPTH);
+   test_data->world = world;
+
+   ephysics_world_point_light_position_set(world, 300, 50, -200);
+
+   _world_populate(test_data);
+}