[pal-cvs] CVS pal/examples

tneste tneste at common-lisp.net
Sun Jul 29 19:11:44 UTC 2007


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

Modified Files:
	hares.lisp images.lisp teddy.lisp 
Log Message:
Eliminated some of the unnecessary gl-begins.

--- /project/pal/cvsroot/pal/examples/hares.lisp	2007/07/28 13:13:17	1.5
+++ /project/pal/cvsroot/pal/examples/hares.lisp	2007/07/29 19:11:44	1.6
@@ -16,7 +16,6 @@
 (defclass sprite ()
   ((pos :accessor pos-of :initarg :pos :initform (v 0 0))
    (vel :accessor vel-of :initarg :vel :initform (v 0 0))
-   (image :accessor image-of :initarg :image)
    (angle :accessor angle-of :initarg :angle :initform 0)
    (r :accessor r-of :initarg :r)
    (g :accessor g-of :initarg :g)
@@ -29,12 +28,14 @@
 
 (defmethod draw ((s sprite))
   (set-blend-color (r-of s) (g-of s) (b-of s) 255)
-  (draw-image (image-of s)
-              (pos-of s)
+  (draw-image (tag 'hare)
+              (v- (pos-of s) (v* (v (image-width (tag 'hare))
+                                    (image-height (tag 'hare)))
+                                 (* (scale-of s) .5)))
               :halign :middle
               :valign :middle
-              :angle (angle-of s)
-              :scale (scale-of s)))
+              :scale (scale-of s)
+              :angle (angle-of s)))
 
 (defmethod act ((s sprite))
   (setf (angle-of s) (mod (+ (angle-of s) 1) 360))
@@ -53,13 +54,12 @@
 
 
 (defun example ()
-  (with-pal (:width 800 :height 600 :fullscreenp nil :fps 6000 :paths (merge-pathnames "examples/" pal::*pal-directory*))
+  (with-pal (:width 800 :height 600 :fullscreenp t :fps 6000 :paths (merge-pathnames "examples/" pal::*pal-directory*))
     (setf *sprites* nil)
     (set-cursor nil)
     (dotimes (i 500)
       (make-instance 'sprite
-                     :image (tag 'hare)
-                     :scaled (- (random .2) .1)
+                     :scaled (- (random .1) .05)
                      :scale (+ (random 1.5) .5)
                      :r (random 255)
                      :g (random 255)
--- /project/pal/cvsroot/pal/examples/images.lisp	2007/07/27 22:48:40	1.6
+++ /project/pal/cvsroot/pal/examples/images.lisp	2007/07/29 19:11:44	1.7
@@ -29,7 +29,8 @@
 
 
 (with-pal (:paths (merge-pathnames "examples/" pal::*pal-directory*))
-  (set-cursor (tag 'image-3)) ;; sets image-3 as a mouse cursor image
+  (set-cursor (tag 'image-3))
+  ;; sets image-3 as a mouse cursor image
   (let ((a 0))
     (event-loop ()
       (draw-polygon* (list (v 0 0)
--- /project/pal/cvsroot/pal/examples/teddy.lisp	2007/07/27 20:12:12	1.5
+++ /project/pal/cvsroot/pal/examples/teddy.lisp	2007/07/29 19:11:44	1.6
@@ -44,8 +44,8 @@
 
 (defmethod act ((s sprite))
   (v+! (pos-of s) (vel-of s))
-  (v*! (vel-of s) .90)
-  (v*! (vel-of s) .90))
+  (v*! (vel-of s) .98)
+  (v*! (vel-of s) .98))
 
 (defmethod draw ((s sprite))
   (draw-image (image-of s)




More information about the Pal-cvs mailing list