ecs/xworld
src/ecs/xworld.tur
world-keyed component accessors for cross-world systems.
Since: X1
defn
box-world
(box-world [W])
box a world's carrier value onto the heap and return
Since: GEN-V0
defn
load-world
(load-world [W])
dereference a `box-world` carrier back into the typed
Since: GEN-V0
defn
free-world-box
(free-world-box [W])
release the heap-allocated world carrier produced
Since: GEN-V0
defmacro
defworld-box-helpers
(defworld-box-helpers [world-name])
emit the per-world `box-<W>` / `load-<W>` /
Example
(sized-defworld-mono SimWorld (Static 1024) [Pos]) (defworld-box-helpers SimWorld) ;; box-SimWorld : (SimWorld) -> int ;; load-SimWorld : (int) -> SimWorld ;; free-SimWorld-box : (int) -> nil The names match the convention `defxsystem` / `sized-defsystem-scheduled` expect, so a cross-world setup needs only the macro call instead of the three hand-written inline-C blocks the tests have historically carried (see `tests/xworld-extract.tur` for the legacy shape).
Since: GEN-V0
defmacro
sized-defcomponent-accessors-xmono
(sized-defcomponent-accessors-xmono [world-name comp-name])
emit world-keyed get/set/has
Example
(sized-defworld-mono RenderWorld (Static 1024) [RenderPos]) (sized-defcomponent-accessors-xmono RenderWorld RenderPos) ;; get-RenderPos : (XReadCap RenderWorld RenderPos) RenderWorld Slot -> RenderPos ;; set-RenderPos!: (XWriteCap RenderWorld RenderPos) RenderWorld Slot RenderPos -> nil
Since: X1