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