简体   繁体   中英

Libgdx - Desktop Application doesn't launch

I'm trying to start a libgdx project in IntelliJ. I used the libgdx setup to generate the project and imported it in IntelliJ but the desktop application doesn't run. 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).

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:

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...

There is some bug in Nvidia GeForce 378.49 driver. Reverting to an older version of the driver can solve this issue.

Nvidia Geforce 378.57 Hot Fix Drivers:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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