Skip to content

tecs.controller: release an action when a rebind takes away what held it - #19

Open
albanmgicquel wants to merge 1 commit into
tecs-dev:mainfrom
albanmgicquel:controller-rebind-release
Open

albanmgicquel wants to merge 1 commit into
tecs-dev:mainfrom
albanmgicquel:controller-rebind-release

Conversation

@albanmgicquel

Copy link
Copy Markdown
Collaborator

A rebind that took a held input away from an action turned isDown false but never fired isReleased, so a game waiting for the release never saw it: a plunger that launches on release, or a flipper that stays up.

Changes

  • rebind releases what it takes away. Every action that was down before the rebind and isn't after it fires one release, including an action dropped from the mapping and a held axis binding that was removed. An action still held through another binding fires nothing. A held input newly bound to an action still produces no press.
  • input.Edge: a new Input:newEdge() returns an edge with fire() and fired(layer?). A fired edge reads like a physical one: true until the next beginFrame, latched until the end of the next fixed step, and cleared when the blocking layer changes. The controller fires its rebind releases through it, so they follow the same frame and fixed-step rules as key releases.
  • Reading the old mapping skips hat bindings, so rebind never raises on them.
  • Docs: the rebind and isReleased docblocks, the controller guide and the input guide.

Tests

  • New: a release on a removed key, on a removed pad button, on an action removed from the mapping, in the fixed-step tier; no release for an action still held through another binding; no press for a newly bound held input; and the Edge contract.
  • On macOS ARM64: nupp check and nupp task format-check are clean, and nupp test passes all 1,064 tests.
  • docs-check doesn't run in my local setup: it stops on a missing lunamark rock in the Nupp checkout, and main stops there too. The Rust gates weren't run, since this PR changes no Rust.

Releases came only from a bound input's edges, so a rebind that removed the
binding holding an action down turned isDown false without isReleased ever
firing, and a game waiting for the release never saw it.

Rebind now compares each action before and after the new mapping and fires one
release for an action that was down and no longer is, including one the new
mapping leaves out. The release reads through a new input.Edge, an edge Input
tiers but does not fold from events: it reads in the frame tier until the next
beginFrame, latches until the end of the next fixed step, and clears when the
blocking layer changes, like a physical edge. A held input newly bound still
reports no press.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant