Mercurial > MadButterfly
comparison include/mb_types.h @ 250:bd8ea44b421e
Fix bug and finish unit test for collision testing in event.c.
- mock for cairo, rdman, coord, and shape should be refactoried to a module.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 04 Jan 2009 11:42:32 +0800 |
parents | 104d83378582 |
children | 50d253d0fcba |
comparison
equal
deleted
inserted
replaced
245:81458bb0bf34 | 250:bd8ea44b421e |
---|---|
106 #define GEF_FREE 0x4 | 106 #define GEF_FREE 0x4 |
107 #define GEF_OV_DRAW 0x8 /*!< To flag drawed for a overlay testing. */ | 107 #define GEF_OV_DRAW 0x8 /*!< To flag drawed for a overlay testing. */ |
108 | 108 |
109 extern int areas_are_overlay(area_t *r1, area_t *r2); | 109 extern int areas_are_overlay(area_t *r1, area_t *r2); |
110 extern void area_init(area_t *area, int n_pos, co_aix pos[][2]); | 110 extern void area_init(area_t *area, int n_pos, co_aix pos[][2]); |
111 #define _in_range(a, s, w) ((a) >= (s) && (a) < ((s) + (w))) | |
112 #define area_pos_is_in(area, _x, _y) \ | |
113 (_in_range(_x, (area)->x, (area)->w) && \ | |
114 _in_range(_y, (area)->y, (area)->h)) | |
111 extern void geo_init(geo_t *g); | 115 extern void geo_init(geo_t *g); |
112 extern void geo_from_positions(geo_t *g, int n_pos, co_aix pos[][2]); | 116 extern void geo_from_positions(geo_t *g, int n_pos, co_aix pos[][2]); |
113 extern void geo_mark_overlay(geo_t *g, int n_others, geo_t **others, | 117 extern void geo_mark_overlay(geo_t *g, int n_others, geo_t **others, |
114 int *n_overlays, geo_t **overlays); | 118 int *n_overlays, geo_t **overlays); |
115 #define geo_get_shape(g) ((g)->shape) | 119 #define geo_get_shape(g) ((g)->shape) |
116 #define geo_get_shape_safe(g) ((g)? (g)->shape: NULL) | 120 #define geo_get_shape_safe(g) ((g)? (g)->shape: NULL) |
117 #define geo_set_shape(g, sh) do {(g)->shape = sh;} while(0) | 121 #define geo_set_shape(g, sh) do {(g)->shape = sh;} while(0) |
118 #define _geo_is_in(a, s, w) ((a) >= (s) && (a) < ((s) + (w))) | 122 #define geo_pos_is_in(g, _x, _y) area_pos_is_in((g)->cur_area, _x, _y) |
119 #define geo_pos_is_in(g, _x, _y) \ | |
120 (_geo_is_in(_x, (g)->cur_area->x, (g)->cur_area->w) && \ | |
121 _geo_is_in(_y, (g)->cur_area->y, (g)->cur_area->h)) | |
122 #define geo_get_area(g) ((g)->cur_area) | 123 #define geo_get_area(g) ((g)->cur_area) |
123 #define geo_get_flags(g, mask) ((g)->flags & (mask)) | 124 #define geo_get_flags(g, mask) ((g)->flags & (mask)) |
124 #define geo_set_flags(g, mask) do {(g)->flags |= mask;} while(0) | 125 #define geo_set_flags(g, mask) do {(g)->flags |= mask;} while(0) |
125 #define geo_clear_flags(g, mask) do {(g)->flags &= ~(mask);} while(0) | 126 #define geo_clear_flags(g, mask) do {(g)->flags &= ~(mask);} while(0) |
126 | 127 |