|
|
|
@ -55,13 +55,11 @@ _mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void |
|
|
|
|
Evas_Event_Mouse_Move *mmove = event_info; |
|
|
|
|
Evas_Coord nx, ny; |
|
|
|
|
|
|
|
|
|
if (!dragging->mouse_status) return; |
|
|
|
|
if (!dragging->mouse_status || dragging->click_data.node < 0) return; |
|
|
|
|
|
|
|
|
|
nx = mmove->cur.output.x; |
|
|
|
|
ny = mmove->cur.output.y; |
|
|
|
|
|
|
|
|
|
if (nx < 0 || ny < 0 || dragging->click_data.node < 0) return; |
|
|
|
|
|
|
|
|
|
DBG("node: %d, nx: %d, ny: %d\n", dragging->click_data.node, nx, ny); |
|
|
|
|
ephysics_body_soft_body_triangle_move(dragging->body, |
|
|
|
|
dragging->click_data.node, nx, ny, 10); |
|
|
|
@ -74,6 +72,8 @@ _world_populate(Test_Data *test_data) |
|
|
|
|
EPhysics_Body *flag_body, *pole_body; |
|
|
|
|
Dragging_Data *dragging; |
|
|
|
|
|
|
|
|
|
dragging = calloc(1, sizeof(Dragging_Data)); |
|
|
|
|
|
|
|
|
|
evas_obj = elm_image_add(test_data->win); |
|
|
|
|
elm_image_file_set( |
|
|
|
|
evas_obj, PACKAGE_DATA_DIR "/" EPHYSICS_TEST_THEME ".edj", "brown-pole"); |
|
|
|
@ -98,6 +98,7 @@ _world_populate(Test_Data *test_data) |
|
|
|
|
test_data->evas_objs = eina_list_append(test_data->evas_objs, evas_obj); |
|
|
|
|
|
|
|
|
|
flag_body = ephysics_body_cloth_add(test_data->world, 0, 0); |
|
|
|
|
ephysics_body_soft_body_position_iterations_set(flag_body, 10); |
|
|
|
|
ephysics_body_mass_set(flag_body, 10); |
|
|
|
|
ephysics_body_soft_body_hardness_set(flag_body, 1); |
|
|
|
|
evas_obj = ephysics_body_evas_object_set(flag_body, evas_obj, EINA_TRUE); |
|
|
|
@ -108,7 +109,6 @@ _world_populate(Test_Data *test_data) |
|
|
|
|
ephysics_body_cloth_anchor_full_add(flag_body, pole_body, |
|
|
|
|
EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_LEFT); |
|
|
|
|
|
|
|
|
|
dragging = calloc(1, sizeof(Dragging_Data)); |
|
|
|
|
dragging->body = flag_body; |
|
|
|
|
ephysics_body_data_set(flag_body, dragging); |
|
|
|
|
|
|
|
|
@ -136,7 +136,6 @@ _restart(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED_ |
|
|
|
|
void |
|
|
|
|
test_flag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) |
|
|
|
|
{ |
|
|
|
|
EPhysics_Body *boundary; |
|
|
|
|
EPhysics_World *world; |
|
|
|
|
Test_Data *test_data; |
|
|
|
|
|
|
|
|
@ -151,7 +150,6 @@ test_flag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _ |
|
|
|
|
elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test"); |
|
|
|
|
|
|
|
|
|
world = ephysics_world_new(); |
|
|
|
|
ephysics_world_simulation_set(world, 1/160.f, 10); |
|
|
|
|
ephysics_world_render_geometry_set(world, 50, 40, -50, |
|
|
|
|
WIDTH - 100, FLOOR_Y - 40, DEPTH); |
|
|
|
|
test_data->world = world; |
|
|
|
@ -161,18 +159,6 @@ test_flag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _ |
|
|
|
|
ephysics_camera_perspective_enabled_set(ephysics_world_camera_get(world), |
|
|
|
|
EINA_TRUE); |
|
|
|
|
|
|
|
|
|
boundary = ephysics_body_bottom_boundary_add(test_data->world); |
|
|
|
|
ephysics_body_restitution_set(boundary, 0.65); |
|
|
|
|
ephysics_body_friction_set(boundary, 4); |
|
|
|
|
|
|
|
|
|
boundary = ephysics_body_right_boundary_add(test_data->world); |
|
|
|
|
ephysics_body_restitution_set(boundary, 0.4); |
|
|
|
|
ephysics_body_friction_set(boundary, 3); |
|
|
|
|
|
|
|
|
|
boundary = ephysics_body_left_boundary_add(test_data->world); |
|
|
|
|
ephysics_body_restitution_set(boundary, 0.4); |
|
|
|
|
ephysics_body_friction_set(boundary, 3); |
|
|
|
|
|
|
|
|
|
ephysics_body_top_boundary_add(test_data->world); |
|
|
|
|
_world_populate(test_data); |
|
|
|
|
} |
|
|
|
|