Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+4)

There is a pointerEvents module for mouse and touch events. It is not documented because I didn't tested it enough and might change a bit in the future. Current usage is as follow:

var pointerEvents = require("pixelbox/pointerEvents");
 
pointerEvents.onPress(function (x, y, pointerID, event) { ... });
pointerEvents.onRelease(function (x, y, pointerID, event) { ... });
pointerEvents.onMove(function (x, y, pointerID, event) { ... });
pointerEvents.onCancel(function (pointerID, event) { ... });
 
// pointerEvents also exposes a pointer object containing the mouse position
console.log(pointerEvents.pointer);