Builtin Library
README.md
pointer
Pointer-lock mutation API. Wraps the internal
__zero_input.requestPointerLock / releasePointerLock primitives and
backs Zin.pointer. The read side lives on Zin.state.pointerLocked();
this module owns the write side plus a convenience read alias.
Exports
M.lock()— request pointer lock (cursor grab + hide). Native takes effect immediately; WASM queues for the next user gesture.M.unlock()— release pointer lock (cursor ungrab + show).M.locked() -> boolean— convenience read alias, identical toZin.state.pointerLocked().
Usage
local Pointer = require("@builtin::modules.zinput.pointer")
Pointer.lock()
if Pointer.locked() then
-- pointer captured
end
Pointer.unlock()
Notes
- Native:
lock()takes effect immediately. WASM: queued for the next user gesture (browser policy). Both routes share the same underlying FFI mutation; the platform enforces the difference. - Write side and read side are intentionally split:
Zin.state.pointerLocked()stays alongside the rest of the per-frame snapshot accessors; mutation lives here for discoverability. - All entry points are no-ops when the
__zero_inputFFI is absent (off-host script execution).