# HG changeset patch # User Thinker K.F. Li # Date 1218271293 -28800 # Node ID f3818d996f4f5ea7725ef8c126796621f1342de4 # Parent 46b77c92d11899e46e20b8509c7ce91addf6ee77 change interface of creating a animation action diff -r 46b77c92d118 -r f3818d996f4f src/X_main.c --- a/src/X_main.c Sat Aug 09 16:33:33 2008 +0800 +++ b/src/X_main.c Sat Aug 09 16:41:33 2008 +0800 @@ -306,24 +306,20 @@ MB_TIMEVAL_SET(&start, 1, 0); MB_TIMEVAL_SET(&playing, 2, 0); word = mb_progm_next_word(progm, &start, &playing); - act = mb_shift_new(0, 20, coord1); - mb_word_add_action(word, act); + act = mb_shift_new(0, 20, coord1, word); MB_TIMEVAL_SET(&start, 3, 0); MB_TIMEVAL_SET(&playing, 2, 0); - act = mb_shift_new(0, 20, coord2); - mb_word_add_action(word, act); + act = mb_shift_new(0, 20, coord2, word); MB_TIMEVAL_SET(&start, 3, 0); MB_TIMEVAL_SET(&playing, 2, 0); word = mb_progm_next_word(progm, &start, &playing); - act = mb_shift_new(0, -20, coord1); - mb_word_add_action(word, act); + act = mb_shift_new(0, -20, coord1, word); MB_TIMEVAL_SET(&start, 3, 0); MB_TIMEVAL_SET(&playing, 2, 0); - act = mb_shift_new(0, -20, coord2); - mb_word_add_action(word, act); + act = mb_shift_new(0, -20, coord2, word); gettimeofday(&tv, NULL); MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec); diff -r 46b77c92d118 -r f3818d996f4f src/animate.c --- a/src/animate.c Sat Aug 09 16:33:33 2008 +0800 +++ b/src/animate.c Sat Aug 09 16:41:33 2008 +0800 @@ -120,7 +120,7 @@ return word; } -void mb_word_add_action(mb_word_t *word, mb_action_t *act) { +static void mb_word_add_action(mb_word_t *word, mb_action_t *act) { STAILQ_INS_TAIL(word->actions, mb_action_t, next, act); } @@ -323,7 +323,8 @@ free(act); } -mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord) { +mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord, + mb_word_t *word) { mb_shift_t *shift; shift = (mb_shift_t *)malloc(sizeof(mb_shift_t)); @@ -339,5 +340,7 @@ shift->action.stop = mb_shift_stop; shift->action.free = mb_shift_free; + mb_word_add_action(word, (mb_action_t *)shift); + return (mb_action_t *)shift; } diff -r 46b77c92d118 -r f3818d996f4f src/animate.h --- a/src/animate.h Sat Aug 09 16:33:33 2008 +0800 +++ b/src/animate.h Sat Aug 09 16:41:33 2008 +0800 @@ -14,11 +14,11 @@ extern mb_word_t *mb_progm_next_word(mb_progm_t *progm, const mb_timeval_t *start, const mb_timeval_t *playing); -extern void mb_word_add_action(mb_word_t *word, mb_action_t *act); extern void mb_progm_start(mb_progm_t *progm, mb_tman_t *tman, mb_timeval_t *now); extern void mb_progm_abort(mb_progm_t *progm, mb_tman_t *tman); -extern mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord); +extern mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord, + mb_word_t *word); #endif /* __ANIMATE_H_ */