3 #include <SDL/SDL_image.h>
4 #include <SDL/SDL_mixer.h>
5 #include "gacela_SDL.h"
8 gacela_SDL_Init (SCM flags)
10 return scm_from_int (SDL_Init (scm_to_int (flags)));
17 return SCM_UNSPECIFIED;
21 gacela_SDL_SetVideoMode (SCM width, SCM height, SCM bpp, SCM flags)
23 return scm_from_int ((int)SDL_SetVideoMode (scm_to_int (width), scm_to_int (height), \
24 scm_to_int (bpp), scm_to_int (flags)));
28 gacela_SDL_WM_SetCaption (SCM title, SCM icon)
30 SDL_WM_SetCaption (scm_to_locale_string(title), scm_to_locale_string(icon));
31 return SCM_UNSPECIFIED;
35 gacela_SDL_Flip (SCM screen)
37 return scm_from_int (SDL_Flip ((SDL_Surface *)scm_to_int (screen)));
41 gacela_SDL_FreeSurface (SCM surface)
43 SDL_FreeSurface ((SDL_Surface *)scm_to_int (surface));
44 return SCM_UNSPECIFIED;
48 gacela_SDL_Delay (SCM ms)
50 SDL_Delay (scm_to_int (ms));
51 return SCM_UNSPECIFIED;
55 gacela_SDL_GetTicks ()
57 return scm_from_int (SDL_GetTicks ());
61 gacela_SDL_DisplayFormat (SCM surface)
63 return scm_from_int ((int)SDL_DisplayFormat ((SDL_Surface *)scm_to_int (surface)));
67 gacela_SDL_MapRGB (SCM format, SCM r, SCM g, SCM b)
69 return scm_from_int (SDL_MapRGB ((SDL_PixelFormat *)scm_to_int (format), scm_to_int (r), scm_to_int (g), scm_to_int (b)));
73 gacela_SDL_SetColorKey (SCM surface, SCM flag, SCM key)
75 return scm_from_int (SDL_SetColorKey ((SDL_Surface *)scm_to_int (surface), scm_to_int (flag), scm_to_int (key)));
79 gacela_SDL_LoadBMP (SCM file)
81 return scm_from_int ((int)SDL_LoadBMP (scm_to_locale_string (file)));
85 gacela_IMG_Load (SCM filename)
87 return scm_from_int ((int)IMG_Load (scm_to_locale_string (filename)));
91 gacela_SDL_GetVideoInfo ()
93 const SDL_VideoInfo *info;
96 info = SDL_GetVideoInfo ();
98 ((cons (int info->blit_hw) vi) vi) (':blit_hw label) ((cons label vi) vi)
99 ((cons (int info->hw_available) vi) vi) (':hw_available label) ((cons label vi) vi)
103 SDL_register_functions (void* data)
105 scm_c_define ("SDL_INIT_TIMER", scm_from_int(SDL_INIT_TIMER));
106 scm_c_define ("SDL_INIT_AUDIO", scm_from_int(SDL_INIT_AUDIO));
107 scm_c_define ("SDL_INIT_VIDEO", scm_from_int(SDL_INIT_VIDEO));
108 scm_c_define ("SDL_INIT_CDROM", scm_from_int(SDL_INIT_CDROM));
109 scm_c_define ("SDL_INIT_JOYSTICK", scm_from_int(SDL_INIT_JOYSTICK));
110 scm_c_define ("SDL_INIT_NOPARACHUTE", scm_from_int(SDL_INIT_NOPARACHUTE));
111 scm_c_define ("SDL_INIT_EVENTTHREAD", scm_from_int(SDL_INIT_EVENTTHREAD));
112 scm_c_define ("SDL_INIT_EVERYTHING", scm_from_int(SDL_INIT_EVERYTHING));
114 scm_c_define ("SDL_SWSURFACE", scm_from_int(SDL_SWSURFACE));
115 scm_c_define ("SDL_HWSURFACE", scm_from_int(SDL_HWSURFACE));
116 scm_c_define ("SDL_ASYNCBLIT", scm_from_int(SDL_ASYNCBLIT));
118 scm_c_define ("SDL_ANYFORMAT", scm_from_int(SDL_ANYFORMAT));
119 scm_c_define ("SDL_HWPALETTE", scm_from_int(SDL_HWPALETTE));
120 scm_c_define ("SDL_DOUBLEBUF", scm_from_int(SDL_DOUBLEBUF));
121 scm_c_define ("SDL_FULLSCREEN", scm_from_int(SDL_FULLSCREEN));
122 scm_c_define ("SDL_OPENGL", scm_from_int(SDL_OPENGL));
123 scm_c_define ("SDL_OPENGLBLIT", scm_from_int(SDL_OPENGLBLIT));
124 scm_c_define ("SDL_RESIZABLE", scm_from_int(SDL_RESIZABLE));
125 scm_c_define ("SDL_NOFRAME", scm_from_int(SDL_NOFRAME));
127 scm_c_define ("SDL_HWACCEL", scm_from_int(SDL_HWACCEL));
128 scm_c_define ("SDL_SRCCOLORKEY", scm_from_int(SDL_SRCCOLORKEY));
130 scm_c_define ("SDL_GL_DOUBLEBUFFER", scm_from_int(SDL_GL_DOUBLEBUFFER));
132 scm_c_define ("SDL_DEFAULT_REPEAT_DELAY", scm_from_int(SDL_DEFAULT_REPEAT_DELAY));
133 scm_c_define ("SDL_DEFAULT_REPEAT_INTERVAL", scm_from_int(SDL_DEFAULT_REPEAT_INTERVAL));
135 scm_c_define ("SDL_LIL_ENDIAN", scm_from_int(SDL_LIL_ENDIAN));
136 scm_c_define ("SDL_BIG_ENDIAN", scm_from_int(SDL_BIG_ENDIAN));
138 scm_c_define ("MIX_DEFAULT_FORMAT", scm_from_int(MIX_DEFAULT_FORMAT));
140 scm_c_define_gsubr ("SDL_Init", 1, 0, 0, gacela_SDL_Init);
141 scm_c_define_gsubr ("SDL_Quit", 0, 0, 0, gacela_SDL_Quit);
142 scm_c_define_gsubr ("SDL_SetVideoMode", 4, 0, 0, gacela_SDL_SetVideoMode);
143 scm_c_define_gsubr ("SDL_WM_SetCaption", 2, 0, 0, gacela_SDL_WM_SetCaption);
144 scm_c_define_gsubr ("SDL_Flip", 1, 0, 0, gacela_SDL_Flip);
145 scm_c_define_gsubr ("SDL_FreeSurface", 1, 0, 0, gacela_SDL_FreeSurface);
146 scm_c_define_gsubr ("SDL_Delay", 1, 0, 0, gacela_SDL_Delay);
147 scm_c_define_gsubr ("SDL_GetTicks", 0, 0, 0, gacela_SDL_GetTicks);
148 scm_c_define_gsubr ("SDL_DisplayFormat", 1, 0, 0, gacela_SDL_DisplayFormat);
149 scm_c_define_gsubr ("SDL_MapRGB", 4, 0, 0, gacela_SDL_MapRGB);
150 scm_c_define_gsubr ("SDL_SetColorKey", 3, 0, 0, gacela_SDL_SetColorKey);
151 scm_c_define_gsubr ("SDL_LoadBMP", 1, 0, 0, gacela_SDL_LoadBMP);
152 scm_c_define_gsubr ("IMG_Load", 1, 0, 0, gacela_IMG_Load);