Mercurial > MadButterfly
comparison include/mb_animate.h @ 186:530bb7728546 include_mb_test
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
This is the solution that I dicussed with FourDollars, last night.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 05 Nov 2008 15:24:01 +0800 |
parents | include/mb/animate.h@c7e5b8779bb5 |
children | 54fdc2a65242 |
comparison
equal
deleted
inserted
replaced
185:c7e5b8779bb5 | 186:530bb7728546 |
---|---|
1 #ifndef __ANIMATE_H_ | |
2 #define __ANIMATE_H_ | |
3 | |
4 #include "mb_types.h" | |
5 #include "mb_timer.h" | |
6 #include "mb_paint.h" | |
7 | |
8 /*! \page def_action How to Define An Action? | |
9 * | |
10 * A action must implement following 4 functions. | |
11 * \li start, | |
12 * \li step, | |
13 * \li stop, | |
14 * \li free, | |
15 * \li *_new(), and | |
16 * \li add *_new() to \ref animate.h . | |
17 * | |
18 * *_new() must invokes mb_word_add_action() to add new object | |
19 * as one of actions in the word specified as an argument of it. | |
20 * It also means *_new() must have an argument with type of | |
21 * (mb_word_t *). | |
22 */ | |
23 | |
24 /*! \defgroup anim Animation | |
25 * \brief Animation is a set of functions to make graph moving. | |
26 * @{ | |
27 */ | |
28 typedef struct _mb_progm mb_progm_t; | |
29 typedef struct _mb_word mb_word_t; | |
30 typedef struct _mb_action mb_action_t; | |
31 | |
32 struct _mb_progm_complete { | |
33 event_t event; | |
34 mb_progm_t *progm; | |
35 }; | |
36 typedef struct _mb_progm_complete mb_progm_complete_t; | |
37 | |
38 extern mb_progm_t *mb_progm_new(int max_words, redraw_man_t *rdman); | |
39 extern void mb_progm_free(mb_progm_t *progm); | |
40 extern mb_word_t *mb_progm_next_word(mb_progm_t *progm, | |
41 const mb_timeval_t *start, | |
42 const mb_timeval_t *playing); | |
43 extern void mb_progm_start(mb_progm_t *progm, mb_tman_t *tman, | |
44 mb_timeval_t *now); | |
45 extern void mb_progm_abort(mb_progm_t *progm); | |
46 extern subject_t *mb_progm_get_complete(mb_progm_t *progm); | |
47 | |
48 /*! \defgroup ani_actions Animation Actions | |
49 * @{ | |
50 */ | |
51 extern mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord, | |
52 mb_word_t *word); | |
53 extern mb_action_t *mb_chgcolor_new(co_comp_t r, co_comp_t g, | |
54 co_comp_t b, co_comp_t a, | |
55 paint_t *paint, mb_word_t *word); | |
56 extern mb_action_t *mb_rotate_new(float angle1, float angle2, | |
57 coord_t *coord, mb_word_t *word); | |
58 | |
59 enum { VIS_VISIBLE, VIS_HIDDEN }; | |
60 extern mb_action_t *mb_visibility_new(int visib, coord_t *coord, | |
61 mb_word_t *word); | |
62 /* @} */ | |
63 | |
64 /*! \defgroup act_support Action Supports. | |
65 * @{ | |
66 */ | |
67 /*! \brief Basic class of animation actions. | |
68 * | |
69 * \sa \ref def_action | |
70 */ | |
71 struct _mb_action { | |
72 void (*start)(mb_action_t *act, | |
73 const mb_timeval_t *now, | |
74 const mb_timeval_t *playing_time, | |
75 redraw_man_t *rdman); | |
76 void (*step)(mb_action_t *act, const mb_timeval_t *now, | |
77 redraw_man_t *rdman); | |
78 void (*stop)(mb_action_t *act, const mb_timeval_t *now, | |
79 redraw_man_t *rdman); | |
80 void (*free)(mb_action_t *act); | |
81 mb_action_t *next; | |
82 }; | |
83 | |
84 extern void mb_word_add_action(mb_word_t *word, mb_action_t *act); | |
85 /* @} */ | |
86 | |
87 /* @} */ | |
88 | |
89 #endif /* __ANIMATE_H_ */ |