Menu

[r760]: / trunk / lispbuilder-sdl-gfx / examples / bezier.lisp  Maximize  Restore  History

Download this file

27 lines (22 with data), 939 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;;;;; Converted from the "Bezier" Processing example at:
;;;;; "http://www.processing.org/learning/examples/bezier.html"
;;;;; (C)2006 Luke J Crook
(in-package #:sdl-gfx-examples)
(defun bezier ()
(let ((width 200) (height 200))
(sdl:with-init ()
(sdl:window width height :title-caption "Bezier, from Processing.org")
(setf (sdl:frame-rate) 5)
(sdl:clear-display (sdl:color :r 0 :g 0 :b 0))
(sdl:with-surface (disp sdl:*default-display*)
(sdl:with-color (col (sdl:color :r 255 :g 255 :b 255))
(loop for i from 0 to 100 by 10
do (sdl-gfx:draw-bezier (list (sdl:point :x (- 90 (/ i 2.0)) :y (+ 20 i))
(sdl:point :x 210 :y 10)
(sdl:point :x 220 :y 150)
(sdl:point :x (- 120 (/ i 8.0)) :y (+ 150 (/ i 4.0))))
:segments 5))))
(sdl:update-display)
(sdl:with-events ()
(:quit-event () t)
(:video-expose-event () (sdl:update-display))))))
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.