37ea400ac0313d4561e9072caaf4426ed6479642
[sdlgit/SDL_perl.git] / exp / SDL / Rect / Rect.xs
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
12
13 MODULE = Rect   PACKAGE = Rect
14
15
16 SDL_Rect *
17 NewRect ( x, y, w, h )
18         Sint16 x
19         Sint16 y
20         Uint16 w
21         Uint16 h
22         CODE:
23                 RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect));
24                 RETVAL->x = x;
25                 RETVAL->y = y;
26                 RETVAL->w = w;
27                 RETVAL->h = h;
28         OUTPUT:
29                 RETVAL
30
31 Sint16
32 RectX ( rect, ... )
33         SDL_Rect *rect
34         CODE:
35                 if (items > 1 ) rect->x = SvIV(ST(1)); 
36                 RETVAL = rect->x;
37         OUTPUT:
38                 RETVAL
39
40 Sint16
41 RectY ( rect, ... )
42         SDL_Rect *rect
43         CODE:
44                 if (items > 1 ) rect->y = SvIV(ST(1)); 
45                 RETVAL = rect->y;
46         OUTPUT:
47                 RETVAL
48
49 Uint16
50 RectW ( rect, ... )
51         SDL_Rect *rect
52         CODE:
53                 if (items > 1 ) rect->w = SvIV(ST(1)); 
54                 RETVAL = rect->w;
55         OUTPUT:
56                 RETVAL
57
58 Uint16
59 RectH ( rect, ... )
60         SDL_Rect *rect
61         CODE:
62                 if (items > 1 ) rect->h = SvIV(ST(1)); 
63                 RETVAL = rect->h;
64         OUTPUT:
65                 RETVAL
66
67 MODULE = Rect  PACKAGE = SDL_RectPtr  PREFIX = Rect_
68
69 void
70 Rect_DESTROY(rect)
71         SDL_Rect *rect
72         CODE:
73                 printf("RectPtr::DESTROY\n");
74                 safefree( rect );
75
76