Categories
Game Creation Mastering Development

LibGDX Change mouse cursor to custom image……and keep it there

I’m able to create a custom cursor no problem using the following code running in my GameScreen’s Show method: Pixmap pixmap = new Pixmap(Gdx.files.internal("ui/cursor.png")); Cursor cursor = Gdx.graphics.newCursor(pixmap, pixmap.getWidth() / 2, pixmap.getHeight() / 2); Gdx.graphics.setCursor(cursor); pixmap.dispose(); The problem is…if I deselect the game window and return back…the cursor has returned back to the default one. […]