Search code examples
javaeclipselibgdx

Running libgdx application desktop and Android


Created a new libgdx project to create a multi-platform game, but when I try to run it I get no errors but nothing runs. for example I open a android emulator, right click on android program => run as => android application. Then the progress bar loads up in eclipse to 100%, disappears as the application has ran but nothing. And for desktop I right click on desktop program => run as => java application => DesktopLauncher. and again nothing...

Here's the desktop launcher:

package com.mkgame.game1.desktop;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.mkgame.game1.Game1;

public class DesktopLauncher {
    public static void main (String[] arg) {
        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
        cfg.title = "Game1";
        cfg.width = 1920;
        cfg.height = 1020;
        cfg.useGL30 = true;
    }
}

Solution

  • Your launcher is missing this line of code at the end of the function:

    new LwjglApplication(new Game1(), cfg);