简体   繁体   English

Libgdx - 桌面应用程序无法启动

[英]Libgdx - Desktop Application doesn't launch

I'm trying to start a libgdx project in IntelliJ. 我正在尝试在IntelliJ中启动一个libgdx项目。 I used the libgdx setup to generate the project and imported it in IntelliJ but the desktop application doesn't run. 我使用libgdx设置生成项目并将其导入IntelliJ,但桌面应用程序不运行。 Everything runs fine, no error or exception but there is no game window at all. 一切运行良好,没有错误或异常,但根本没有游戏窗口。

The application is declared for a few seconds as running but then terminates without any sign of error with the exit code -1073740791 (and no LWGJL window of course). 应用程序在运行时声明几秒钟,但随后退出代码-1073740791(当然没有LWGJL窗口)终止而没有任何错误迹象。

This is my code: 这是我的代码:

package com.game.pole.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.game.pole.Game;

public class DesktopLauncher {

public static void main (String[] arg) {
        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
        config.title = "Game";
        config.useGL30 = false;
        config.width = 480;
        config.height = 320;
        new LwjglApplication(new Game(), config);
    }
}

And the ApplicationClass: 和ApplicationClass:

package com.game.pole;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

    public class Game extends ApplicationAdapter {
        SpriteBatch batch;
        Texture img;

        @Override
        public void create () {
            batch = new SpriteBatch();
            img = new Texture("badlogic.jpg");
            System.out.println("Hallo!");
        }

        @Override
        public void render () {
            Gdx.gl.glClearColor(1, 0, 0, 1);
            Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
            batch.begin();
            batch.draw(img, 0, 0);
            batch.end();
        }

        @Override
        public void dispose () {
            batch.dispose();
            img.dispose();
        }
    }

I tried to run the game from the command line as well - the build is successfull but nothing more happens here either. 我试图从命令行运行游戏 - 构建是成功的,但这里也没有发生任何事情。

I'm really stuck und would be thankful for every kind of help. 我真的被困了,我会感激各种帮助。

EDIT: Moreover I tried to generate a Eclipse Project to check if it is an IntelliJ problem, but I've got the same problem here as well... 编辑:此外,我试图生成一个Eclipse项目,以检查它是否是一个IntelliJ问题,但我在这里也有同样的问题...

There is some bug in Nvidia GeForce 378.49 driver. Nvidia GeForce 378.49驱动程序中存在一些错误。 Reverting to an older version of the driver can solve this issue. 恢复到旧版本的驱动程序可以解决此问题。

Nvidia Geforce 378.57 Hot Fix Drivers: Nvidia Geforce 378.57热修复驱动程序:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM