summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-09-22 18:28:24 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-09-22 18:28:24 -0400
commitda1f0449e981b64b58735b0289a59ce5f4a7f433 (patch)
treec58ccd2396702e5fa47b23bc9c030a47938eb61a /examples
parenta7bd9064213350577499a4de946a03cd7ff319c1 (diff)
examples: Update simple example.
* examples/simple.scm: Update.
Diffstat (limited to 'examples')
-rw-r--r--examples/simple.scm30
1 files changed, 24 insertions, 6 deletions
diff --git a/examples/simple.scm b/examples/simple.scm
index 6fece03..09554d3 100644
--- a/examples/simple.scm
+++ b/examples/simple.scm
@@ -15,17 +15,35 @@
;;; along with this program. If not, see
;;; <http://www.gnu.org/licenses/>.
-(use-modules (sly game)
+(use-modules (sly camera)
+ (sly game)
+ (sly rect)
+ (sly scene)
(sly sprite)
+ (sly transform)
(sly vector)
- (sly window))
+ (sly window)
+ (sly color))
(load "common.scm")
-(define sprite (load-sprite "images/p1_front.png"
- #:position #(320 240)))
+(define scene
+ (scene-root
+ (scene-node
+ (position #(320 240))
+ (uniforms `(("color" ,white)))
+ (children
+ (list (load-sprite "images/p1_front.png"))))))
-(add-hook! draw-hook (lambda (dt alpha) (draw-sprite sprite)))
+(define camera
+ (make-camera scene
+ identity-transform
+ (orthographic-projection 0 640 0 480 0 1)
+ (make-rect 0 0 640 480)))
(with-window (make-window #:title "Simple Sprite Demo")
- (start-game-loop))
+ (start-game-loop camera))
+
+;;; Local Variables:
+;;; compile-command: "../pre-inst-env guile simple.scm"
+;;; End: