From 618ed5fd6f5ae9c9f275c1e3cfb74762d7d51a01 Mon Sep 17 00:00:00 2001 From: Gene Pasquet Date: Tue, 7 Apr 2026 19:30:08 +0100 Subject: Added tweens --- entity.scm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'entity.scm') diff --git a/entity.scm b/entity.scm index 8e8011f..e4b3937 100644 --- a/entity.scm +++ b/entity.scm @@ -27,6 +27,36 @@ (define (entity-update entity key proc #!optional default) (entity-set entity key (proc (entity-ref entity key default)))) + ;; #:skip-pipelines — list of symbols naming frame pipeline steps to skip for this + ;; entity. Physics documents the built-in step names (see docs/physics.org). Other + ;; subsystems (e.g. animation, rendering) may reserve additional symbols later and + ;; use the same predicate and define-pipeline macro. + + (define (entity-skips-pipeline? entity step) + (let ((skips (entity-ref entity #:skip-pipelines '()))) + (and (pair? skips) (memq step skips)))) + + ;; er-macro-transformer so (rename 'entity-skips-pipeline?) captures the + ;; binding from THIS module — works across compiled unit boundaries. + (define-syntax define-pipeline + (er-macro-transformer + (lambda (form rename _compare) + (let* ((name-skip (cadr form)) + (name (car name-skip)) + (skip (cadr name-skip)) + (formals (caddr form)) + (f1 (car formals)) + (body (cdddr form)) + (%define (rename 'define)) + (%if (rename 'if)) + (%let (rename 'let)) + (%quote (rename 'quote)) + (%skip? (rename 'entity-skips-pipeline?))) + `(,%define (,name ,@formals) + (,%if (,%skip? ,f1 (,%quote ,skip)) + ,f1 + (,%let () ,@body))))))) + (define (make-player-entity x y width height) (list #:type 'player #:x x -- cgit v1.2.3