[pal-cvs] CVS pal/examples
tneste
tneste at common-lisp.net
Mon Jul 16 20:46:24 UTC 2007
Update of /project/pal/cvsroot/pal/examples
In directory clnet:/tmp/cvs-serv16636/examples
Modified Files:
hello.lisp polygons.lisp swarm.lisp
Log Message:
Added smoothp option to draw-polygon/line/point/rectangle. RGBA values now have effect on textured images drawn with aforementioned functions.
Removed some unnecessary gl-state pushing.(+gl-color-buffer-bit+)
--- /project/pal/cvsroot/pal/examples/hello.lisp 2007/07/13 21:30:58 1.5
+++ /project/pal/cvsroot/pal/examples/hello.lisp 2007/07/16 20:46:23 1.6
@@ -7,7 +7,7 @@
(let ((font (pal:load-font "georgia")))
(loop for y from 0 to 300 by 2 do
(pal:draw-line (pal:v 0 (* y 2)) (pal:v 800 (* y 2))
- 50 50 255 (truncate y 2)))
+ 50 50 255 (truncate y 2) :smoothp t))
(let ((midpoint (pal:v-round
(pal:v (/ (- (pal:get-screen-width)
(pal:get-text-size "Hello from PAL" font))
@@ -25,7 +25,7 @@
(defun hello-2 ()
- (pal:with-pal ()
+ (pal:with-pal (:fps 10000)
(let ((angle 0f0))
(pal:set-blend-color 0 255 0 255)
(pal:event-loop ()
--- /project/pal/cvsroot/pal/examples/polygons.lisp 2007/07/13 21:30:58 1.2
+++ /project/pal/cvsroot/pal/examples/polygons.lisp 2007/07/16 20:46:24 1.3
@@ -8,6 +8,7 @@
(plane (load-image "lego-plane.png" t))
(slad (load-image "save_lisp.gif"))
(teddy (load-image "yellow-teddy.png")))
+ (set-cursor nil)
(event-loop ()
(draw-rectangle (v 0 0)
@@ -18,6 +19,7 @@
;; DRAW-IMAGE draw the whole image at given position. Keyword arguments can be given to define the
;; scale, angle and horizontal and vertical alignment ("hotspot")
+ (draw-arrow (v 700 500) (get-mouse-pos) 255 255 0 255 :size 5f0 :smoothp t)
(draw-image plane
(v 700 500)
:halign :middle ;; Possible options are :left, :right and :middle. :left is the default.
@@ -25,10 +27,10 @@
:angle (v-angle (v-direction (v 700 500) (get-mouse-pos))) ;; angle in degrees
:scale (* (v-distance (v 700 500) (get-mouse-pos)) .01f0))
- (draw-point (v 700 500) 255 0 0 255 :size 10f0) ;; Draw a red point at the hotspot of previous image.
+ (draw-point (v 700 500) 255 0 0 255 :size 10f0 :smoothp t) ;; Draw a red point at the hotspot of previous image.
;; DRAW-POLYGON draw a polygon which vertexes are given as a list of VECs.
- ;; FILL is either nil, t or image that is used as a pattern. If fill is an image the rgba values have no effect.
+ ;; FILL is either nil, t or image that is used as a pattern.
;; When ABSOLUTEP is T image patterns position is decided by screen coordinates.
;; Max value of SIZE depends on the OpenGL implementation, you probably shouldn't use values greater than 10f0
@@ -38,7 +40,7 @@
(v 50 100)
(v -50 100)
)
- 255 0 0 255
+ 0 0 255 255
:fill grid
:absolutep t)
(draw-polygon (list (v -100 0)
@@ -47,11 +49,12 @@
(v -50 100)
)
255 0 0 255
- :fill nil :size 4f0
+ :fill nil
+ :size 5f0
+ :smoothp t
:absolutep nil))
-
;; DRAW-RECTANGLEs arguments are similar to DRAW-POLYGON
;; Notice how the size of the actual SLAD image used is expanded up to the nearest power of two and the extra space is filled with blank,
;; usually this happens transparently to the user (eg. image-width returns the original width of image) but in some cases
@@ -61,9 +64,9 @@
;; good idea to try and fit the image sizes inside the nearest power of two to save memory.
(with-blend (:color '(255 255 255 128))
- (draw-rectangle (get-mouse-pos)
+ (draw-rectangle (v+ (get-mouse-pos) (v 30 30))
100 100
- 0 0 0 0
+ 255 255 255 64
:absolutep t
:fill slad))
--- /project/pal/cvsroot/pal/examples/swarm.lisp 2007/07/13 21:30:58 1.3
+++ /project/pal/cvsroot/pal/examples/swarm.lisp 2007/07/16 20:46:24 1.4
@@ -15,7 +15,7 @@
(let ((midpoint (pal:v/ (reduce 'pal:v+ vectors :initial-value (pal:v 0 0) :key 'car)
(max 1f0
(coerce (length vectors) 'single-float)))))
- (pal:draw-point midpoint 255 0 0 255 :size 10f0)
+ (pal:draw-point midpoint 255 0 0 255 :size 10f0 :smoothp t)
(setf vectors (mapcar (lambda (v)
(cons (pal:v+ (car v) (cdr v))
(pal:v* (pal:v+ (cdr v)
More information about the Pal-cvs
mailing list