Mercurial > MadButterfly
comparison src/mbaf/mbobject.c @ 922:152bc503dc99
Conditional compile for sh_text in mbaf
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 27 Oct 2010 00:41:25 +0800 |
parents | 586e50f82c1f |
children |
comparison
equal
deleted
inserted
replaced
921:c6481c41ac79 | 922:152bc503dc99 |
---|---|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- | 1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- |
2 // vim: sw=4:ts=8:sts=4 | 2 // vim: sw=4:ts=8:sts=4 |
3 #include "mb_types.h" | 3 #include "mb_types.h" |
4 #include "mb_obj.h" | 4 #include "mb_obj.h" |
5 #include "mb_config.h" | |
5 | 6 |
6 | 7 |
7 void mb_obj_set_pos(mb_obj_t *obj, co_aix x, co_aix y) | 8 void mb_obj_set_pos(mb_obj_t *obj, co_aix x, co_aix y) |
8 { | 9 { |
9 if (MBO_TYPE(obj) == MBO_COORD) { | 10 if (MBO_TYPE(obj) == MBO_COORD) { |
10 coord_x(((coord_t *) obj)) = x; | 11 coord_x(((coord_t *) obj)) = x; |
11 coord_y(((coord_t *) obj)) = y; | 12 coord_y(((coord_t *) obj)) = y; |
13 #ifdef SH_TEXT | |
12 } else if (MBO_TYPE(obj) == MBO_TEXT) { | 14 } else if (MBO_TYPE(obj) == MBO_TEXT) { |
13 sh_text_set_pos((shape_t *) obj, x, y); | 15 sh_text_set_pos((shape_t *) obj, x, y); |
16 #endif | |
14 } else { | 17 } else { |
15 return; | 18 return; |
16 } | 19 } |
17 | 20 |
18 } | 21 } |
20 void mb_obj_get_pos(mb_obj_t *obj, co_aix *x, co_aix *y) | 23 void mb_obj_get_pos(mb_obj_t *obj, co_aix *x, co_aix *y) |
21 { | 24 { |
22 if (MBO_TYPE(obj) == MBO_COORD) { | 25 if (MBO_TYPE(obj) == MBO_COORD) { |
23 *x = coord_x((coord_t *) obj); | 26 *x = coord_x((coord_t *) obj); |
24 *y = coord_y((coord_t *) obj); | 27 *y = coord_y((coord_t *) obj); |
28 #ifdef SH_TEXT | |
25 } else if (MBO_TYPE(obj) == MBO_TEXT) { | 29 } else if (MBO_TYPE(obj) == MBO_TEXT) { |
26 sh_text_get_pos((shape_t *) obj, x, y); | 30 sh_text_get_pos((shape_t *) obj, x, y); |
31 #endif | |
27 } else { | 32 } else { |
28 return; | 33 return; |
29 } | 34 } |
30 | 35 |
31 } | 36 } |
37 shape_t *shape; | 42 shape_t *shape; |
38 coord_t *g = (coord_t *) obj; | 43 coord_t *g = (coord_t *) obj; |
39 | 44 |
40 FOR_COORD_MEMBERS(g, geo) { | 45 FOR_COORD_MEMBERS(g, geo) { |
41 shape = geo_get_shape(geo); | 46 shape = geo_get_shape(geo); |
47 #ifdef SH_TEXT | |
42 if(shape->obj.obj_type == MBO_TEXT) { | 48 if(shape->obj.obj_type == MBO_TEXT) { |
43 sh_text_set_text(shape, text); | 49 sh_text_set_text(shape, text); |
44 return; | 50 return; |
45 } | 51 } |
52 #endif | |
46 } | 53 } |
54 #ifdef SH_TEXT | |
47 } else if (MBO_TYPE(obj) == MBO_TEXT) { | 55 } else if (MBO_TYPE(obj) == MBO_TEXT) { |
48 sh_text_set_text((shape_t *) obj,text); | 56 sh_text_set_text((shape_t *) obj,text); |
57 #endif | |
49 } else { | 58 } else { |
50 return; | 59 return; |
51 } | 60 } |
52 | 61 |
53 } | 62 } |
60 shape_t *shape; | 69 shape_t *shape; |
61 coord_t *g = (coord_t *) obj; | 70 coord_t *g = (coord_t *) obj; |
62 | 71 |
63 FOR_COORD_MEMBERS(g, geo) { | 72 FOR_COORD_MEMBERS(g, geo) { |
64 shape = geo_get_shape(geo); | 73 shape = geo_get_shape(geo); |
74 #ifdef SH_TEXT | |
65 if(shape->obj.obj_type == MBO_TEXT) { | 75 if(shape->obj.obj_type == MBO_TEXT) { |
66 sh_text_get_text(shape, text,size); | 76 sh_text_get_text(shape, text,size); |
67 return; | 77 return; |
68 } | 78 } |
79 #endif | |
69 } | 80 } |
81 #ifdef SH_TEXT | |
70 } else if (MBO_TYPE(obj) == MBO_TEXT) { | 82 } else if (MBO_TYPE(obj) == MBO_TEXT) { |
71 sh_text_get_text((shape_t *) obj,text,size); | 83 sh_text_get_text((shape_t *) obj,text,size); |
84 #endif | |
72 } else { | 85 } else { |
73 *text = 0; | 86 *text = 0; |
74 return; | 87 return; |
75 } | 88 } |
76 } | 89 } |