annotate src/animate.h @ 121:76ba6fd61c7d

More bug of insert sort. elms[i] is over wrote by elms[i-1]. Save it to a local variable at start of loop iteration for elms[i].
author Thinker K.F. Li <thinker@branda.to>
date Sun, 14 Sep 2008 23:40:57 +0800
parents e4e47d2cdbcd
children 9e2316dc6ecb
rev   line source
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #ifndef __ANIMATE_H_
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #define __ANIMATE_H_
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
4 #include "mb_types.h"
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
5 #include "mb_timer.h"
52
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 47
diff changeset
6 #include "paint.h"
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
7
117
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
8 /*! \page def_action How to Define An Action?
116
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
9 *
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
10 * A action must implement following 4 functions.
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
11 * \li start,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
12 * \li step,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
13 * \li stop,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
14 * \li free, and
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
15 * \li *_new().
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
16 *
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
17 * *_new() must invokes mb_word_add_action() to add new object
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
18 * as one of actions in the word specified as an argument of it.
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
19 * It also means *_new() must have an argument with type of
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
20 * (mb_word_t *).
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
21 */
117
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
22
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
23 /*! \defgroup anim Animation
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
24 * \brief Animation is a set of functions to make graph moving.
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
25 * @{
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
26 */
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
27 typedef struct _mb_progm mb_progm_t;
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
28 typedef struct _mb_word mb_word_t;
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
29 typedef struct _mb_action mb_action_t;
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
30
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
31 /*! \defgroup act_support Action Supports.
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
32 * @{
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
33 */
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
34 /*! \brief Basic class of nnimation actions.
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
35 *
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
36 * \sa \ref def_action
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
37 */
116
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
38 struct _mb_action {
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
39 void (*start)(mb_action_t *act,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
40 const mb_timeval_t *now,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
41 const mb_timeval_t *playing_time,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
42 redraw_man_t *rdman);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
43 void (*step)(mb_action_t *act, const mb_timeval_t *now,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
44 redraw_man_t *rdman);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
45 void (*stop)(mb_action_t *act, const mb_timeval_t *now,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
46 redraw_man_t *rdman);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
47 void (*free)(mb_action_t *act);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
48 mb_action_t *next;
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
49 };
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
50
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
51 extern void mb_word_add_action(mb_word_t *word, mb_action_t *act);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
52 /* @} */
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
53
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 extern mb_progm_t *mb_progm_new(int max_words, redraw_man_t *rdman);
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
55 extern void mb_progm_free(mb_progm_t *progm);
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
56 extern mb_word_t *mb_progm_next_word(mb_progm_t *progm,
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
57 const mb_timeval_t *start,
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 const mb_timeval_t *playing);
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
59 extern void mb_progm_start(mb_progm_t *progm, mb_tman_t *tman,
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
60 mb_timeval_t *now);
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
61 extern void mb_progm_abort(mb_progm_t *progm, mb_tman_t *tman);
104
Thinker K.F. Li <thinker@branda.to>
parents: 101
diff changeset
62 /*! \defgroup ani_actions Animation Actions
Thinker K.F. Li <thinker@branda.to>
parents: 101
diff changeset
63 * @{
Thinker K.F. Li <thinker@branda.to>
parents: 101
diff changeset
64 */
47
f3818d996f4f change interface of creating a animation action
Thinker K.F. Li <thinker@branda.to>
parents: 42
diff changeset
65 extern mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord,
f3818d996f4f change interface of creating a animation action
Thinker K.F. Li <thinker@branda.to>
parents: 42
diff changeset
66 mb_word_t *word);
52
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 47
diff changeset
67 extern mb_action_t *mb_chgcolor_new(co_comp_t r, co_comp_t g,
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 47
diff changeset
68 co_comp_t b, co_comp_t a,
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 47
diff changeset
69 paint_t *paint, mb_word_t *word);
117
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
70 extern mb_action_t *mb_rotate_new(float angle1, float angle2,
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
71 coord_t *coord, mb_word_t *word);
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
72
57
ab028c9f0930 Ability to hidden shapes and action of visibility.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
73 enum { VIS_VISIBLE, VIS_HIDDEN };
ab028c9f0930 Ability to hidden shapes and action of visibility.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
74 extern mb_action_t *mb_visibility_new(int visib, coord_t *coord,
ab028c9f0930 Ability to hidden shapes and action of visibility.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
75 mb_word_t *word);
104
Thinker K.F. Li <thinker@branda.to>
parents: 101
diff changeset
76 /* @} */
57
ab028c9f0930 Ability to hidden shapes and action of visibility.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
77
101
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 57
diff changeset
78 /* @} */
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
80 #endif /* __ANIMATE_H_ */