summaryrefslogtreecommitdiff
path: root/legacy/ephysics/doc
diff options
context:
space:
mode:
authorRicardo de Almeida Gonzaga <ricardo@profusion.mobi>2012-09-21 17:01:49 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-09-21 17:01:49 +0000
commit85b32d701e53086f8be72b0abd4d80b535d5e2bd (patch)
tree1aa4750bc127919e3ded02e506db35c07a19493e /legacy/ephysics/doc
parent9f61d9be2bc71a99d6cb05ea6131b158ce5a43ea (diff)
ephysics: add a new example doc: Camera -
test_camera.c Patch by: Ricardo de Almeida Gonzaga <ricardo@profusion.mobi> SVN revision: 76975
Diffstat (limited to 'legacy/ephysics/doc')
-rw-r--r--legacy/ephysics/doc/examples.dox126
1 files changed, 126 insertions, 0 deletions
diff --git a/legacy/ephysics/doc/examples.dox b/legacy/ephysics/doc/examples.dox
index 49fd3878e8..1cea186290 100644
--- a/legacy/ephysics/doc/examples.dox
+++ b/legacy/ephysics/doc/examples.dox
@@ -5,6 +5,7 @@
5 * 5 *
6 * @li @ref tutorial_ephysics_bouncing_ball 6 * @li @ref tutorial_ephysics_bouncing_ball
7 * @li @ref tutorial_ephysics_bouncing_text 7 * @li @ref tutorial_ephysics_bouncing_text
8 * @li @ref tutorial_ephysics_camera
8 * @li @ref tutorial_ephysics_collision_detection 9 * @li @ref tutorial_ephysics_collision_detection
9 * @li @ref tutorial_ephysics_collision_filter 10 * @li @ref tutorial_ephysics_collision_filter
10 * @li @ref tutorial_ephysics_delete_body 11 * @li @ref tutorial_ephysics_delete_body
@@ -295,6 +296,131 @@
295 */ 296 */
296 297
297/** 298/**
299 * @page tutorial_ephysics_camera EPhysics - Camera
300 *
301 * The purpose of this example is to demonstrate the EPhysics_Camera usage.
302 *
303 * The EPhysics_Camera facilitates the usage of scenarios bigger than the
304 * viewport, thats because the EPhysics handles the position of objects
305 * which has control.
306 *
307 * For this example we'll have an EPhysics_World, two distant EPhysics_Bodys,
308 * one with an impulse to collide each other and an EPhysics_Camera that
309 * follows the moving body using an animator.
310 *
311 * The basic concepts like - initializing an EPhysics_World, render geometry,
312 * physics limiting boundaries, add an Ephysics_Body, associate it to evas
313 * objects, change restitution, friction and impulse properties, were
314 * already covered in
315 * @ref tutorial_ephysics_bouncing_ball
316 *
317 * @section add-camstruct Camera Data Struct
318 * @dontinclude test_camera.c
319 *
320 * While in this example we'll be working with a struct to hold some objects
321 * in our code. For clarity sake we present you the struct declaration in the
322 * following block.
323 *
324 * @skip struct _Camera_Data {
325 * @until };
326 *
327 * @section add-camera Adding a Camera
328 *
329 * To move the camera in this example, we'll use an animator.
330 *
331 * @skipline camera_data->animator = ecore_animator_add
332 *
333 * In the animators function, we'll have to create a specific type of variable:
334 * @ref EPhysics_Camera
335 * And also get the worlds rendered area width to define a limit to the camera.
336 *
337 * @dontinclude test_camera.c
338 *
339 * @skip _camera_move_cb(void *data
340 * @until &w, NULL);
341 *
342 * Every world has a camera, so here we get this camera used by our
343 * EPhysics_World.
344 *
345 * @skipline camera = ephysics_world_camera_get
346 *
347 * Here we get the cameras position to after set the position based on previous.
348 *
349 * @skipline ephysics_camera_position_get(camera
350 *
351 * Here we check if the camera reached the end of scenario (define the limit
352 * to the camera) then we stop the animator, else we move the camera + 2
353 * pixel positions to the right.
354 *
355 * @skip if (x + w > WIDTH * 2)
356 * @until ephysics_camera_position_set(camera, x, y
357 * @skipline }
358 *
359 * @section add-uptfloor Updating the floor
360 *
361 * Here we'll use 2 floor images to give the impression of an infinite ground.
362 *
363 * Calling ephysics_world_event_callback_add()
364 * will register a callback to a type of physics world event.
365 *
366 * @ref EPHYSICS_CALLBACK_WORLD_CAMERA_MOVED : called if the camera position
367 * changed on physics simulation tick.
368 *
369 * @skip ephysics_world_event_callback_add(world,
370 * @until _camera_moved_cb, camera_data);
371 *
372 * In the function, we just get the cameras position to know how much
373 * the camera moved and move the same value to the floor passing it as
374 * delta_x to the function, note that we use an old_x variable to do this
375 * calculation.
376 * @dontinclude test_camera.c
377 *
378 * @skip _camera_moved_cb(void *data
379 * @until }
380 *
381 * Here we get the floors position and plus the delta_x value to move the
382 * floor in the same "velocity".
383 *
384 * @dontinclude test_camera.c
385 *
386 * @skip _update_floor
387 * @until fx = x + delta
388 *
389 * We use 2 floor images because whenever one exits the screen by the left
390 * side, another is being shown, when it happens the one which exit the screen
391 * is sent to the right side, entering into an infinite loop, giving the
392 * impression of an infinite ground image. Its important to note that we need
393 * to use the fx to don't gap the images.
394 *
395 * @skip if (fx < -FLOOR_WIDTH
396 * @until }
397 *
398 * Here we finish the example. The full source code can be found at
399 * @ref test_camera_c.
400 *
401 */
402
403 /**
404 * @page test_camera_c test_camera.c
405 *
406 * @section ephysics-test-h ephysics_test.h
407 * @include ephysics_test.h
408 *
409 * @section test-camera-c test_camera.c
410 * @dontinclude test.c
411 *
412 * @skip test_clean
413 * @until }
414 *
415 * @skip test_win_add
416 * @until }
417 *
418 * @include test_camera.c
419 *
420 * @example test_camera.c
421 */
422
423/**
298 * @page tutorial_ephysics_collision_detection EPhysics - Collision Detection 424 * @page tutorial_ephysics_collision_detection EPhysics - Collision Detection
299 * 425 *
300 * The purpose of this example is to demonstrate the EPhysics Collision 426 * The purpose of this example is to demonstrate the EPhysics Collision