*** empty log message ***
This commit is contained in:
parent
ba01e888fb
commit
4a13ffa90f
|
@ -134,18 +134,6 @@ public final class Sys {
|
|||
|
||||
PLATFORM = System.getProperty("org.lwjgl.Sys.platform", "org.lwjgl.SwingAdapter");
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
Display.destroy();
|
||||
if (Keyboard.isCreated())
|
||||
Keyboard.destroy();
|
||||
if (Mouse.isCreated())
|
||||
Mouse.destroy();
|
||||
if (Controller.isCreated())
|
||||
Controller.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,6 +64,11 @@ public final class Display {
|
|||
current_mode = init();
|
||||
assert current_mode != null;
|
||||
System.out.println("Current mode "+current_mode);
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Timer for sync() */
|
||||
|
@ -83,6 +88,9 @@ public final class Display {
|
|||
|
||||
/** Fullscreen */
|
||||
private static boolean fullscreen;
|
||||
|
||||
/** VSync */
|
||||
private static boolean vsync;
|
||||
|
||||
/** Tracks VBO state for the window context */
|
||||
private static VBOTracker vbo_tracker;
|
||||
|
@ -167,6 +175,7 @@ public final class Display {
|
|||
if (title != null)
|
||||
nSetTitle(title);
|
||||
initControls();
|
||||
nSetVSyncEnabled(vsync);
|
||||
}
|
||||
|
||||
private static native void nCreateWindow(DisplayMode mode, boolean fullscreen) throws LWJGLException;
|
||||
|
@ -587,6 +596,13 @@ public final class Display {
|
|||
destroyWindow();
|
||||
destroyContext();
|
||||
context = null;
|
||||
reset();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset display mode if fullscreen. This method is also called from the shutdown hook added in Sys
|
||||
*/
|
||||
private static void reset() {
|
||||
if (fullscreen)
|
||||
resetDisplayMode();
|
||||
}
|
||||
|
@ -617,9 +633,9 @@ public final class Display {
|
|||
* @param sync true to synchronize; false to ignore synchronization
|
||||
*/
|
||||
public static void setVSyncEnabled(boolean sync) {
|
||||
if (!isCreated())
|
||||
throw new IllegalStateException("Cannot set vsync state of uncreated window");
|
||||
nSetVSyncEnabled(sync);
|
||||
vsync = sync;
|
||||
if (isCreated())
|
||||
nSetVSyncEnabled(vsync);
|
||||
}
|
||||
|
||||
private static native void nSetVSyncEnabled(boolean sync);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.test.opengl;
|
||||
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.DisplayMode;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -219,7 +220,9 @@ public class FullScreenWindowedTest {
|
|||
* Cleans up the test
|
||||
*/
|
||||
private void cleanup() {
|
||||
// Display.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a displaymode, if one such is available
|
||||
*
|
||||
|
@ -235,6 +238,11 @@ public class FullScreenWindowedTest {
|
|||
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
||||
for (int i = 0; i < modes.length; i++) {
|
||||
if (modes[i].getWidth() == width && modes[i].getHeight() == height && modes[i].getBitsPerPixel() >= bpp && modes[i].getFrequency() <= 60) {
|
||||
try {
|
||||
Display.setDisplayMode(modes[i]);
|
||||
} catch (LWJGLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return modes[i];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue