Simplifying engine interface #14

Merged
BirDt merged 14 commits from feature/basic-samples into master 2026-04-18 09:12:01 +08:00
Showing only changes of commit e7bfc01f7b - Show all commits

View file

@ -37,15 +37,20 @@
;; Generic accessors and mutators for position, rotation, scale, anchor, and parent
;; This allows us to abstract across different transform types - (position) will work for
;; screen-transform and 2D-transform, with type checking
(export position set-position! rotation set-rotation! scale set-scale!
anchor set-anchor! parent set-parent!)
(export global-position position set-position! rotation
set-rotation! scale set-scale! anchor set-anchor!
parent set-parent!)
(define (position component)
(define (global-position component)
(assert (record? component))
(if (null? (parent component))
((rtd-accessor (record-rtd component) 'position) component)
(v+ ((rtd-accessor (record-rtd component) 'position) component)
(position (parent component)))))
(global-position (parent component)))))
(define (position component)
(assert (record? component))
((rtd-accessor (record-rtd component) 'position) component))
(define (set-position! component position)
(assert (record? component))