Input->movement ergonomics: avoid bool->int boilerplate (directional int / axis returning int) #79
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#79
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Turning WASD into a -1/0/1 movement intent currently needs glue like
function ki(b: bool) -> int { if b {return 1}; return 0 }thendx = ki(key_down('d')) - ki(key_down('a')).Input.axis/Input.vectorexist but returnfixed, while movers likeTopDown.movetakeint, so games write conversion boilerplate.Proposal: an ergonomic path — e.g.
Input.axis_i(neg,pos) -> int, movers accepting the fixed vector directly, or a clean bool->int coercion — so directional input reads without helper functions.Shipped in
ad3be0c(full suite 112/0, goldens byte-identical, fixpoint intact).Input.axis_i(neg, pos) -> intreturns a directional intent as a plain int:+1when the positive key is held,-1the negative,0for neither or both. It reads the multi-key device set, so it replaces theki(key_down('d')) - ki(key_down('a'))bool->int boilerplate and feeds an int mover directly:Complements
Input.axis(fixed) /Input.vector(normalized) for the analog path. Verified byexamples/library/input_movement.ludic(prints1 0 -1 -1 0— right, none, left, up, and opposing keys cancelling). Docs page added.