setMousePosition method

void setMousePosition(
  1. Offset startingPos,
  2. Offset pos,
  3. PointerEventType eventType,
  4. Size twSize,
)

**** SET MOUSE POS Set the iMouse uniform Shows how to use the mouse input (only left button supported):

 mouse.xy  = mouse position during last button down

abs(mouse.zw) = mouse position during last button click sign(mouze.z) = button is down sign(mouze.w) = button is clicked

This is automatically processed by OpenGLTexture widget

For reference: https://www.shadertoy.com/view/llySRh https://www.shadertoy.com/view/Mss3zH

Implementation

void setMousePosition(
  Offset startingPos,
  Offset pos,
  PointerEventType eventType,
  Size twSize,
) {
  return _setMousePosition(
    pos.dx,
    pos.dy,
    eventType == PointerEventType.onPointerDown ||
            eventType == PointerEventType.onPointerMove
        ? startingPos.dx
        : -startingPos.dx,
    -startingPos.dy,
    twSize.width,
    twSize.height,
  );
}