Java – how do I set the application icon for a libgdx desktop application?

I'm trying to set an application icon from a - Desktop specific class:

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 ideas on how to set it?

Solution

Look at the API (addicon (...):

Maybe the size of your icon is wrong, so it won't be set Otherwise it should work!

Just mention that you only need to set a small icon on the upper left edge (if the application starts), it is not the icon seen on the desktop!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>