Commit | Line | Data |
3e3f41ee |
1 | #include "EXTERN.h" |
2 | #include "perl.h" |
3 | #include "XSUB.h" |
4 | |
5 | #ifndef aTHX_ |
6 | #define aTHX_ |
7 | #endif |
8 | |
9 | #include <SDL.h> |
10 | |
11 | MODULE = SDL::Color PACKAGE = SDL::Color PREFIX = color_ |
12 | |
13 | =for documentation |
14 | |
15 | SDL_Color -- Format independent color description |
16 | |
17 | typedef struct{ |
18 | Uint8 r; |
19 | Uint8 g; |
20 | Uint8 b; |
21 | Uint8 unused; |
22 | } SDL_Color; |
23 | |
24 | =cut |
25 | |
26 | SDL_Color * |
27 | color_new (CLASS, r, g, b ) |
28 | char* CLASS |
29 | Uint8 r |
30 | Uint8 g |
31 | Uint8 b |
32 | CODE: |
33 | RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color)); |
34 | RETVAL->r = r; |
35 | RETVAL->g = g; |
36 | RETVAL->b = b; |
37 | OUTPUT: |
38 | RETVAL |
39 | |
40 | Uint8 |
41 | color_r ( color, ... ) |
42 | SDL_Color *color |
43 | CODE: |
44 | if (items > 1 ) color->r = SvIV(ST(1)); |
45 | RETVAL = color->r; |
46 | OUTPUT: |
47 | RETVAL |
48 | |
49 | Uint8 |
50 | color_g ( color, ... ) |
51 | SDL_Color *color |
52 | CODE: |
53 | if (items > 1 ) color->g = SvIV(ST(1)); |
54 | RETVAL = color->g; |
55 | OUTPUT: |
56 | RETVAL |
57 | |
58 | Uint8 |
59 | color_b ( color, ... ) |
60 | SDL_Color *color |
61 | CODE: |
62 | if (items > 1 ) color->b = SvIV(ST(1)); |
63 | RETVAL = color->b; |
64 | OUTPUT: |
65 | RETVAL |
66 | |
67 | void |
68 | color_DESTROY ( color ) |
69 | SDL_Color *color |
70 | CODE: |
71 | return; safefree(color); |
72 | |