API Reference › Input › Input.poll
method

Input.poll

Input.poll() -> int

Advances the input by one frame and returns the frame's key. Call it once at the top of a frame; the action reads (Input.down, Input.pressed) then report on the key it captured. It is the single place input crosses into the frame, which is what makes recording and replay possible: in record mode it saves the live key, and in replay mode it takes the next key from the tape instead of the device — so "read input" and "read a recorded snapshot" are the same call.

Example

program Poll {
  entry {
    Input.bind("up", 'w')
    Input.poll()
    if Input.down("up") { print(1) }
  }
}
← All symbols