add: small window test - wanted to test how fast a display is created

This commit is contained in:
Brian Matzon 2003-03-24 17:16:42 +00:00
parent f40973624c
commit 6e37721123
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
/*
* Created on 18-03-2003
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code Template
*/
package org.lwjgl.test;
import org.lwjgl.*;
/**
* @author Brian
*/
public class WindowCreationTest {
public static void main(String[] args) {
DisplayMode[] modes = Display.getAvailableDisplayModes();
System.out.println("Found " + modes.length + " display modes");
//find 640*480*32*100
DisplayMode mode = modes[0];
for(int i=0;i<modes.length;i++) {
if(modes[i].width == 640 &&
modes[i].height == 480 &&
modes[i].bpp == 16 &&
mode.freq <= modes[i].freq) {
mode = modes[i];
}
}
if(mode == null) {
System.out.println("Unable to find displaymode with following features: 640*480*16*60");
System.exit(-1);
}
System.out.println("mode: " + mode);
try {
Display.create(mode, 0, 0, 0, false, "WindowCreationTest");
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Display created");
Display.destroy();
}
}