Skip to content

How to change the cursor icon? #2672

Answered by eonarheim
max-vogler asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @max-vogler!

Good question! I think I'd stick with CSS first, unless you need to do something special.

Otherwise you could do this by positioning an Actor using the primary pointer. You can add your graphics/animations on the cursor

const game = new ex.Engine({...});
const animation = ...;

const cursor = new ex.Actor({
   radius: 100,
   color: ex.Color.Red,
   coordPlane: ex.CoordPlane.Screen
});
cursor.graphics.use(myAnimation);
game.add(cursor);
game.input.pointers.primary.on('move', evt => {
   cursor.pos = evt.screenPos;
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@max-vogler
Comment options

Answer selected by max-vogler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants