Loading...
Searching...
No Matches

Detailed Description

The pointers over an output: the mouse and the touch points, in the layout of vertexshaderart's touch history (greggman/vertexshaderart, src/js/main.js, addTouchPosition / addTouchPressure / getTouchIndex). Slot 0 is the mouse or the first finger, slot 1 the second finger, and so on, 32 of them.

Positions are in clip space: x and y in [-1, 1], y up (main.js x * 2 - 1, y * -2 + 1 over the canvas). A slot keeps its last position when released; only its pressure drops to 0, as on the site.

The window writes from the GUI thread, a renderer reads a snapshot from the render thread.

Classes

struct  Slot
 

Public Member Functions

void move (int slot, float x, float y) noexcept
 
void press (int slot, float pressure) noexcept
 
int slotForTouch (int id) noexcept
 
void releaseTouch (int id) noexcept
 
std::array< Slot, slots > snapshot () const noexcept
 

Static Public Member Functions

static QPointF toClip (QPointF win, QSizeF sz) noexcept
 Window position -> clip space over a window of size sz.
 

Static Public Attributes

static constexpr int slots = 32
 

Member Function Documentation

◆ slotForTouch()

int score::gfx::PointerState::slotForTouch ( int  id)
inlinenoexcept

Slot of the touch point id, allocating the first free one (main.js getTouchIndex). All slots taken: start over, as the site does.


The documentation for this struct was generated from the following file: