# How can I change the appearance of the mouse cursor in libGDX?

How can I change the mouse a cursor to a picture using libGDX?

### v1.7.0+

Pixmap pm = new Pixmap(Gdx.files.internal("cursorImage.png"));
Gdx.graphics.setCursor(Gdx.graphics.newCursor(pm, 0, 0));
pm.dispose();


### Before v1.7.0

Pixmap pm = new Pixmap(Gdx.files.internal("cursorImage.png"));
Gdx.input.setCursorImage(pm, 0, 0);
pm.dispose();


The hotspot parameters represent the "tip" of the cursor. For example, the operating system cursor has the hotspot at the top-left corner, but a crosshair cursor might have the hotspot at its center.

• Thank you! Well but I have a problem the method Gdx.input.setCursorImage(image, xPos, y Pos); give this error The method setCursorImage(Pixmap, int, int) is undefined for the type Input – user3334375 Oct 28 '14 at 10:37
• Well the function certainly exists, but it was added a year ago this month, so make sure you're using the latest version of libgdx. If you are and you're still getting that error, then I don't think I can help. – Icy Defiance Oct 28 '14 at 17:57
• Gdx.graphics.setCursor(Gdx.graphics.newCursor(pm,0,0,)); – Jonathan Camarena Jan 11 '16 at 22:07
• Is it worth keeping the pixmap in case I change often ? – Winter Jan 4 '17 at 18:50