PageRenderTime 17ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Core/objects/Rect.xs

http://github.com/PerlGameDev/SDL
Unknown | 83 lines | 69 code | 14 blank | 0 comment | 0 complexity | 60894e7b1e54859b67e7b27a90655dac MD5 | raw file
 1#include "EXTERN.h"
 2#include "perl.h"
 3#include "XSUB.h"
 4#include "ppport.h"
 5#include "helper.h"
 6
 7#ifndef aTHX_
 8#define aTHX_
 9#endif
10
11#include <SDL.h>
12
13MODULE = SDL::Rect 	PACKAGE = SDL::Rect    PREFIX = rect_
14
15=for documentation
16
17SDL_Rect -- Defines a rectangular area
18
19  typedef struct{
20    Sint16 x, y;
21    Uint16 w, h;
22  } SDL_Rect;
23
24=cut
25
26SDL_Rect *
27rect_new (CLASS, x, y, w, h)
28	char* CLASS
29	Sint16 x
30        Sint16 y
31        Uint16 w
32        Uint16 h
33	CODE:
34		RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect));
35		RETVAL->x = x;
36		RETVAL->y = y;
37		RETVAL->w = w;
38		RETVAL->h = h;
39	OUTPUT:
40		RETVAL
41
42Sint16
43rect_x ( rect, ... )
44	SDL_Rect *rect
45	CODE:
46		if (items > 1 ) rect->x = SvIV(ST(1)); 
47		RETVAL = rect->x;
48	OUTPUT:
49		RETVAL
50
51Sint16
52rect_y ( rect, ... )
53	SDL_Rect *rect
54	CODE:
55		if (items > 1 ) rect->y = SvIV(ST(1)); 
56		RETVAL = rect->y;
57	OUTPUT:
58		RETVAL
59
60Uint16
61rect_w ( rect, ... )
62	SDL_Rect *rect
63	CODE:
64		if (items > 1 ) rect->w = SvIV(ST(1)); 
65		RETVAL = rect->w;
66	OUTPUT:
67		RETVAL
68
69Uint16
70rect_h ( rect, ... )
71	SDL_Rect *rect
72	CODE:
73		if (items > 1 ) rect->h = SvIV(ST(1)); 
74		RETVAL = rect->h;
75	OUTPUT:
76		RETVAL
77
78
79void
80rect_DESTROY(bag)
81	SV *bag
82	CODE:
83		objDESTROY(bag, safefree);