summaryrefslogtreecommitdiff
path: root/legacy/ephysics/doc
diff options
context:
space:
mode:
authorRicardo de Almeida Gonzaga <ricardo@profusion.mobi>2012-09-21 17:02:07 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-09-21 17:02:07 +0000
commit38395758abce3585b2a35b9377cfa97d2a3f3d2b (patch)
tree3cd39f2b7accd9435210df7a1a9994d90367b28a /legacy/ephysics/doc
parent8ac96ab8e7ae168c062a1b1d7c79b56444a13edd (diff)
ephysics: add a new example doc: Camera Track -
test_camera_track.c Patch by: Ricardo de Almeida Gonzaga <ricardo@profusion.mobi> SVN revision: 76977
Diffstat (limited to 'legacy/ephysics/doc')
-rw-r--r--legacy/ephysics/doc/examples.dox134
1 files changed, 134 insertions, 0 deletions
diff --git a/legacy/ephysics/doc/examples.dox b/legacy/ephysics/doc/examples.dox
index 6beaa6b056..ea896a13bb 100644
--- a/legacy/ephysics/doc/examples.dox
+++ b/legacy/ephysics/doc/examples.dox
@@ -6,6 +6,7 @@
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_camera
9 * @li @ref tutorial_ephysics_camera_track
9 * @li @ref tutorial_ephysics_collision_detection 10 * @li @ref tutorial_ephysics_collision_detection
10 * @li @ref tutorial_ephysics_collision_filter 11 * @li @ref tutorial_ephysics_collision_filter
11 * @li @ref tutorial_ephysics_delete_body 12 * @li @ref tutorial_ephysics_delete_body
@@ -422,6 +423,139 @@
422 */ 423 */
423 424
424/** 425/**
426 * @page tutorial_ephysics_camera_track EPhysics - Camera Track
427 *
428 * The purpose of this example is to demonstrate the EPhysics_Camera Track
429 * usage.
430 *
431 * The EPhysics_Camera facilitates the usage of scenarios bigger than the
432 * viewport, thats because the EPhysics handles the position of objects
433 * which has control.
434 *
435 * For this example we'll have an EPhysics_World, one main EPhysics_Body that
436 * will be tracked by an EPhysics_Camera on three ways, horizontal, vertical
437 * and full tracking. Also nine EPhysics_Bodys with mass 0, that will be used
438 * as scenario in order to our main body change its position on x and y axes
439 * when passes through this scenario.
440 *
441 * The basic concepts like - initializing an EPhysics_World, render geometry,
442 * physics limiting boundaries, add an Ephysics_Body, associate it to evas
443 * objects, change restitution, friction and impulse properties, were
444 * already covered in
445 * @ref tutorial_ephysics_bouncing_ball
446 *
447 * @section add-trkstruct Track Data Struct
448 * @dontinclude test_camera_track.c
449 *
450 * While in this example we'll be working with a struct to hold some objects
451 * in our code. For clarity sake we present you the struct declaration in the
452 * following block.
453 *
454 * @skip struct _Track_Data {
455 * @until };
456 *
457 * @section add-camera Adding a Camera
458 *
459 * In this example we'll use 3 kinds of tracking, to change this values we'll
460 * have an
461 * @ref Elm_Spinner
462 * and handle it on this function.
463 *
464 * Every world has a camera, so here we get this camera used by our
465 * EPhysics_World.
466 *
467 * @skip _track_apply(Track_Data *track
468 * @until camera = ephysics_world_camera_get(track_data->base.world
469 *
470 * Here we'll get the elm_spinner value to the tracking base on this
471 * value
472 *
473 * @skip mode =
474 * @until }
475 *
476 * Here we'll set the camera to track the body, when a body is tracked,
477 * the camera will move automatically, following this body. It will keeps the
478 * body centralized on rendered area. If it will be centralized horizontally
479 * and / or vertically depends if parameters horizontal and vertical are set
480 * to EINA_TRUE, in this case we based these values on elm_spinner.
481 *
482 * @skip ephysics_camera_body_track(camera, body
483 * @until }
484 *
485 * @section add-uptfloor Updating the floor
486 *
487 * Here we'll use 2 floor images to give the impression of an infinite ground.
488 *
489 * Calling ephysics_world_event_callback_add()
490 * will register a callback to a type of physics world event.
491 *
492 * @ref EPHYSICS_CALLBACK_WORLD_CAMERA_MOVED : called if the camera position
493 * changed on physics simulation tick.
494 *
495 * @skip ephysics_world_event_callback_add(world,
496 * @until _camera_moved_cb, track_data);
497 *
498 * In the function, we'll get the cameras position to know how much the camera
499 * moved and move the same value to the floor passing it as delta_x to the
500 * function, note that we use an old_x variable to do this calculation.
501 *
502 * We'll get also if the body is being tracked on x and y axes. If the body
503 * isn't being tracked on x axis the floors x position won't change, delta_x
504 * will be zero.
505 *
506 * @dontinclude test_camera_track.c
507 *
508 * @skip _camera_moved_cb(void *data
509 * @until }
510 *
511 * Here we get the floors position and plus the delta_x value to move the
512 * floor in the same "velocity".
513 *
514 * @dontinclude test_camera_track.c
515 *
516 * @skip _update_floor
517 * @until fx = x + delta
518 *
519 * We use 2 floor images because whenever one exits the screen by the left
520 * side, another is being shown, when it happens the one which exit the screen
521 * is sent to the right side, entering into an infinite loop, giving the
522 * impression of an infinite ground image. Its important to note that we need
523 * to use the fx to don't gap the images.
524 *
525 * Note that the fy is being defined considering its offsets, -20 is to the
526 * floor image be above the floor, thus having an border above the collision
527 * point, +40 is the render area height, to offset the cameras y, basically
528 * to draw in the correct position in the canvas.
529 *
530 * @skip if (fx < -FLOOR_WIDTH
531 * @until }
532 *
533 * Here we finish the example. The full source code can be found at
534 * @ref test_camera_track_c.
535 *
536 */
537
538 /**
539 * @page test_camera_track_c test_camera_track.c
540 *
541 * @section ephysics-test-h ephysics_test.h
542 * @include ephysics_test.h
543 *
544 * @section test-camera-track-c test_camera_track.c
545 * @dontinclude test.c
546 *
547 * @skip test_clean
548 * @until }
549 *
550 * @skip test_win_add
551 * @until }
552 *
553 * @include test_camera_track.c
554 *
555 * @example test_camera_track.c
556 */
557
558/**
425 * @page tutorial_ephysics_collision_detection EPhysics - Collision Detection 559 * @page tutorial_ephysics_collision_detection EPhysics - Collision Detection
426 * 560 *
427 * The purpose of this example is to demonstrate the EPhysics Collision 561 * The purpose of this example is to demonstrate the EPhysics Collision