Mercurial > MadButterfly
comparison src/shape_rect.c @ 159:b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
- Life-cycle of shapes and paints are managed by rdman.
- Add redraw_man_t::free_objs to collect objects their freeing are
postonsed.
Know Issue:
- Bullet of tank are not removed from screen when it is go out the range
of the map.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 05 Oct 2008 23:32:58 +0800 |
parents | 9ab15ebc9061 |
children | c7e5b8779bb5 |
comparison
equal
deleted
inserted
replaced
158:c1cdd3fcd28f | 159:b90abd31a281 |
---|---|
14 | 14 |
15 static void sh_rect_free(shape_t *shape) { | 15 static void sh_rect_free(shape_t *shape) { |
16 free(shape); | 16 free(shape); |
17 } | 17 } |
18 | 18 |
19 shape_t *sh_rect_new(co_aix x, co_aix y, co_aix w, co_aix h, | 19 shape_t *rdman_shape_rect_new(redraw_man_t *rdman, |
20 co_aix rx, co_aix ry) { | 20 co_aix x, co_aix y, co_aix w, co_aix h, |
21 co_aix rx, co_aix ry) { | |
21 sh_rect_t *rect; | 22 sh_rect_t *rect; |
22 | 23 |
23 rect = (sh_rect_t *)malloc(sizeof(sh_rect_t)); | 24 rect = (sh_rect_t *)malloc(sizeof(sh_rect_t)); |
24 if(rect == NULL) | 25 if(rect == NULL) |
25 return NULL; | 26 return NULL; |
32 rect->w = w; | 33 rect->w = w; |
33 rect->h = h; | 34 rect->h = h; |
34 rect->rx = rx; | 35 rect->rx = rx; |
35 rect->ry = ry; | 36 rect->ry = ry; |
36 rect->shape.free = sh_rect_free; | 37 rect->shape.free = sh_rect_free; |
38 | |
39 rdman_shape_man(rdman, (shape_t *)rect); | |
37 | 40 |
38 return (shape_t *)rect; | 41 return (shape_t *)rect; |
39 } | 42 } |
40 | 43 |
41 void sh_rect_set(shape_t *shape, co_aix x, co_aix y, | 44 void sh_rect_set(shape_t *shape, co_aix x, co_aix y, |