flickShot input: reads the pointer (touch first, then mouse) and the
gamepad once a frame from the engine's input state (`Zin.touch`,
`Zin.state`), carries pointer positions into the space the camera projects
in (scaled by the render scale on engines without a render-size call),
works out which of this peer's shooters a press
belongs to (generous finger-sized grab radius, `anywhere` shooters last),
and drives that shooter's state machine. Also keeps the shared camera
`view` every shooter's maths and visuals read. Internal: games use
`flickShot.api`.
fromViewportScale( ) → number
Builds disagree about which pixels a pointer arrives in (an Android engine
delivers touches and the mouse in displayed pixels, a browser delivers the
mouse in the projection's own pixels), so the kit reads it from the engine's
own pointer -> UI mapping: `ui.fromViewport` carries a pointer position into
UI points in every build (it is what puts a press on the right button), and
UI points carry into projection pixels by getViewportSize() / ui.screenSize().
measuredScale( ) → number
Projection pixels per pointer pixel as measured right now: the engine's own pointer -> UI mapping (ui.fromViewport) carried into projection pixels; failing that, getViewportSize() over the viewport's displayed size (ui.screenSize() x ui.pixelRatio("window")); nil when neither can be measured.
renderSizeCall( ) → string
The name of the renderer call that answers the size the scene is rendered at ({ width, height }), or nil when this engine has none (then pointer positions are scaled by the render scale).
resolveScale( ) → void
k and where it came from, worked out once per call
pointerScaleSource( ) → string
Where the pointer scale in force comes from: "override" (pinned), "learned" (a press on the player's own ball found the measured scale wrong and the kit switched), "measured" (the pointer space was measured against the projection space; the normal case), "renderSize" (no measurement, the renderer offers a render-size call: k = 1) or "resolutionScale" (no measurement and no such call: k = render scale).
pointerScale( ) → number
Projection pixels per touch pixel for pointer positions: the override when set, else the measured ratio of getViewportSize() to the viewport's displayed size (snapped to 1 or to the render scale when within 4%), else 1 on an engine with a render-size call, else the render scale.
toRaster(x: number, y: number) → void
A pointer position in display pixels as raster pixels, the space `worldToScreen` and `screenToRay` use.
| arg | type | description |
|---|
| x | number | |
| y | number | |
ray(sx: number, sy: number) → void
| arg | type | description |
|---|
| sx | number | |
| sy | number | |
project(p: vector) → void
| arg | type | description |
|---|
| p | vector | |
refreshView( ) → void
Refreshes the camera axes, viewport size and pointer scale (the driver calls this once a frame; tests may call it).
register(rec: Rec) → void
Adds a shooter record; the first record drives the per-frame poll.
unregister(rec: Rec) → void
Removes a shooter record (cancelling an aim it held).
aimingRec( ) → Rec
The shooter this peer is aiming with right now (a meterTiming meter counts), or nil.
meteringRec(device: string) → Rec
the shooter whose power meter runs, waiting for the firing tap (meterTiming)
| arg | type | description |
|---|
| device | string | |
ballOnScreen(rec: Rec) → void
ball on screen: x, y, onScreen, radius in pixels
grabFor(s: any) → string
Where a press grabs for these settings: `anywhere` for the input modes that start away from the ball (dragAnywhere, tapTarget), else the `grab` setting.
pick(x: number, y: number) → Rec
| arg | type | description |
|---|
| x | number | |
| y | number | |
retryPick(rawX: number, rawY: number) → void
A press that grabbed nothing at the scale in force, retried in the other pointer space (positions as they are, then scaled by the render scale). When one lands on this player's own ball, the kit keeps that space for the session (`learnedMode`). Returns the shooter (or nil) and the press in projection pixels.
| arg | type | description |
|---|
| rawX | number | |
| rawY | number | |
readPointer(now: number) → void
the press, position (raster pixels) and source of the pointer this frame
| arg | type | description |
|---|
| now | number | |
endPointer(now: number, x: number, y: number) → void
| arg | type | description |
|---|
| now | number | |
| x | number | |
| y | number | |
stepPointer(now: number, dt: number) → void
| arg | type | description |
|---|
| now | number | |
| dt | number | |
stepPad(dt: number) → void
| arg | type | description |
|---|
| dt | number | |
poll(caller: Rec, now: number, dt: number) → void
One input step for every shooter on this peer; only the driver record's call does the work.
| arg | type | description |
|---|
| caller | Rec | |
| now | number | |
| dt | number | |
resetState( ) → void
Forgets the pointer and pad state (tests, scene changes).