导出libGDX桌面jar文件

时间:2014-01-12 12:17:29

标签: java android libgdx

我想导出我在libgdx中所做的游戏 好吧,我进入了游戏的构建路径并勾选了所有内容 当我导出jar并双击它时,它会立即打开并存在。

看起来它甚至无法进入渲染方法,这意味着问题出现在之前 有任何想法吗?我错过了什么吗?

Main.java

package com.me.mygdxgame;

import java.awt.Dimension;
import java.awt.Toolkit;

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

public class Main { 
    public static void main(String[] args) {
        System.out.println("Initializing the Window!");
        LwjglApplicationConfiguration cfg;
        cfg = new LwjglApplicationConfiguration();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        cfg.title = "My GDX Game";
        cfg.useGL20 = true;
        cfg.width = (int) 1280;
        cfg.height = (int) 720;
        //cfg.width = (int) screenSize.getWidth();
        //cfg.height = (int) screenSize.getHeight();
        cfg.resizable = false;
        cfg.fullscreen = false;
        System.err.println("The Window has Initialized");

        System.out.println("Calling the Game!");
        new LwjglApplication(new MyGdxGame(), cfg);

    }
}

MyGdxGame.java

package com.me.mygdxgame;

import com.badlogic.gdx.Game;
import com.me.mygdxgame.screen.GameScreen;

public class MyGdxGame extends Game {

    public GameScreen game_screen;

    @Override
    public void create() {
        System.out.println("Initializing the game screen!");
        game_screen = new GameScreen(this);

        setScreen(game_screen);
    }

}

提前致谢! 如果您需要更多信息,请告诉我没问题。

0 个答案:

没有答案