问题
I am making a game in eclipse with LWJGL and I would like to know how to make the screen go full screen by changing some of the following code. Could you help, please?
public static void main(String args[]) {
AppGameContainer appgc;
try{
appgc = new AppGameContainer(new Game(gamename));
appgc.setDisplayMode(700, 500, false);
appgc.start();
}catch(SlickException e){
e.printStackTrace();
}
}
回答1:
The JavaDoc says that the 3th param of setDisplayMode
indicates the fullscreen flag. Try putting it on true.
回答2:
You can enable fullscreen mode by calling Display.setFullscreen(true);
.
Also, be sure to set display mode with resolution supported in fullscreen mode.
Ref: http://www.lwjgl.org/wiki/index.php?title=LWJGL_Basics_5_%28Fullscreen%29
Edit: After I've seen your edit (with snippet), you need to call appgc.setFullscreen(true);
(doc).
So it all looks like this:
public static void main(String args[]) {
AppGameContainer appgc;
try {
appgc = new AppGameContainer(new Game(gamename));
appgc.setDisplayMode(800, 600, false);
appgc.setFullscreen(true);
appgc.start();
}
catch(SlickException e) {
e.printStackTrace();
}
}
OR
public static void main(String args[]) {
AppGameContainer appgc;
try {
appgc = new AppGameContainer(new Game(gamename));
appgc.setDisplayMode(800, 600, true);
appgc.start();
}
catch(SlickException e) {
e.printStackTrace();
}
}
回答3:
You have to search for resolutions wich is available at your display and only at those resolutions are working with fullscreen
来源:https://stackoverflow.com/questions/14787324/how-do-i-make-a-full-screen-in-lwjgl