Mercurial > MadButterfly
comparison src/shape_rect.c @ 73:9ab15ebc9061
Observer for mouse events
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 18 Aug 2008 01:59:26 +0800 |
parents | e292beec12d4 |
children | b90abd31a281 |
comparison
equal
deleted
inserted
replaced
72:171a8cb7e4b5 | 73:9ab15ebc9061 |
---|---|
9 co_aix x, y; | 9 co_aix x, y; |
10 co_aix w, h; | 10 co_aix w, h; |
11 co_aix rx, ry; | 11 co_aix rx, ry; |
12 co_aix poses[12][2]; | 12 co_aix poses[12][2]; |
13 } sh_rect_t; | 13 } sh_rect_t; |
14 | |
15 static void sh_rect_free(shape_t *shape) { | |
16 free(shape); | |
17 } | |
14 | 18 |
15 shape_t *sh_rect_new(co_aix x, co_aix y, co_aix w, co_aix h, | 19 shape_t *sh_rect_new(co_aix x, co_aix y, co_aix w, co_aix h, |
16 co_aix rx, co_aix ry) { | 20 co_aix rx, co_aix ry) { |
17 sh_rect_t *rect; | 21 sh_rect_t *rect; |
18 | 22 |
27 rect->y = y; | 31 rect->y = y; |
28 rect->w = w; | 32 rect->w = w; |
29 rect->h = h; | 33 rect->h = h; |
30 rect->rx = rx; | 34 rect->rx = rx; |
31 rect->ry = ry; | 35 rect->ry = ry; |
36 rect->shape.free = sh_rect_free; | |
32 | 37 |
33 return (shape_t *)rect; | 38 return (shape_t *)rect; |
34 } | |
35 | |
36 void sh_rect_free(shape_t *shape) { | |
37 free(shape); | |
38 } | 39 } |
39 | 40 |
40 void sh_rect_set(shape_t *shape, co_aix x, co_aix y, | 41 void sh_rect_set(shape_t *shape, co_aix x, co_aix y, |
41 co_aix w, co_aix h, co_aix rx, co_aix ry) { | 42 co_aix w, co_aix h, co_aix rx, co_aix ry) { |
42 sh_rect_t *rect = (sh_rect_t *)shape; | 43 sh_rect_t *rect = (sh_rect_t *)shape; |