diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-03-09 08:52:14 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-03-09 08:58:42 -0400 |
commit | d84bb24d2359be9c4be7b3e4f05caf3daf68f243 (patch) | |
tree | d57b082948ef75bdd0f9cc5d1c15a8d70d784d26 /examples/mines | |
parent | 8ac70ff3cef2963c460ce5382e37946eb0a4914e (diff) |
render: Merge <group> into <model>.
* sly/render/model.scm (<model>): Add 'transform' and 'children' fields.
(model-transform, model-children): New accessors.
(make-model): Add 'transform' and 'children' keyword arguments.
(set-transform-identity!): New procedure.
(draw-model): Recursively draw model and all children.
(model-paint, model-blend): Renamed.
(paint, blend, group, group*, move, place): New procedures.
* sly/render/group.scm: Delete.
* Makefile.am (SOURCES): Remove it.
* examples/2048/2048.scm: Update example.
* examples/animation.scm: Likewise.
* examples/font.scm: Likewise.
* examples/joystick.scm: Likewise.
* examples/mines/mines.scm: Likewise.
* examples/simple.scm: Likewise.
* examples/tilemap.scm: Likewise.
* README.org (Example): Update sample code.
Diffstat (limited to 'examples/mines')
-rw-r--r-- | examples/mines/mines.scm | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/examples/mines/mines.scm b/examples/mines/mines.scm index 97d77b0..663e146 100644 --- a/examples/mines/mines.scm +++ b/examples/mines/mines.scm @@ -37,7 +37,6 @@ (sly render camera) (sly render color) (sly render font) - (sly render group) (sly render model) (sly render sprite) (sly input keyboard) @@ -332,24 +331,24 @@ (lambda (tile) ;; A tile may or may not have an overlay, so we do a little ;; quasiquoting magic to build the right list. - (make-group + (group* `(,(tile-base-sprite tile) ,@(let ((overlay (tile-overlay-sprite tile))) (if overlay - (list (group-place offset (group overlay))) + (list (place offset (group overlay))) '()))))))) (define-signal board-view (signal-map (lambda (board) (define (draw-column tile x) - (group-move (vector2 (* x tile-size) 0) - (draw-tile tile))) + (move (vector2 (* x tile-size) 0) + (draw-tile tile))) (define (draw-row row y) - (group-move (vector2 0 (* y tile-size)) - (make-group (enumerate-map draw-column row)))) + (move (vector2 0 (* y tile-size)) + (group* (enumerate-map draw-column row)))) - (make-group (enumerate-map draw-row board))) + (group* (enumerate-map draw-row board))) board)) (define-signal status-message @@ -357,9 +356,9 @@ (define (make-message message) (label font message #:anchor 'center)) - (group-move + (move (vector2 (/ (vx resolution) 2) (- (vy resolution) 64)) - (make-group + (group* (cond ((board-lose? board) (list (make-message "GAME OVER - Press N to play again"))) @@ -372,7 +371,7 @@ (signal-map (lambda (board-view status center-position) (group status - (group-move center-position board-view))) + (move center-position board-view))) board-view status-message center-position)) (define camera @@ -382,7 +381,7 @@ #:clear-color tango-dark-plum))) (define (draw-scene dt alpha) - (draw-group (signal-ref scene) camera)) + (draw-model (signal-ref scene) camera)) ;;; ;;; Initialization |