How to change the cursor icon? #2672
Answered
by
eonarheim
max-vogler
asked this question in
Q&A
-
Is there a way to change the mouse/pointer cursor icon? It'd be neat to use a spritesheet or animation! Or should I fall back to CSS |
Beta Was this translation helpful? Give feedback.
Answered by
eonarheim
Jun 28, 2023
Replies: 1 comment 1 reply
-
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 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;
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
max-vogler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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