Update of /project/corman-sdl/cvsroot/corman-sdl/examples In directory common-lisp.net:/tmp/cvs-serv30208/examples
Modified Files: bouncing-ball_7.lisp random-rectangles_5.lisp Log Message:
Date: Fri Jul 2 02:25:31 2004 Author: lcrook
Index: corman-sdl/examples/bouncing-ball_7.lisp diff -u corman-sdl/examples/bouncing-ball_7.lisp:1.1 corman-sdl/examples/bouncing-ball_7.lisp:1.2 --- corman-sdl/examples/bouncing-ball_7.lisp:1.1 Tue Apr 13 10:09:40 2004 +++ corman-sdl/examples/bouncing-ball_7.lisp Fri Jul 2 02:25:31 2004 @@ -27,14 +27,14 @@ (return))
(setf tempBitmap (sdl:loadbmp "b-ball.bmp")) - (when (null tempBitmap) + (unless tempBitmap (sdl:fformat "ERROR: Cannot find "b-ball.bmp" in directory ~A~%" (ccl:get-current-directory)) (return))
;Now we make all black pixels transparent.. ;First, set the color black (0, 0, 0) to be the transparent pixel using SDL_SetColorKey (sdl:set-colorkey tempBitmap 0 0 0 :accel t) - ;Now call (sdl:set-videomode) in order to convert the surface + ;Now call (sdl:displayformat) in order to convert the surface ;to native SDL format for fast blitting. (setf pBitmap (sdl:displayformat tempBitmap))
@@ -46,11 +46,11 @@
(sdl:with-events (:quit t) - (:keydown (state keysym) - (when (eql (sdl:get-key keysym) sdl:SDLK_ESCAPE) + (:keydown (state scancode key mod unicode) + (when (= key sdl:SDLK_ESCAPE) (sdl:push-quitevent))) (:idle - (sdl:clear-display 255 255 255) + (sdl:fill-display :r 255 :g 255 :b 255)
(sdl:moveby-rectangle rcDst dx dy) (when (or (<= (sdl:rectangle-x rcDst) 0) (>= (sdl:rectangle-x rcDst) max-right)) @@ -58,7 +58,7 @@ (when (or (<= (sdl:rectangle-y rcDst) 0) (>= (sdl:rectangle-y rcDst) max-height)) (setf dy (- dy)))
- (sdl:blit-to-display pBitmap rcDst) + (sdl:blit-to-display pBitmap :template rcDst) (sdl:Flip))))
(unless (sdl:init-success) @@ -75,4 +75,3 @@
;;; Build the exe using... ;;; (SAVE-APPLICATION "bouncing-ball.exe" 'bouncing-ball :static t) -:c 1 \ No newline at end of file
Index: corman-sdl/examples/random-rectangles_5.lisp diff -u corman-sdl/examples/random-rectangles_5.lisp:1.1 corman-sdl/examples/random-rectangles_5.lisp:1.2 --- corman-sdl/examples/random-rectangles_5.lisp:1.1 Tue Apr 13 10:09:40 2004 +++ corman-sdl/examples/random-rectangles_5.lisp Fri Jul 2 02:25:31 2004 @@ -33,11 +33,14 @@ ;(documentation 'sdl:with-events 'function) for a description of how to use it. (sdl:with-events (:quit t) + (:keydown (state scancode key mod unicode) + (when (= key sdl:SDLK_ESCAPE) + (sdl:push-quitevent))) (:idle ;Set up the random rectangle - (with-c-struct (x rectangle sdl:SDL_Rect) + (ct:with-c-struct (x rectangle sdl:sdl_rect) (setf - sdl::x (random width) + sdl::x (random width) sdl::y (random height) sdl::w (random (- width sdl::x)) sdl::h (random (- height sdl::y)))) @@ -45,7 +48,7 @@ ;'Render' the rectangle to the display by: ;Filling the display with a random color, ;using the [x,y,w,h] of the rectangle as a template - (sdl:fill-display (random 256) (random 256) (random 256) :rectangle rectangle) + (sdl:fill-display :r (random 256) :g (random 256) :b (random 256) :template rectangle)
;Use sdl:flip or sdl:update-display to update the screen. ; Here, sdl:flip updates the entire display whereas @@ -54,13 +57,11 @@
;(sdl:Flip)
- (sdl:update-display - (sdl:rectangle-x rectangle) (sdl:rectangle-y rectangle) - (sdl:rectangle-w rectangle) (sdl:rectangle-h rectangle))))) + (sdl:update-display :template rectangle)))
;sdl:init-success will check to see if sdl:with-init was initialized correctly. (unless (sdl:init-success) - (fformat "ERROR: sdl:with-init FAILED to initialize")))) + (fformat "ERROR: sdl:with-init FAILED to initialize")))))
;;; Run the example using... ;;; (setf rects (mp:process-run-function "random-rects" #'random-rects))