feat(input,ecs): #79 Input.axis_i directional int + #84 world bounds
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 23s
ci / build-and-test (push) Successful in 2m23s
commit-lint / conventional-commits (push) Successful in 5s
docs / build-and-deploy (push) Successful in 28s

#79 — Input.axis_i(neg,pos) -> int returns a -1/0/1 movement intent from the
multi-key device set, so WASD-to-movement needs no bool->int glue and feeds an
int mover directly (dx = Input.axis_i('a','d')).

#84 — a Bounds config entity (rect + policy, from ludic.core) drives the
engine-owned world-bounds system (LateUpdate): clamp / wrap / bounce (clamp +
flip Body velocity) / kill (despawn a body fully outside). Reads the Collider
size so the box stays inside; off by default, spliced only when Bounds is
declared (byte-identical otherwise). Adds World.despawn(e) — the by-id
reflective despawn (runs @OnDespawn + frees) via a new world_despawn intrinsic
whose @fn_world_despawn helper is emitted in emit_program's tail once a use is
seen (the g_uses_* prelude pattern), used by the kill policy and callable from
any system.

Examples input_movement + world_bounds. Full suite 112/0, goldens
byte-identical, fixpoint holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-02 07:44:41 +03:00
parent 0497029dae
commit ad3be0c53c
17 changed files with 30435 additions and 29731 deletions

View file

@ -13,6 +13,7 @@ function is_intrinsic(name: pointer) -> bool {
if (name == "arg_count") or (name == "arg") or (name == "exit") { return true }
if (name == "file_stderr") or (name == "file_stdout") { return true }
if (name == "run") or (name == "getenv") { return true }
if (name == "world_despawn") { return true } # #84 — despawn an entity by id from a system
return false
}
# emit " <r> = <rest>\n" and return r
@ -56,6 +57,15 @@ function emit_intrinsic(name: pointer, e: Node) -> Val {
emit(" call i32 @fclose(ptr "); emit(f); emit(")\n")
return val("0", "void")
}
# #84 — despawn an entity by id (runs its @OnDespawn hooks + frees the slot),
# callable from a system (esys_bounds kill) or as World.despawn(e). The helper
# @fn_world_despawn is emitted with the ECS defs when g_uses_world_despawn.
if (name == "world_despawn") {
g_uses_world_despawn = true # emit @fn_world_despawn in the tail (after all uses seen)
let ent = arg_code(e, 0)
emit(" call void @fn_world_despawn(i32 "); emit(ent); emit(")\n")
return val("0", "void")
}
# print_str / print_int are the polymorphic `print(x)` builtin now (emit_call).
if (name == "arg_count") { return val(emit_bind("load i32, ptr @L_argc"), "int") }
if (name == "arg") {