I think a part of my soul died when I had to cast a const foo * to a foo * :(
[sdlgit/SDL_perl.git] / src / Core / Video.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 MODULE = SDL::Video     PACKAGE = SDL::Video    PREFIX = video_
12
13 =for documentation
14
15 The Following are XS bindings to the Video category in the SDL API v2.1.13
16
17 Describe on the SDL API site.
18
19 See: L<http://www.libsdl.org/cgi/docwiki.cgi/SDL_API#head-813f033ec44914f267f32195aba7d9aff8c410c0>
20
21 =cut
22
23 SDL_Surface *
24 video_get_video_surface()
25         PREINIT:
26                 char* CLASS = "SDL::Surface";
27         CODE:
28                 RETVAL = SDL_GetVideoSurface();
29         OUTPUT:
30                 RETVAL
31
32
33 SDL_VideoInfo*
34 video_get_video_info()
35         PREINIT:
36                 char* CLASS = "SDL::VideoInfo";
37         CODE:
38                 RETVAL = (SDL_VideoInfo *) SDL_GetVideoInfo();
39
40         OUTPUT:
41                 RETVAL
42
43 char *
44 video_video_driver_name( maxlen )
45         int maxlen
46         CODE:
47                 char* buffer = safemalloc(sizeof(char) * maxlen);
48                 char* str = SvPV( newSVpvn( buffer , maxlen), maxlen );
49
50                 RETVAL = (char* )SDL_VideoDriverName( str , maxlen);
51                 sv_2mortal(buffer);
52                 sv_2mortal(str);                
53                 
54         OUTPUT:
55                 RETVAL