Reputation: 1
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();
}
}
Upvotes: 0
Views: 3392
Reputation: 139
You have to search for resolutions wich is available at your display and only at those resolutions are working with fullscreen
Upvotes: 0
Reputation: 2511
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();
}
}
Upvotes: 1
Reputation: 68907
The JavaDoc says that the 3th param of setDisplayMode
indicates the fullscreen flag. Try putting it on true.
Upvotes: 1