HoverIO.load

Load a hover pointer (mouse cursor, finger) and place it at the position currently indicated in the struct. Update the pointer's position if already loaded.

It is expected load will be called after every pointer motion in order to keep its position up to date.

A pointer is considered loaded until the next resize. If the load call for a pointer isn't repeated during a resize, the pointer is invalidated. Pointers do not have to be loaded while resizing; they can also be loaded while drawing.

An example implementation of a pointer device, from inside of a node, could look like:

HoverIO hoverIO;
HoverPointer pointer;

override void resizeImpl(Vector2) {
    require(hoverIO);
    minSize = Vector2();
}

override void drawImpl(Rectangle, Rectangle) {
    pointer.device = this;
    pointer.number = 0;
    pointer.position = mousePosition();
    load(mouseIO, pointer);
    if (clicked) {
        mouseIO.emitEvent(pointer, MouseIO.createEvent(MouseIO.Button.left, true));
    }
}
interface HoverIO
int
load

Parameters

pointer HoverPointer

Pointer to prepare. The pointer's device field should be set to whatever node represents this device, and the number field should be set to whatever number the device can associate with the pointer, if multiple pointers are to be used.

Return Value

Type: int

An ID the HoverIO system will use to recognize the pointer.

Meta