Using Rect as Blessed but backward compatible constructor.
[sdlgit/SDL_perl.git] / src / Rect.xs
CommitLineData
8bd94773 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
2daadb0f 13MODULE = SDL::Rect PACKAGE = SDL::Rect PREFIX = rect_
8bd94773 14
15SDL_Rect *
2daadb0f 16rect_new (CLASS, x, y, w, h)
8bd94773 17 char* CLASS
2daadb0f 18 Sint16 x
19 Sint16 y
20 Uint16 w
21 Uint16 h
8bd94773 22 CODE:
23 RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect));
2daadb0f 24 RETVAL->x = x;
25 RETVAL->y = y;
26 RETVAL->w = w;
27 RETVAL->h = h;
8bd94773 28 OUTPUT:
29 RETVAL
30
31void
32SetRect(rect, x, y, w, h)
33 SDL_Rect *rect
34 Sint16 x
35 Sint16 y
36 Uint16 w
37 Uint16 h
38 CODE:
39 rect->x = x;
40 rect->y = y;
41 rect->w = w;
42 rect->h = h;
43
44
45Sint16
46RectX ( rect, ... )
47 SDL_Rect *rect
48 CODE:
49 if (items > 1 ) rect->x = SvIV(ST(1));
50 RETVAL = rect->x;
51 OUTPUT:
52 RETVAL
53
54Sint16
55RectY ( rect, ... )
56 SDL_Rect *rect
57 CODE:
58 if (items > 1 ) rect->y = SvIV(ST(1));
59 RETVAL = rect->y;
60 OUTPUT:
61 RETVAL
62
63Uint16
64RectW ( rect, ... )
65 SDL_Rect *rect
66 CODE:
67 if (items > 1 ) rect->w = SvIV(ST(1));
68 RETVAL = rect->w;
69 OUTPUT:
70 RETVAL
71
72Uint16
73RectH ( rect, ... )
74 SDL_Rect *rect
75 CODE:
76 if (items > 1 ) rect->h = SvIV(ST(1));
77 RETVAL = rect->h;
78 OUTPUT:
79 RETVAL
80
81
82void
2daadb0f 83rect_DESTROY(self)
8bd94773 84 SDL_Rect *self
85 CODE:
86 printf("RectPtr::DESTROY\n");
87 safefree( (char *)self );
88
89