X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_SDL.lisp;h=eff4f1a6ddf942528b737ee13c278831de6c8440;hb=cfad9102eb45541eb9b3308ae75f3f6a024381e0;hp=af72bf1712de85475736ad3b046331c3f3fef505;hpb=a559c9a47d17f1a7ca0a4dff3edcd39449d1821e;p=gacela.git diff --git a/gacela_SDL.lisp b/gacela_SDL.lisp index af72bf1..eff4f1a 100644 --- a/gacela_SDL.lisp +++ b/gacela_SDL.lisp @@ -15,13 +15,24 @@ ;;; along with this program. If not, see . -(in-package :gacela) +(eval-when (compile load eval) + (when (not (find-package 'gacela)) (make-package 'gacela :nicknames '(gg) :use '(lisp))) + (in-package 'gacela :nicknames '(gg) :use '(lisp))) + + +(defmacro mapcconst (type c-type name) + (let ((c-header (concatenate 'string c-type " gacela_" name " (void)")) + (c-body (concatenate 'string "return " name ";")) + (c-name (concatenate 'string "gacela_" name)) + (lisp-name (intern (string-upcase name)))) + `(progn + (defcfun ,c-header 0 ,c-body) + (defentry ,lisp-name () (,type ,c-name)) + (eval-when (load) (defconstant ,lisp-name (,lisp-name)))))) (clines "#include ") (clines "#include ") -(clines "#include ") (clines "#include ") -(clines "#include ") ;;; SDL constants as functions (mapcconst int "int" "SDL_INIT_TIMER") @@ -130,12 +141,12 @@ (defcfun "int gacela_SDL_EnableKeyRepeat (int delay, int interval)" 0 "return SDL_EnableKeyRepeat (delay, interval);") -(defcfun "int gacela_zoomSurface (int src, float zoomx, float zoomy, int smooth)" 0 - "return zoomSurface (src, zoomx, zoomy, smooth);") - (defcfun "int gacela_SDL_ByteOrder (void)" 0 "return SDL_BYTEORDER;") +(defcfun "int gacela_zoomSurface (int src, double zoomx, double zoomy, int smooth)" 0 + "return zoomSurface (src, zoomx, zoomy, smooth);") + (defentry SDL_Init (int) (int "gacela_SDL_Init")) (defentry SDL_Quit () (void "gacela_SDL_Quit")) (defentry SDL_SetVideoMode (int int int int) (int "gacela_SDL_SetVideoMode")) @@ -175,8 +186,8 @@ ;(defentry free (int) (void "gacela_free")) (defentry SDL_GL_SwapBuffers () (void "gacela_SDL_GL_SwapBuffers")) (defentry SDL_EnableKeyRepeat (int int) (int "gacela_SDL_EnableKeyRepeat")) -(defentry zoomSurface (int float float int) (int "gacela_zoomSurface")) (defentry SDL_ByteOrder () (int "gacela_SDL_ByteOrder")) +(defentry zoomSurface (int double double int) (int "gacela_zoomSurface")) ;;; C-Gacela Functions (defcfun "int gacela_surface_format (int surface)" 0 @@ -201,7 +212,6 @@ ;(defentry apply-surface2 (int int int int int int int int int) (void "apply_surface")) ;(defentry render-text2 (int string int int int) (int "render_text")) -;(defentry fill-surface (int int int int) (void "fill_surface")) ;(defentry box-collision (int int int int int int) (int "box_collision")) ;(defentry create-SDL_Surface (int int int int int int) (int "create_SDL_Surface")) ;(defentry copy-SDL_Surface (int) (int "copy_SDL_Surface"))