Creating the maximum lwjgl window

How can I create the lwjgl window as much as possible or make the already created screen as programmatically as possible?

Note: im does not ask how to set the full screen mode for display.

+4
source share
3 answers

Display.setResizable (true)

This will allow you to use the maximize button.

+1
source
Dimension screenDimensions = Toolkit.getDefaultToolkit().getScreenSize(); screenDimensions.width; screenDimensions.height; // this gets the height and width of your screen // and Display.setDisplayMode(new DisplayMode(screenDimensions.width, screenDimensions.height)); 
0
source

I used the LWJGL sample from the website, it gets the possible display modes and sets it to the best in full screen. Just create anoother class and use this code!

 public class DisplayConfig { //This is the Class that lets us switch between full screen //and window mode. public void setDisplayMode(int width, int height, boolean fullscreen){ //If the display mode we are trying to achieve is already running //we just jump straight back out. if((Display.getDisplayMode().getWidth() == width) && (Display.getDisplayMode().getHeight() == height) && (Display.isFullscreen() == fullscreen)){ return; } try{ DisplayMode targetDisplayMode = null; //if we are in full screen mode we will have to check and iterate //through the computers available display modes to get back to //where we started if(fullscreen){ DisplayMode[] modes = Display.getAvailableDisplayModes(); int freq =0; for (DisplayMode displayMode : modes) { System.out.println(displayMode.getWidth()+" "+displayMode.getHeight()); } for (int i = 0; i < modes.length; i++) { DisplayMode current = modes[i]; if((current.getWidth() == width) && (current.getHeight() == height)){ if((targetDisplayMode == null) || (current.getFrequency() >= freq)){ if((targetDisplayMode == null) || (current.getBitsPerPixel() > targetDisplayMode.getBitsPerPixel())){ targetDisplayMode = current; freq = targetDisplayMode.getFrequency(); } } if((current.getBitsPerPixel() == Display.getDesktopDisplayMode().getBitsPerPixel()) && (current.getFrequency() == Display.getDesktopDisplayMode().getFrequency())){ targetDisplayMode = current; break; } } } } else { targetDisplayMode = new DisplayMode(width, height); } if (targetDisplayMode == null){ System.out.println("Failed to find value mode: "+width+"x"+height+" fs="+fullscreen); return; } Display.setDisplayMode(targetDisplayMode); Display.setFullscreen(fullscreen); } catch (LWJGLException e){ System.out.println("Unable to setup mode "+width+"x"+height+" fullscreen="+fullscreen + e); } } } 

http://lwjgl.org/wiki/index.php?title=LWJGL_Basics_5_(Fullscreen)

0
source

All Articles