Mercurial > MadButterfly
comparison src/animate.c @ 117:e4e47d2cdbcd
Tank
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 14 Sep 2008 18:51:16 +0800 |
parents | 1d74eb3861b7 |
children | 257a1d314bcd |
comparison
equal
deleted
inserted
replaced
116:1d74eb3861b7 | 117:e4e47d2cdbcd |
---|---|
1 /*! \file | 1 /*! \file |
2 * \brief Animation tools. | 2 * \brief Animation tools. |
3 * | 3 * |
4 * \sa ani | 4 * \sa \ref ani |
5 */ | 5 */ |
6 /*! \page ani What is Animation? | 6 /*! \page ani What is Animation? |
7 * | |
8 * Animation is a program to move, resize, rotate, ..., changing | |
9 * graphics on the output screen. | |
10 * | |
11 * \image html program.png | |
7 * | 12 * |
8 * XXX: Program is a sequence of actions duration a perior. | 13 * XXX: Program is a sequence of actions duration a perior. |
9 * Actions are grouped into words. A program defines | 14 * Actions are grouped into words. A program defines |
10 * the order and time of playing of words. A word | 15 * the order and time of playing of words. A word |
11 * defines how long to perform a set of actions. Actions | 16 * defines how long to perform a set of actions. Actions |
20 * | 25 * |
21 * A program is driven by a timer. Once a program is started, it registers | 26 * A program is driven by a timer. Once a program is started, it registers |
22 * with timer for periodic running. \ref mb_tman_t is timer of | 27 * with timer for periodic running. \ref mb_tman_t is timer of |
23 * MadButterfly. The update frequence is 10fps by default, now. | 28 * MadButterfly. The update frequence is 10fps by default, now. |
24 * | 29 * |
25 * \sa animate.c | 30 * \section use_progm How to Use Animation Program? |
31 * Following code block creates a program with 2 words. First word is | |
32 * started immediately after the program been started. It is consisted | |
33 * for 1 second. Second word is started 1 second after the program been | |
34 * started. It is consisted for 2 seconds. There are 2 action in | |
35 * first word, they shift graphics managed by coord1 & coord2 by (50,50) and | |
36 * (-50,50) pixels, respectly. The shifting is performed incrementally | |
37 * in 1 second. Second word shifts coord1 and coord2, too. And, graphics | |
38 * managed by coord3 are hidden at end of the word. At end of code in the | |
39 * block, mb_progm_start() starts the program. 3rd argument of | |
40 * mb_progm_start() must be current wall time. | |
41 * | |
42 * \code | |
43 * progm = mb_progm_new(10, &rdman); | |
44 * | |
45 * MB_TIMEVAL_SET(&start, 0, 0); | |
46 * MB_TIMEVAL_SET(&playing, 1, 0); | |
47 * word = mb_progm_next_word(progm, &start, &playing); | |
48 * | |
49 * act = mb_shift_new(50, 50, coord1, word); | |
50 * act = mb_shift_new(-50, 50, coord2, word); | |
51 * | |
52 * MB_TIMEVAL_SET(&start, 1, 0); | |
53 * MB_TIMEVAL_SET(&playing, 2, 0); | |
54 * word = mb_progm_next_word(progm, &start, &playing); | |
55 * | |
56 * act = mb_shift_new(0, 20, coord1, word); | |
57 * act = mb_shift_new(0, -20, coord2, word); | |
58 * act = mb_visibility_new(VIS_HIDDEN, coord3, word); | |
59 * | |
60 * gettimeofday(&tv, NULL); | |
61 * MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec); | |
62 * mb_progm_start(progm, tman, &mbtv); | |
63 * \endcode | |
64 * | |
65 * | |
66 * \sa \ref animate.c | |
26 */ | 67 */ |
27 #include <stdio.h> | 68 #include <stdio.h> |
28 #include <stdlib.h> | 69 #include <stdlib.h> |
29 #include <string.h> | 70 #include <string.h> |
30 #include "mb_types.h" | 71 #include "mb_types.h" |