Screen helpers · interface
PixelCursorOptions
Pixel art from a string grid, as a CSS cursor value.
Explained in Recording and clips.
interface PixelCursorOptionsimport type { PixelCursorOptions } from '@driftengine/core';In depth
Generated rather than shipped as a PNG. Two reasons, and the second is the one that matters: a generated cursor costs no asset and no request, and it can be recoloured at runtime — so it belongs to whatever palette the game is currently wearing instead of being a fixed image that clashes with half of them.
Rendered at the device pixel ratio and declared through image-set, so it is
crisp on a retina display. A bitmap authored at 1x is upscaled smoothly by
the browser, which is precisely the wrong thing to do to pixel art.
Properties
| Name | Type | Description |
|---|---|---|
scalereadonlyoptional | number | Device-independent pixels per art pixel. |
hotspotXreadonlyoptional | number | The art pixel that sits under the pointer. Defaults to the centre. |
hotspotYreadonlyoptional | number | |
fallbackreadonlyoptional | string | Keyword used when the image cannot be built. |