Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the application icon for a libGDX desktop application?

Tags:

java

libgdx

lwjgl

I am trying to setup an application icon from the -desktop specific class with:

package org.osgameseed.games.animalflip;

import com.badlogic.gdx.Files;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

public class Main {
    public static void main(String[] args) {
        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
        cfg.title = "AnimalFlip";
        cfg.useGL20 = false;
        cfg.width = 800;
        cfg.height = 600;
        cfg.addIcon("data/ic_launcher.png", Files.FileType.Internal);

        new LwjglApplication(new AnimalFlipGame(), cfg);
    }
}

The icon is not set (at least on Linux), any idea on how to set it ?

like image 817
João Pinto Avatar asked Aug 15 '13 10:08

João Pinto


1 Answers

Take a look into the api (addIcon(...)):

Adds a window icon. Icons are tried in the order added, the first one that works is used. Typically three icons should be provided: 128x128 (for Mac), 32x32 (for Windows and Linux), and 16x16 (for Windows).

Maybe your icon has the wrong dimensions, so it won't get set. Else it should work!

Just to mention you just set the small icon in the left upper edge (if the application is started) with it not the icon you would see at the desktop!
the small icon

like image 111
BennX Avatar answered Oct 08 '22 01:10

BennX