[corman-sdl-cvs] CVS update: corman-sdl/ffi/sdl-util.lisp
Luke J Crook
lcrook at common-lisp.net
Fri Jul 2 09:24:59 UTC 2004
Update of /project/corman-sdl/cvsroot/corman-sdl/ffi
In directory common-lisp.net:/tmp/cvs-serv26481/ffi
Modified Files:
sdl-util.lisp
Log Message:
Date: Fri Jul 2 02:24:59 2004
Author: lcrook
Index: corman-sdl/ffi/sdl-util.lisp
diff -u corman-sdl/ffi/sdl-util.lisp:1.2 corman-sdl/ffi/sdl-util.lisp:1.3
--- corman-sdl/ffi/sdl-util.lisp:1.2 Tue Apr 20 18:23:07 2004
+++ corman-sdl/ffi/sdl-util.lisp Fri Jul 2 02:24:59 2004
@@ -213,47 +213,54 @@
(ct:cref sdl:SDL_Surface surface sdl::format)))
-(defun fill-surface (surface r g b &optional (a nil) &key (rectangle nil))
- "fill SURFACE R G B &optional A &key (RECTANGLE null)
- Fill SURFACE with the specified color using the parameters R G B and the optional alpha component, A.
- RECTANGLE is the fill template."
- (if (null a)
- (sdl:SDL_FillRect surface rectangle
+(defun fill-surface (surface &key (r 0) (g 0) (b 0) (alpha nil) (template NULL))
+ "fill SURFACE &key R G B ALPHA (template null)
+ Fill SURFACE with the specified color using the keyword parameters R G B and Alpha.
+ :template is the fill template."
+ (if ALPHA
+ (sdl:SDL_FillRect surface template
(sdl:SDL_MapRGB (sdl:pixelformat surface) r g b))
- (sdl:SDL_FillRect surface rectangle
- (sdl:SDL_MapRGBA (sdl:pixelformat surface) r g b a))))
+ (sdl:SDL_FillRect surface template
+ (sdl:SDL_MapRGBA (sdl:pixelformat surface) r g b ALPHA))))
-(defun fill-display (r g b &key (rectangle nil))
- "fill-display R G B &key RECTANGLE
+(defun fill-display (&key (r 0) (g 0) (b 0) (template NULL))
+ "fill-display &key R G B template
Fills the display with a color specified using the R G B parameters.
- The optional RECTANGLE (SDL_Rect) defaults to NULL."
- (sdl:SDL_FillRect (sdl:display) RECTANGLE
+ The keyword :template (SDL_Rect) defaults to NULL."
+ (sdl:SDL_FillRect (sdl:display) template
(sdl:SDL_MapRGB (sdl:pixelformat (sdl:display)) r g b)))
-(defun clear-display (&optional (r 0) (g 0) (b 0))
- "clear-display &optional R G B
- Clears the whole display using the optional R G B parameters. Color defaults to black."
+#|(defun clear-display (&key (r 0) (g 0) (b 0))
+ "clear-display &key R G B
+ Clears the whole display using the keyword :R :G :B parameters. Color defaults to black."
(sdl:SDL_FillRect (sdl:display) NULL
(sdl:SDL_MapRGB (sdl:pixelformat (sdl:display)) r g b)))
+|#
-(defun update-display (&optional (x 0) (y 0) (w 0) (h 0))
- "update-display &optional X Y W H
- Updates the screen using the optional co-orditates X Y W H.
+(defun update-display (&key (x 0) (y 0) (w 0) (h 0) (template nil))
+ "update-display &key X Y W H
+ Updates the screen using the keyword co-orditates :X :Y :W :H, or :template.
Co-ordinates default to 0, therefore updating the entire screen."
- (sdl:SDL_UpdateRect (sdl:display) x y w h))
+ (if template
+ (sdl:SDL_UpdateRect (sdl:display)
+ (sdl:rectangle-x template)
+ (sdl:rectangle-y template)
+ (sdl:rectangle-w template)
+ (sdl:rectangle-h template))
+ (sdl:SDL_UpdateRect (sdl:display) x y w h)))
-(defun blit-to-display (source destination &key (rectangle NULL))
+(defun blit-to-display (source &key (template NULL))
"blit-to-display SOURCE DESTINATION
Blits the SOURCE surface to the display using SDL_BlitSurface.
DESTINATION is a SDL_Rect. Only the [x,y] co-ordinates are used to position the source on the display."
- (sdl:SDL_BlitSurface source rectangle (sdl:display) destination))
+ (sdl:blit-to-surface source (sdl:display) :destination-template template))
-(defun blit-to-surface (source destination-coords destination-surface &key (source-rect nil))
+(defun blit-to-surface (source destination &key (source-template NULL) (destination-template NULL))
"blit-to-surface SOURCE DESTINATION-COORDS DESTINATION-SURFACE &key SOURCE-RECT
Blits the SOURCE surface to the DESTINATION-SURFACE using SDL_BlitSurface.
DESTINATION is a SDL_Rect. Only the [x,y] co-ordinates are used to position the SOURCE on the DESTINATION-SURFACE.
Use the optional SOURCE-RECT ( SDL_Rect ) to blit a portion of the SOURCE to the DESTINATION-SURFACE."
- (sdl:SDL_BlitSurface source source-rect destination-surface destination-coords))
+ (sdl:SDL_BlitSurface source source-template destination destination-template))
(defun set-colorkey (surface r g b &key (accel nil))
(if (or
@@ -450,7 +457,10 @@
(funcall #'(lambda ,params
, at forms)
(ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::state)
- (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym))))
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::scancode)
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::sym)
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::mod)
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::unicode))))
(defun expand-keyup (sdl-event params forms)
`((eql sdl:SDL_KEYUP
@@ -460,7 +470,10 @@
(funcall #'(lambda ,params
, at forms)
(ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::state)
- (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym))))
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::scancode)
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::sym)
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::mod)
+ (ct:cref sdl:SDL_keysym (ct:cref sdl:SDL_KeyboardEvent ,sdl-event sdl::keysym) sdl::unicode))))
(defun expand-mousemotion (sdl-event params forms)
`((eql sdl:SDL_MOUSEMOTION
More information about the Corman-sdl-cvs
mailing list