summaryrefslogtreecommitdiff
path: root/legacy/ephysics/doc
diff options
context:
space:
mode:
authorRicardo de Almeida Gonzaga <ricardo@profusion.mobi>2012-09-21 17:01:40 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-09-21 17:01:40 +0000
commit9f61d9be2bc71a99d6cb05ea6131b158ce5a43ea (patch)
tree764aa3b9a7a201657249340554af316c420a4ccf /legacy/ephysics/doc
parentca41ab29ed3823d6e8ab5dfc81f5e8aa3edc995c (diff)
ephysics: add a new example doc: Slider -
test_slider.c Patch by: Ricardo de Almeida Gonzaga <ricardo@profusion.mobi> SVN revision: 76974
Diffstat (limited to 'legacy/ephysics/doc')
-rw-r--r--legacy/ephysics/doc/examples.dox97
1 files changed, 97 insertions, 0 deletions
diff --git a/legacy/ephysics/doc/examples.dox b/legacy/ephysics/doc/examples.dox
index 15380984d2..49fd3878e8 100644
--- a/legacy/ephysics/doc/examples.dox
+++ b/legacy/ephysics/doc/examples.dox
@@ -14,6 +14,7 @@
14 * @li @ref tutorial_ephysics_velocity 14 * @li @ref tutorial_ephysics_velocity
15 * @li @ref tutorial_ephysics_shapes 15 * @li @ref tutorial_ephysics_shapes
16 * @li @ref tutorial_ephysics_sleeping_threshold 16 * @li @ref tutorial_ephysics_sleeping_threshold
17 * @li @ref tutorial_ephysics_slider
17 */ 18 */
18 19
19/** 20/**
@@ -570,6 +571,9 @@
570 * already covered in 571 * already covered in
571 * @ref tutorial_ephysics_bouncing_ball 572 * @ref tutorial_ephysics_bouncing_ball
572 * 573 *
574 * You can use also a slider constraint:
575 * @ref tutorial_ephysics_slider
576 *
573 * @section add-constraint Adding a constraint 577 * @section add-constraint Adding a constraint
574 * @dontinclude test_constraint.c 578 * @dontinclude test_constraint.c
575 * 579 *
@@ -1054,3 +1058,96 @@
1054 * 1058 *
1055 * @example test_sleeping_threshold.c 1059 * @example test_sleeping_threshold.c
1056 */ 1060 */
1061
1062 /**
1063 * @page tutorial_ephysics_slider EPhysics - Slider
1064 *
1065 * The purpose of this example is to demonstrate the EPhysics Slider
1066 * usage - The code applies slider on three cubes.
1067 *
1068 * For this example we'll have an EPhysics_World, and four basic
1069 * EPhysics_Bodys.
1070 *
1071 * The basic concepts like - defining an EPhysics_World, render geometry,
1072 * physics limiting boundaries, add an EPhysics_Body, associate it to evas
1073 * objects, change restitution, friction and impulse properties, were
1074 * already covered in
1075 * @ref tutorial_ephysics_bouncing_ball
1076 *
1077 * You can use also a P2P (point to point) constraint:
1078 * @ref tutorial_ephysics_constraint
1079 *
1080 * @section add-slider Adding a Slider
1081 * @dontinclude test_slider.c
1082 *
1083 * Slider is a constraint that will limit the linear and angular moving of
1084 * a body.
1085 *
1086 * We'll add three sliders on the cubes, starting with the highest purple.
1087 *
1088 * First we need to create a specific variable type to get EPhysics_Body
1089 * constraint and create a new slider constraint passing the body which we
1090 * want as parameter.
1091 *
1092 * @skipline EPhysics_Constraint *constr
1093 *
1094 * @skipline constraint = ephysics_constraint_slider_add(box_body2
1095 *
1096 * Here we define the linear moving limits of the slider constraint, in this
1097 * case we just set moving limit down on Y axis (under), but if we wanted we
1098 * could set left, right and above also.
1099 *
1100 * @skip ephysics_constraint_slider_linear_limit_set(constraint, 0,
1101 * @until , 0, 0);
1102 *
1103 * Here we set the angular moving limits of the slider constraint. The angular
1104 * moving limits is defined in degrees and will limit the moving on Z axis, in
1105 * this case we just set the clockwise direction, but if we wanted we could
1106 * set the counter clockwise direction also.
1107 *
1108 *
1109 * @skipline ephysics_constraint_slider_angular_limit_set(constraint, 0, 45
1110 *
1111 * When this cube falls by the gravity, the slider constraint will act limiting
1112 * its linear and angular movings, giving the impression that its hanging.
1113 *
1114 * For the next two cubes is the same process.
1115 *
1116 * Now we set the slider constraint of the highest blue and lowest purple,
1117 * limiting moving limits to the left on X axis and applying an impulse
1118 * to the left where the two cubes will be limited by the slider constraint
1119 * and pushed back.
1120 *
1121 * @skip constraint = ephysics_constraint_slider_add(box_body3
1122 * @until box_body3, -240, 0);
1123 *
1124 * @skip constraint = ephysics_constraint_slider_add(box_body4
1125 * @until box_body4, -600, 0);
1126 *
1127 * Here we finish the example. The full source code can be found at
1128 * @ref test_slider_c.
1129 *
1130 */
1131
1132 /**
1133 * @page test_slider_c test_slider.c
1134 *
1135 * @section ephysics-test-h ephysics_test.h
1136 * @include ephysics_test.h
1137 *
1138 * @section test-slider-c test_slider.c
1139 * @dontinclude test.c
1140 *
1141 * @skip test_clean
1142 * @until }
1143 *
1144 * @skip test_data_new
1145 * @until }
1146 *
1147 * @skip test_win_add
1148 * @until }
1149 *
1150 * @include test_slider.c
1151 *
1152 * @example test_slider.c
1153 */