comparison src/shape_text.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 98c83441d7d6
children c7e5b8779bb5
comparison
equal deleted inserted replaced
158:c1cdd3fcd28f 159:b90abd31a281
30 if(text->scaled_font) 30 if(text->scaled_font)
31 cairo_scaled_font_destroy(text->scaled_font); 31 cairo_scaled_font_destroy(text->scaled_font);
32 cairo_font_face_destroy(text->face); 32 cairo_font_face_destroy(text->face);
33 } 33 }
34 34
35 shape_t *sh_text_new(const char *txt, co_aix x, co_aix y, 35 shape_t *rdman_shape_text_new(redraw_man_t *rdman,
36 co_aix font_size, cairo_font_face_t *face) { 36 const char *txt, co_aix x, co_aix y,
37 co_aix font_size, cairo_font_face_t *face) {
37 sh_text_t *text; 38 sh_text_t *text;
38 39
39 text = (sh_text_t *)malloc(sizeof(sh_text_t)); 40 text = (sh_text_t *)malloc(sizeof(sh_text_t));
40 if(text == NULL) 41 if(text == NULL)
41 return NULL; 42 return NULL;
53 cairo_font_face_reference(face); 54 cairo_font_face_reference(face);
54 text->face = face; 55 text->face = face;
55 text->flags |= TXF_SCALE_DIRTY; 56 text->flags |= TXF_SCALE_DIRTY;
56 57
57 text->shape.free = sh_text_free; 58 text->shape.free = sh_text_free;
59
60 rdman_shape_man(rdman, (shape_t *)text);
58 61
59 return (shape_t *)text; 62 return (shape_t *)text;
60 } 63 }
61 64
62 extern void sh_text_set_text(shape_t *shape, const char *txt) { 65 extern void sh_text_set_text(shape_t *shape, const char *txt) {