summaryrefslogtreecommitdiff
path: root/examples/tilemap.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-09-21 19:44:10 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-09-21 19:48:44 -0400
commit46544b7dba0081f22e686f70c606a338c7fa52dd (patch)
tree9688f43493606f7b0e4da8784a7804cc32f128eb /examples/tilemap.scm
parentb7bf25020f146331d161d86ef30df31d2959a8dc (diff)
render: Reimplement rendering engine using functional combinators.
Warning: This is a huge commit. I completely gutted the old scene graph and replaced it with a somewhat monadic rendering combinator module instead. The interface remains purely functional, but replaces the <model> data type with procedures in the rendering monad instead. This opens the door for rendering *anything*, not just meshes. Now I can implement particle systems and other non-static things.
Diffstat (limited to 'examples/tilemap.scm')
-rw-r--r--examples/tilemap.scm19
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/tilemap.scm b/examples/tilemap.scm
index 7c32b11..2e6bdf9 100644
--- a/examples/tilemap.scm
+++ b/examples/tilemap.scm
@@ -24,16 +24,15 @@
(sly window)
(sly signal)
(sly utils)
+ (sly render)
(sly render camera)
(sly render color)
- (sly render model)
(sly render mesh)
(sly render shader)
(sly render sprite)
(sly render texture)
(sly render tileset)
(sly render tile-map)
- (sly render scene)
(sly math vector)
(sly math tween)
(sly input keyboard))
@@ -90,16 +89,16 @@
(193 225 225 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65)
(225 225 176 242 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65))))
-(define model
- (model-move (v- (vector2 320 240)
- (v* (vector2 tile-width tile-height)
- (vector2 10 15/2)))
- (list->model (compile-tile-layer map-tiles 32 32))))
+(define render
+ (move (v- (vector2 320 240)
+ (v* (vector2 tile-width tile-height)
+ (vector2 10 15/2)))
+ (list->renderer (compile-tile-layer map-tiles 32 32))))
-(define camera
- (orthographic-camera 640 480))
+(define camera (2d-camera #:area (make-rect 0 0 640 480)))
-(define-signal scene (make-scene camera model))
+(define-signal scene
+ (with-camera camera render))
(with-window (make-window #:title "Tilemap")
(run-game-loop scene))