From 38eee24832fe6da4f135cae455881ab97953b23a Mon Sep 17 00:00:00 2001 From: Gene Pasquet Date: Sat, 18 Apr 2026 02:47:10 +0100 Subject: Refresh docs and re-indent --- demo/animation.scm | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) (limited to 'demo/animation.scm') diff --git a/demo/animation.scm b/demo/animation.scm index f2048d6..6d8e389 100644 --- a/demo/animation.scm +++ b/demo/animation.scm @@ -1,33 +1,21 @@ (import scheme (chicken base) - (chicken pretty-print) (only srfi-1 iota) - (only (list-utils alist) plist->alist) (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") downstroke-engine downstroke-world downstroke-renderer downstroke-entity - downstroke-prefabs - downstroke-scene-loader - downstroke-tilemap - downstroke-animation) + downstroke-prefabs + downstroke-scene-loader + downstroke-tilemap) ;; ── State ──────────────────────────────────────────────────────────────────── (define *label-font* #f) (define *title-font* #f) -(define (make-demo-entity x y tw th id) - (plist->alist (list #:type 'demo-bot - #:x x #:y y #:width tw #:height th - #:vx 0 #:vy 0 - #:gravity? #t #:on-ground? #f - #:solid? #t #:immovable? #f - #:tile-id 1 - #:demo-id id #:demo-since-jump 0))) - (define (make-demo-tilemap ts tw th gw gh) (let* ((ncols (inexact->exact (ceiling (/ gw tw)))) (nrows (inexact->exact (ceiling (/ gh th)))) @@ -51,11 +39,10 @@ (th (tileset-tileheight ts)) (tex (create-texture-from-tileset (game-renderer game) ts)) (tm (make-demo-tilemap ts tw th (game-width game) (game-height game))) - (entities (list (instantiate-prefab prefabs 'std-frames 80 80 tw th) - (instantiate-prefab prefabs 'timed-frames 220 60 tw th)))) - (pp entities) + (entities (list (instantiate-prefab prefabs 'std-frames 80 80 tw th) + (instantiate-prefab prefabs 'timed-frames 220 60 tw th)))) (make-scene - entities: entities + entities: entities tilemap: tm tileset: #f camera: (make-camera x: 0 y: 0) @@ -65,17 +52,13 @@ (define *game* (make-game - title: "Demo: Tweens" width: 640 height: 480 + title: "Demo: Animation" width: 640 height: 480 preload: (lambda (_game) - (set! *title-font* (ttf:open-font "demo/assets/DejaVuSans.ttf" 22)) - (set! *label-font* (ttf:open-font "demo/assets/DejaVuSans.ttf" 13))) + (set! *title-font* (ttf:open-font "demo/assets/DejaVuSans.ttf" 22)) + (set! *label-font* (ttf:open-font "demo/assets/DejaVuSans.ttf" 13))) create: (lambda (game) - (game-scene-set! game (make-demo-scene game))) - - update: (lambda (game dt) - (let ((scene (game-scene game))) - (game-scene-set! game (scene-map-entities scene (cut apply-animation <> <> dt))))))) + (game-scene-set! game (make-demo-scene game))))) (game-run! *game*) -- cgit v1.2.3