X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgacela_SDL.c;h=ce2f2cc9f0f94166c2d09565ded2754176af2dd9;hb=4487eb2a881092ebebd5496e6425fa8f07546c0f;hp=07ab34799965feb91908b8fb1f03305deccc696a;hpb=4fa4326c57c1022891fd0a7678f139119e997116;p=gacela.git diff --git a/src/gacela_SDL.c b/src/gacela_SDL.c index 07ab347..ce2f2cc 100644 --- a/src/gacela_SDL.c +++ b/src/gacela_SDL.c @@ -75,6 +75,22 @@ get_surface_height (SCM surface_smob) return scm_from_int (surface->h); } +SCM +get_surface_pixels (SCM surface_smob) +{ + SDL_Surface *surface = get_surface_address (surface_smob); + + return scm_from_int (surface->pixels); +} + +SCM +get_surface_format_BytesPerPixel (SCM surface_smob) +{ + SDL_Surface *surface = get_surface_address (surface_smob); + + return scm_from_int (surface->format->BytesPerPixel); +} + SCM mark_surface (SCM surface_smob) { @@ -133,7 +149,7 @@ gacela_SDL_SetVideoMode (SCM width, SCM height, SCM bpp, SCM flags) return make_surface (scm_from_locale_string ("screen"), screen); } else { - return SCM_UNSPECIFIED; + return SCM_BOOL_F; } } @@ -190,7 +206,7 @@ gacela_SDL_LoadBMP (SCM file) return make_surface (file, image); } else { - return SCM_UNSPECIFIED; + return SCM_BOOL_F; } } @@ -203,7 +219,7 @@ gacela_IMG_Load (SCM filename) return make_surface (filename, image); } else { - return SCM_UNSPECIFIED; + return SCM_BOOL_F; } } @@ -355,6 +371,8 @@ SDL_register_functions (void* data) scm_set_smob_print (surface_tag, print_surface); scm_c_define_gsubr ("surface-w", 1, 0, 0, get_surface_width); scm_c_define_gsubr ("surface-h", 1, 0, 0, get_surface_height); + scm_c_define_gsubr ("surface-pixels", 1, 0, 0, get_surface_pixels); + scm_c_define_gsubr ("surface-format-BytesPerPixel", 1, 0, 0, get_surface_format_BytesPerPixel); scm_c_define ("SDL_INIT_TIMER", scm_from_int (SDL_INIT_TIMER)); scm_c_define ("SDL_INIT_AUDIO", scm_from_int (SDL_INIT_AUDIO));