Skip to main content

plane_origin

Function plane_origin 

Source
pub fn plane_origin(pointer: (i32, i32), hotspot: (u32, u32)) -> (i32, i32)
Expand description

Where the plane’s top-left corner goes, given where the pointer is.

The hotspot is the pixel that has to land under the pointer – the tip of the arrow, the center of a crosshair – so the plane is offset back by it. Getting this wrong is invisible in a screenshot and obvious the moment anyone clicks: the sprite looks right and the click lands somewhere else.

The result is signed and may be negative, which is correct: a cursor near the top-left of the screen has its buffer hanging off the edge.