I need to change my mouse cursor to a custom image.
If possible I would like to do it on a spritesheet.
I can’t do it from the css because I’m using it in a game. I already know how to decide when etc.
What I need to know is how do I change the cursor to an image, and deciding the image position and size?
Is there any easy solution similar to the drawImage’s image position?
You can set the CSS using javascript to hide the cursor:
You can then get the cursor’s position (it’s now hidden) with something like this:
Then you can modify your canvas to show your fancier cursor sprite at that location.
GetTopLeft is defined as follows:
Though I can’t remember where I copied the GetTopLeft function from…