summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-11-30 22:10:44 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-11-30 22:10:44 -0500
commit1f40b9cc0014f2a0ab838089d946dd7a58e1c27f (patch)
treec37a057bdbb6b58b45bacbac0cd06a96a740a2c3 /examples
parent661d85533bd8ddb8aef0d4879467e021de47c166 (diff)
examples: Delete particles example.
It's not a real particle system anyway. * examples/particle.scm: Delete.
Diffstat (limited to 'examples')
-rw-r--r--examples/particles.scm84
1 files changed, 0 insertions, 84 deletions
diff --git a/examples/particles.scm b/examples/particles.scm
deleted file mode 100644
index 17a043d..0000000
--- a/examples/particles.scm
+++ /dev/null
@@ -1,84 +0,0 @@
-;;; Sly
-;;; Copyright (C) 2013, 2014 David Thompson <dthompson2@worcester.edu>
-;;;
-;;; This program is free software: you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation, either version 3 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program. If not, see
-;;; <http://www.gnu.org/licenses/>.
-
-(use-modules (srfi srfi-1)
- (srfi srfi-9)
- (sly agenda)
- (sly game)
- (sly render sprite)
- (sly render texture)
- (sly vector)
- (sly window))
-
-(load "common.scm")
-
-(set! *random-state* (random-state-from-platform))
-
-(define window-width 640)
-(define window-height 480)
-
-;;;
-;;; Particles
-;;;
-
-(define-record-type <particle>
- (make-particle sprite position velocity)
- particle?
- (sprite particle-sprite)
- (position particle-position set-particle-position!)
- (velocity particle-velocity set-particle-velocity!))
-
-(define (update-particle! particle)
- (set-particle-position! particle
- (v+ (particle-position particle)
- (particle-velocity particle))))
-
-(define (generate-particles n)
- (let ((particle-image (load-texture "images/bullet.png")))
- (list-tabulate n (lambda (n)
- (make-particle (make-sprite particle-image)
- (vector (random window-width)
- (random window-height))
- (vector (* (random:normal) 1)
- (* (random:normal) 1)))))))
-
-(define particle-count 500)
-(define background (load-sprite "images/stars.png"
- #:anchor #(0 0)))
-(define particles (generate-particles particle-count))
-
-(define (draw-particles particles)
- (for-each
- (lambda (p)
- (let* ((sprite (particle-sprite p)))
- (draw-sprite (set-sprite-position sprite (particle-position p)))))
- particles))
-
-(define (draw dt alpha)
- (draw-sprite background)
- (draw-particles particles))
-
-(define (update)
- (for-each update-particle! particles))
-
-(schedule-each update)
-(add-hook! draw-hook draw)
-
-(with-window (make-window #:title "Particles"
- #:resolution (vector window-width
- window-height))
- (start-game-loop))