Moved Rect and Color to Core/objects
[sdlgit/SDL_perl.git] / src / Core / objects / 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
05eb21df 11MODULE = SDL::Rect PACKAGE = SDL::Rect PREFIX = rect_
8bd94773 12
05eb21df 13=for documentation
8bd94773 14
05eb21df 15SDL_Rect -- Defines a rectangular area
16
17 typedef struct{
18 Sint16 x, y;
19 Uint16 w, h;
20 } SDL_Rect;
21
22=cut
8bd94773 23
24SDL_Rect *
2daadb0f 25rect_new (CLASS, x, y, w, h)
8bd94773 26 char* CLASS
2daadb0f 27 Sint16 x
28 Sint16 y
29 Uint16 w
30 Uint16 h
8bd94773 31 CODE:
32 RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect));
2daadb0f 33 RETVAL->x = x;
34 RETVAL->y = y;
35 RETVAL->w = w;
36 RETVAL->h = h;
8bd94773 37 OUTPUT:
38 RETVAL
39
8bd94773 40Sint16
05eb21df 41rect_x ( rect, ... )
8bd94773 42 SDL_Rect *rect
43 CODE:
44 if (items > 1 ) rect->x = SvIV(ST(1));
45 RETVAL = rect->x;
46 OUTPUT:
47 RETVAL
48
49Sint16
05eb21df 50rect_y ( rect, ... )
8bd94773 51 SDL_Rect *rect
52 CODE:
53 if (items > 1 ) rect->y = SvIV(ST(1));
54 RETVAL = rect->y;
55 OUTPUT:
56 RETVAL
57
58Uint16
05eb21df 59rect_w ( rect, ... )
8bd94773 60 SDL_Rect *rect
61 CODE:
62 if (items > 1 ) rect->w = SvIV(ST(1));
63 RETVAL = rect->w;
64 OUTPUT:
65 RETVAL
66
67Uint16
05eb21df 68rect_h ( rect, ... )
8bd94773 69 SDL_Rect *rect
70 CODE:
71 if (items > 1 ) rect->h = SvIV(ST(1));
72 RETVAL = rect->h;
73 OUTPUT:
74 RETVAL
75
76
77void
2daadb0f 78rect_DESTROY(self)
8bd94773 79 SDL_Rect *self
80 CODE:
8bd94773 81 safefree( (char *)self );