最小化Java窗口后的白屏

时间:2014-05-05 00:57:53

标签: java

我正在使用LWJGL制作一个小游戏,一切都运行顺畅而精细,但是当我尝试最小化并最小化它时,屏幕变成白色并且没有显示出来。

这是我的主要课程:

package net.battleboy;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Main extends StateBasedGame {

    public static final String gamename = "Battle Boy 1.0 ALPHA";
    public static final int menu = 0;
    public static final int play = 1;
    public static final int settings = 2;
    public static final int LoadingScreen = 3;

    public Main(String gamename) {

        super(gamename);
        this.addState(new Menu(menu));
        this.addState(new Play(play));
        this.addState(new Settings(settings));
        this.addState(new LoadingScreen(LoadingScreen));

    }

    public void initStatesList(GameContainer gc)throws SlickException {

        this.getState(menu).init(gc, this);
        this.getState(play).init(gc, this);
        this.getState(settings).init(gc, this);
        this.getState(LoadingScreen).init(gc, this);
        this.enterState(LoadingScreen);

    }

    public static void main(String[] args) {
        AppGameContainer appgc;
        try {
            appgc = new AppGameContainer(new Main(gamename));
            appgc.setIcon("res/icon.png");
            appgc.setDisplayMode(840, 470, false);
            appgc.start();
        }catch(SlickException e) {
            e.printStackTrace();
        }

    }
}

我有4个状态,每个状态似乎都变白了。即使一切都被初始化了。

当我的课程设置不合适或者我做错了什么时,我有什么遗漏的吗?

(如果需要,我会发布任何其他课程)

0 个答案:

没有答案