From 37c43e6c2baf192f27d6cc5c6e4cfc5280ef79c7 Mon Sep 17 00:00:00 2001 From: jsancho Date: Fri, 6 May 2011 18:16:22 +0000 Subject: [PATCH] --- src/Makefile.am | 2 +- src/gacela_SDL.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8cda700..7411268 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ bin_PROGRAMS = gacela gacela_SOURCES = gacela.c gacela_SDL.c -gacela_LDADD = -lSDL -lGL -lguile -lltdl -lgmp -lcrypt -lm -lltdl +gacela_LDADD = -lSDL -lSDL_image -lSDL_mixer -lGL -lguile -lltdl -lgmp -lcrypt -lm -lltdl diff --git a/src/gacela_SDL.c b/src/gacela_SDL.c index 920f11e..558d837 100644 --- a/src/gacela_SDL.c +++ b/src/gacela_SDL.c @@ -31,6 +31,74 @@ gacela_SDL_WM_SetCaption (SCM title, SCM icon) return SCM_UNSPECIFIED; } +SCM +gacela_SDL_Flip (SCM screen) +{ + return scm_from_int (SDL_Flip ((SDL_Surface *)scm_to_int (screen))); +} + +SCM +gacela_SDL_FreeSurface (SCM surface) +{ + SDL_FreeSurface ((SDL_Surface *)scm_to_int (surface)); + return SCM_UNSPECIFIED; +} + +SCM +gacela_SDL_Delay (SCM ms) +{ + SDL_Delay (scm_to_int (ms)); + return SCM_UNSPECIFIED; +} + +SCM +gacela_SDL_GetTicks () +{ + return scm_from_int (SDL_GetTicks ()); +} + +SCM +gacela_SDL_DisplayFormat (SCM surface) +{ + return scm_from_int ((int)SDL_DisplayFormat ((SDL_Surface *)scm_to_int (surface))); +} + +SCM +gacela_SDL_MapRGB (SCM format, SCM r, SCM g, SCM b) +{ + return scm_from_int (SDL_MapRGB ((SDL_PixelFormat *)scm_to_int (format), scm_to_int (r), scm_to_int (g), scm_to_int (b))); +} + +SCM +gacela_SDL_SetColorKey (SCM surface, SCM flag, SCM key) +{ + return scm_from_int (SDL_SetColorKey ((SDL_Surface *)scm_to_int (surface), scm_to_int (flag), scm_to_int (key))); +} + +SCM +gacela_SDL_LoadBMP (SCM file) +{ + return scm_from_int ((int)SDL_LoadBMP (scm_to_locale_string (file))); +} + +SCM +gacela_IMG_Load (SCM filename) +{ + return scm_from_int ((int)IMG_Load (scm_to_locale_string (filename))); +} + +SCM +gacela_SDL_GetVideoInfo () +{ + const SDL_VideoInfo *info; + SCM vi; + + info = SDL_GetVideoInfo (); + ('nil vi) + ((cons (int info->blit_hw) vi) vi) (':blit_hw label) ((cons label vi) vi) + ((cons (int info->hw_available) vi) vi) (':hw_available label) ((cons label vi) vi) + "return vi;") + void* SDL_register_functions (void* data) { @@ -73,6 +141,15 @@ SDL_register_functions (void* data) scm_c_define_gsubr ("SDL_Quit", 0, 0, 0, gacela_SDL_Quit); scm_c_define_gsubr ("SDL_SetVideoMode", 4, 0, 0, gacela_SDL_SetVideoMode); scm_c_define_gsubr ("SDL_WM_SetCaption", 2, 0, 0, gacela_SDL_WM_SetCaption); + scm_c_define_gsubr ("SDL_Flip", 1, 0, 0, gacela_SDL_Flip); + scm_c_define_gsubr ("SDL_FreeSurface", 1, 0, 0, gacela_SDL_FreeSurface); + scm_c_define_gsubr ("SDL_Delay", 1, 0, 0, gacela_SDL_Delay); + scm_c_define_gsubr ("SDL_GetTicks", 0, 0, 0, gacela_SDL_GetTicks); + scm_c_define_gsubr ("SDL_DisplayFormat", 1, 0, 0, gacela_SDL_DisplayFormat); + scm_c_define_gsubr ("SDL_MapRGB", 4, 0, 0, gacela_SDL_MapRGB); + scm_c_define_gsubr ("SDL_SetColorKey", 3, 0, 0, gacela_SDL_SetColorKey); + scm_c_define_gsubr ("SDL_LoadBMP", 1, 0, 0, gacela_SDL_LoadBMP); + scm_c_define_gsubr ("IMG_Load", 1, 0, 0, gacela_IMG_Load); return NULL; } -- 2.39.5