X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela_SDL.lisp;h=5dd383eefed4f661033d5ea479c8ee4e3b36831b;hb=3747c2cd2da9c0a618628fa649ece29830581464;hp=da02a84033c2e2752dd57fde05a856028dc2cbf4;hpb=9199dc2f83bc4be3647e40031223c86d666656e9;p=gacela.git diff --git a/gacela_SDL.lisp b/gacela_SDL.lisp index da02a84..5dd383e 100644 --- a/gacela_SDL.lisp +++ b/gacela_SDL.lisp @@ -15,7 +15,10 @@ ;;; 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)")) @@ -73,6 +76,7 @@ "SDL_Quit ();") (defcfun "int gacela_SDL_SetVideoMode (int width, int height, int bpp, int flags)" 0 + "close(2);" "return SDL_SetVideoMode (width, height, bpp, flags);") (defcfun "void gacela_SDL_WM_SetCaption (char *title, char *icon)" 0 @@ -141,6 +145,9 @@ (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")) @@ -181,6 +188,7 @@ (defentry SDL_GL_SwapBuffers () (void "gacela_SDL_GL_SwapBuffers")) (defentry SDL_EnableKeyRepeat (int int) (int "gacela_SDL_EnableKeyRepeat")) (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 @@ -203,6 +211,14 @@ "const SDL_Surface *s = surface;" "return s->format->BytesPerPixel;") +(defcfun "int gacela_resize_surface (int surface, int width, int height)" 0 + "const SDL_Surface *s = surface;" + "if (s->w == width && s->h == height) {" + " return s;" + "} else {" + " return zoomSurface (s, width / s->w, height / s->h, 0);" + "}") + ;(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 box-collision (int int int int int int) (int "box_collision")) @@ -213,3 +229,4 @@ (defentry surface-h (int) (int "gacela_surface_h")) (defentry surface-pixels (int) (int "gacela_surface_pixels")) (defentry surface-format-BytesPerPixel (int) (int "gacela_surface_format_BytesPerPixel")) +(defentry resize-surface (int int int) (int "gacela_resize_surface"))