annotate include/mb_animate.h @ 934:5dedeedf0408

Change page of "How to Defaine a Backend"
author Thinker K.F. Li <thinker@codemud.net>
date Thu, 11 Nov 2010 00:56:51 +0800
parents 586e50f82c1f
children 9b5d4839c5bb
rev   line source
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 194
diff changeset
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 194
diff changeset
2 // vim: sw=4:ts=8:sts=4
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 #ifndef __ANIMATE_H_
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #define __ANIMATE_H_
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
6 #include "mb_types.h"
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
7 #include "mb_timer.h"
186
530bb7728546 Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents: 185
diff changeset
8 #include "mb_paint.h"
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
9
117
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
10 /*! \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
11 *
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
12 * 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
13 * \li start,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
14 * \li step,
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
15 * \li stop,
130
3a4d6179e6a9 change mb_c_source.m4 and mb_c_header.m4 to specify parent for SVG object
Thinker K.F. Li <thinker@branda.to>
parents: 123
diff changeset
16 * \li free,
3a4d6179e6a9 change mb_c_source.m4 and mb_c_header.m4 to specify parent for SVG object
Thinker K.F. Li <thinker@branda.to>
parents: 123
diff changeset
17 * \li *_new(), and
3a4d6179e6a9 change mb_c_source.m4 and mb_c_header.m4 to specify parent for SVG object
Thinker K.F. Li <thinker@branda.to>
parents: 123
diff changeset
18 * \li add *_new() to \ref animate.h .
116
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
19 *
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
20 * *_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
21 * 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
22 * 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
23 * (mb_word_t *).
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
24 */
117
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
25
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
26 /*! \defgroup anim Animation
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
27 * \brief Animation is a set of functions to make graph moving.
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
28 * @{
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
29 */
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
30 typedef struct _mb_progm mb_progm_t;
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
31 typedef struct _mb_word mb_word_t;
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
32 typedef struct _mb_action mb_action_t;
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
33
123
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
34 struct _mb_progm_complete {
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
35 event_t event;
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
36 mb_progm_t *progm;
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
37 };
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
38 typedef struct _mb_progm_complete mb_progm_complete_t;
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
39
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
40 extern mb_progm_t *mb_progm_new(int max_words, redraw_man_t *rdman);
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
41 extern void mb_progm_free(mb_progm_t *progm);
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
42 extern mb_word_t *mb_progm_next_word(mb_progm_t *progm,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
43 const mb_timeval_t *start,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
44 const mb_timeval_t *playing);
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
45 extern void mb_progm_start(mb_progm_t *progm, mb_tman_t *tman,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
46 mb_timeval_t *now);
153
9870b049b7f6 Make mb_progm_abort() work.
Thinker K.F. Li <thinker@branda.to>
parents: 130
diff changeset
47 extern void mb_progm_abort(mb_progm_t *progm);
123
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
48 extern subject_t *mb_progm_get_complete(mb_progm_t *progm);
192
54fdc2a65242 Remove factory from observer APIs.
Thinker K.F. Li <thinker@branda.to>
parents: 186
diff changeset
49 extern void mb_progm_free_completed(mb_progm_t *progm);
123
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
50
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
51 /*! \defgroup ani_actions Animation Actions
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
52 * @{
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
53 */
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
54 extern mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
55 mb_word_t *word);
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
56 extern mb_action_t *mb_chgcolor_new(co_comp_t r, co_comp_t g,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
57 co_comp_t b, co_comp_t a,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
58 paint_t *paint, mb_word_t *word);
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
59 extern mb_action_t *mb_rotate_new(float angle1, float angle2,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
60 coord_t *coord, mb_word_t *word);
194
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents: 192
diff changeset
61 extern mb_action_t *mb_subtree_free_new(coord_t *coord,
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents: 192
diff changeset
62 mb_word_t *word);
123
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
63
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
64 enum { VIS_VISIBLE, VIS_HIDDEN };
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
65 extern mb_action_t *mb_visibility_new(int visib, coord_t *coord,
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
66 mb_word_t *word);
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
67 /* @} */
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
68
117
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
69 /*! \defgroup act_support Action Supports.
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
70 * @{
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
71 */
123
9e2316dc6ecb Program completion events
Thinker K.F. Li <thinker@branda.to>
parents: 117
diff changeset
72 /*! \brief Basic class of animation actions.
117
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
73 *
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
74 * \sa \ref def_action
Thinker K.F. Li <thinker@branda.to>
parents: 116
diff changeset
75 */
116
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
76 struct _mb_action {
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
77 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
78 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
79 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
80 redraw_man_t *rdman);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
81 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
82 redraw_man_t *rdman);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
83 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
84 redraw_man_t *rdman);
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
85 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
86 mb_action_t *next;
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
87 };
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
88
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
89 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
90 /* @} */
1d74eb3861b7 move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents: 104
diff changeset
91
101
d6f9af55b0d0 More documentation.
Thinker K.F. Li <thinker@branda.to>
parents: 57
diff changeset
92 /* @} */
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
93
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
94 #endif /* __ANIMATE_H_ */