Mercurial > MadButterfly
view src/visibility.c @ 151:d11aa8fc06c7
Fix bug of tanks do not show at right places.
Since we avoid to dirty a subtree if root of a subtree have been dirty or
hidden, it make children that was added into coord tree after a coord be
dirty do not be marked with COF_DIRTY flag. To fix it, when a new coord
is created, the parent is checked and mark new coord with COF_DIRTY flag
if the parent is dirty. It forces new coords to be cleaned and transformed
to right places.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Fri, 26 Sep 2008 17:42:16 +0800 |
parents | 1d74eb3861b7 |
children | c7e5b8779bb5 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "animate.h" typedef struct _mb_visibility mb_visibility_t; struct _mb_visibility { mb_action_t action; int visibility; coord_t *coord; }; static void mb_visibility_start(mb_action_t *act, const mb_timeval_t *now, const mb_timeval_t *playing_time, redraw_man_t *rdman) { mb_visibility_t *visibility = (mb_visibility_t *)act; switch(visibility->visibility) { case VIS_VISIBLE: coord_show(visibility->coord); break; case VIS_HIDDEN: coord_hide(visibility->coord); break; } rdman_coord_changed(rdman, visibility->coord); } static void mb_visibility_step(mb_action_t *act, const mb_timeval_t *now, redraw_man_t *rdman) { } static void mb_visibility_stop(mb_action_t *act, const mb_timeval_t *now, redraw_man_t *rdman) { } static void mb_visibility_free(mb_action_t *act) { free(act); } mb_action_t *mb_visibility_new(int visib, coord_t *coord, mb_word_t *word) { mb_visibility_t *visibility; visibility = (mb_visibility_t *)malloc(sizeof(mb_visibility_t)); if(visibility == NULL) return NULL; visibility->visibility = visib; visibility->coord = coord; visibility->action.start = mb_visibility_start; visibility->action.step = mb_visibility_step; visibility->action.stop = mb_visibility_stop; visibility->action.free = mb_visibility_free; mb_word_add_action(word, (mb_action_t *)visibility); return (mb_action_t *)visibility; }