comparison src/animate.c @ 47:f3818d996f4f

change interface of creating a animation action
author Thinker K.F. Li <thinker@branda.to>
date Sat, 09 Aug 2008 16:41:33 +0800
parents 46b77c92d118
children bdf711cbf0fb
comparison
equal deleted inserted replaced
46:46b77c92d118 47:f3818d996f4f
118 MB_TIMEVAL_CP(&word->start_time, start); 118 MB_TIMEVAL_CP(&word->start_time, start);
119 MB_TIMEVAL_CP(&word->playing_time, playing); 119 MB_TIMEVAL_CP(&word->playing_time, playing);
120 return word; 120 return word;
121 } 121 }
122 122
123 void mb_word_add_action(mb_word_t *word, mb_action_t *act) { 123 static void mb_word_add_action(mb_word_t *word, mb_action_t *act) {
124 STAILQ_INS_TAIL(word->actions, mb_action_t, next, act); 124 STAILQ_INS_TAIL(word->actions, mb_action_t, next, act);
125 } 125 }
126 126
127 static void mb_word_start(mb_word_t *word, const mb_timeval_t *tmo, 127 static void mb_word_start(mb_word_t *word, const mb_timeval_t *tmo,
128 const mb_timeval_t *now, redraw_man_t *rdman) { 128 const mb_timeval_t *now, redraw_man_t *rdman) {
321 321
322 static void mb_shift_free(mb_action_t *act) { 322 static void mb_shift_free(mb_action_t *act) {
323 free(act); 323 free(act);
324 } 324 }
325 325
326 mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord) { 326 mb_action_t *mb_shift_new(co_aix x, co_aix y, coord_t *coord,
327 mb_word_t *word) {
327 mb_shift_t *shift; 328 mb_shift_t *shift;
328 329
329 shift = (mb_shift_t *)malloc(sizeof(mb_shift_t)); 330 shift = (mb_shift_t *)malloc(sizeof(mb_shift_t));
330 if(shift == NULL) 331 if(shift == NULL)
331 return (mb_action_t *)shift; 332 return (mb_action_t *)shift;
337 shift->action.start = mb_shift_start; 338 shift->action.start = mb_shift_start;
338 shift->action.step = mb_shift_step; 339 shift->action.step = mb_shift_step;
339 shift->action.stop = mb_shift_stop; 340 shift->action.stop = mb_shift_stop;
340 shift->action.free = mb_shift_free; 341 shift->action.free = mb_shift_free;
341 342
343 mb_word_add_action(word, (mb_action_t *)shift);
344
342 return (mb_action_t *)shift; 345 return (mb_action_t *)shift;
343 } 346 }