X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgacela_SDL.c;h=f40c0ac3980058f04f463201545400736ae0b746;hb=e2ab9ffff05259980c1b333030fcb074d665acc1;hp=118825baddab4e743ec83da01ae10807a6ce10b0;hpb=ddb41086a294d20c28c04b9aa20900acf3624506;p=gacela.git diff --git a/src/gacela_SDL.c b/src/gacela_SDL.c index 118825b..f40c0ac 100644 --- a/src/gacela_SDL.c +++ b/src/gacela_SDL.c @@ -21,6 +21,30 @@ #include #include "gacela_SDL.h" +struct surface +{ + SCM name; +}; + +static scm_t_bits surface_tag; + +SCM +gacela_make_surface (SCM name) +{ + SCM smob; + struct surface *surface; + + surface = (struct surface *) scm_gc_malloc (sizeof (struct surface), "surface"); + + surface->name = SCM_BOOL_F; + + SCM_NEWSMOB (smob, surface_tag, surface); + + surface->name = name; + + return smob; +} + SCM gacela_SDL_Init (SCM flags) { @@ -64,7 +88,7 @@ gacela_SDL_FreeSurface (SCM surface) SCM gacela_SDL_Delay (SCM ms) { - SDL_Delay (scm_to_int (ms)); + SDL_Delay ((int)scm_to_double (ms)); return SCM_UNSPECIFIED; } @@ -246,6 +270,12 @@ gacela_Mix_CloseAudio (void) void* SDL_register_functions (void* data) { + surface_tag = scm_make_smob_type ("surface", sizeof (struct surface)); + // scm_set_smob_mark (surface_tag, mark_surface); + // scm_set_smob_free (surface_tag, free_surface); + // scm_set_smob_print (surface_tag, print_surface); + // scm_set_smob_equalp (surface_tag, equalp_surface); + scm_c_define ("SDL_INIT_TIMER", scm_from_int (SDL_INIT_TIMER)); scm_c_define ("SDL_INIT_AUDIO", scm_from_int (SDL_INIT_AUDIO)); scm_c_define ("SDL_INIT_VIDEO", scm_from_int (SDL_INIT_VIDEO)); @@ -313,6 +343,7 @@ SDL_register_functions (void* data) scm_c_define_gsubr ("Mix_FreeMusic", 1, 0, 0, gacela_Mix_FreeMusic); scm_c_define_gsubr ("Mix_FreeChunk", 1, 0, 0, gacela_Mix_FreeChunk); scm_c_define_gsubr ("Mix_CloseAudio", 0, 0, 0, gacela_Mix_CloseAudio); + scm_c_define_gsubr ("make-surface", 1, 0, 0, gacela_make_surface); return NULL; }