[pal-cvs] CVS pal/examples

tneste tneste at common-lisp.net
Tue Jul 3 18:42:35 UTC 2007


Update of /project/pal/cvsroot/pal/examples
In directory clnet:/tmp/cvs-serv27783/examples

Modified Files:
	hello.lisp swarm.lisp 
Log Message:
Removed MOUSE-BUTTON-DOWN/UP-FN from event handling functions. Use KEY-*-FN instead

--- /project/pal/cvsroot/pal/examples/hello.lisp	2007/07/03 18:10:33	1.3
+++ /project/pal/cvsroot/pal/examples/hello.lisp	2007/07/03 18:42:33	1.4
@@ -6,14 +6,14 @@
   (pal:with-pal (:paths "/path/to/examples/")
     (let ((font (pal:load-font "georgia")))
       (pal:draw-text "Hello from PAL"
-		     (pal:v-round
-		      (pal:v (/ (- (pal:get-screen-width)
-				   (pal:get-text-size "Hello from PAL" font))
-				2)
-			     (/ (- (pal:get-screen-height)
-				   (pal:get-font-height font))
-				2)))
-		     font))
+                     (pal:v-round
+                      (pal:v (/ (- (pal:get-screen-width)
+                                   (pal:get-text-size "Hello from PAL" font))
+                                2)
+                             (/ (- (pal:get-screen-height)
+                                   (pal:get-font-height font))
+                                2)))
+                     font))
     (pal:wait-keypress)))
 
 ;; (hello-1)
@@ -22,11 +22,12 @@
 (defun hello-2 ()
   (pal:with-pal ()
     (let ((angle 0f0))
+      (pal:set-blend-color 0 255 0 255)
       (pal:event-loop ()
-	(pal:draw-rectangle (pal:v 0 0)
-			    (pal:get-screen-width) (pal:get-screen-height)
-			    50 50 200 10)
-	(pal:with-transformation (:pos (pal:v 400 300) :angle (incf angle 1f0) :scale 3f0)
-	  (pal:draw-text "Hello from PAL" (pal:v 0 0)))))))
+        (pal:draw-rectangle (pal:v 0 0)
+                            (pal:get-screen-width) (pal:get-screen-height)
+                            0 0 0 10)
+        (pal:with-transformation (:pos (pal:v 400 300) :angle (incf angle 1f0) :scale 3f0)
+          (pal:draw-text "Hello from PAL" (pal:v 0 0)))))))
 
 ;; (hello-2)
\ No newline at end of file
--- /project/pal/cvsroot/pal/examples/swarm.lisp	2007/06/28 20:14:05	1.1
+++ /project/pal/cvsroot/pal/examples/swarm.lisp	2007/07/03 18:42:33	1.2
@@ -3,10 +3,11 @@
 (defun swarm ()
   (let ((vectors nil))
     (pal:with-pal (:width 1024 :height 768)
-      (pal:event-loop (:mouse-button-down-fn (lambda (mb)
-                                               (when (= mb 1)
-                                                 (setf vectors (append vectors (loop repeat 50 collecting (cons (pal:get-mouse-pos)
-                                                                                                                (pal:v-random 5f0))))))))
+      (pal:event-loop (:key-down-fn (lambda (key)
+                                      (pal:message key)
+                                      (when (eq key :key-mouse-1)
+                                        (setf vectors (append vectors (loop repeat 50 collecting (cons (pal:get-mouse-pos)
+                                                                                                       (pal:v-random 5f0))))))))
         (pal:draw-rectangle (pal:v 0 0) 1024 768 0 0 0 128)
         (pal:with-blend (:r 255 :g 128 :b 128 :a 255)
           (pal:draw-text "Use left mousekey to add particles." (pal:v 0 0)))




More information about the Pal-cvs mailing list