Removed Sys.setTime(), Sys.getPlatform()

Changed Sys.getTime()
Added Display.sync()
This commit is contained in:
Caspian Rychlik-Prince 2004-05-05 14:28:40 +00:00
parent 3bb53392f6
commit b697fb3ecf
20 changed files with 102 additions and 261 deletions

View File

@ -59,20 +59,9 @@ public final class Display {
/** Whether or not the display has been requested to shutdown by the user */
private static boolean closeRequested = false;
/*
* Platforms. This will let you determine which platform you are running
* on, which is handy to know for some GL context calls.
*/
/** Windows platform */
public static final int PLATFORM_WGL = 0;
/** GLX (Linux/Unix) platform */
public static final int PLATFORM_GLX = 1;
/** MacOSX platform */
public static final int PLATFORM_AGL = 2;
/** Timer for sync() */
private static long timeNow, timeThen;
static {
Sys.initialize();
@ -177,16 +166,6 @@ public final class Display {
return mode.freq;
}
/**
* Returns the operating system windowing platform. This will be one of the
* constants defined above. There is no "unknown" platform; a native library port
* has to provide a unique platform number for this mechanism to work. If the LWJGL
* is ported to, say, QNX, we will have a PLATFORM_QNX at the ready.
*
* @return the windowing system
*/
public static native int getPlatform();
/**
* Set the display configuration to the specified gamma, brightness and contrast.
* The configuration changes will be reset when resetDisplayMode is called.
@ -250,5 +229,21 @@ public final class Display {
* @return a String
*/
public static native String getVersion();
/**
* Synchronize the display to a capped frame rate.
* @param frameTime The desired frame time in seconds
*/
public static void sync(float frameRate) {
timeNow = Sys.getTime();
System.out.println(Sys.getTimerResolution());
System.out.println(timeNow+" "+timeThen+" "+((float) (timeNow - timeThen) / (float) Sys.getTimerResolution()));
while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameRate) {
// This is a system-friendly way of allowing other stuff to use CPU if it wants to
Thread.yield();
timeNow = Sys.getTime();
}
timeThen = timeNow;
}
}

View File

@ -81,7 +81,7 @@ public final class Sys {
/** The native library name */
private static String LIBRARY_NAME = "lwjgl";
/** The platform being executed on */
/** The platform adapter class name */
private static String PLATFORM;
/**
@ -131,13 +131,8 @@ public final class Sys {
throw new LinkageError("Version mismatch: jar version is '" + VERSION +
"', native libary version is '" + native_version + "'");
setDebug(DEBUG);
setTime(0);
// check platform name, and default to awt
PLATFORM = System.getProperty("org.lwjgl.Sys.platform");
if(PLATFORM == null) {
PLATFORM = "org.lwjgl.SwingAdapter";
}
PLATFORM = System.getProperty("org.lwjgl.Sys.platform", "org.lwjgl.SwingAdapter");
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
@ -173,20 +168,14 @@ public final class Sys {
/**
* Gets the current value of the hires timer, in ticks. When the Sys class is first loaded
* the hires timer is reset to 0. If no hires timer is present then this method will always
* return whatever value the timer was last set to.
* return 0.<p><strong>NOTEZ BIEN</strong> that the hires timer WILL wrap around.
*
* @return the current hires time, in ticks.
* @return the current hires time, in ticks (always >= 0)
*/
public static native long getTime();
/**
* Sets the hires timer to a new time, specified in ticks.
*
* @param time The new time, in ticks
* @see #getTime()
* @see #getTimerResolution()
*/
public static native void setTime(long time);
public static long getTime() {
return ngetTime() & 0x7FFFFFFFFFFFFFFFL;
}
private static native long ngetTime();
/**
* Set the process priority in a system independent way. Because of the various

View File

@ -109,18 +109,9 @@ public class Game {
finished = true;
} else if (Window.isActive()) {
// The window is in the foreground, so we should play the game
long timeThen = Sys.getTime();
logic();
render();
// Stabilise the framerate if we haven't got vsync
if (!Window.isVSyncEnabled()) {
long timeNow = Sys.getTime();
while ((float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < FRAMETIME) {
// This is a system-friendly way of allowing other stuff to use CPU if it wants to
Thread.yield();
timeNow = Sys.getTime();
}
}
org.lwjgl.Display.sync(FRAMETIME);
} else {
// The window is not in the foreground, so we can allow other stuff to run and
// infrequently update

View File

@ -36,9 +36,8 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import org.lwjgl.Display;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
/**
* $Id$
@ -108,28 +107,25 @@ public class Cursor {
// Win32 or X and do accordingly. This hasn't been implemented on Mac, but we
// might want to split it into a X/Win/Mac cursor if it gets too cluttered
switch(Display.getPlatform()) {
case Display.PLATFORM_GLX:
// create our cursor elements
cursors = new CursorElement[1];
cursors[0] = new CursorElement();
cursors[0].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images_copy, images_copy.position(), delays, delays != null ? delays.position() : -1);
break;
case Display.PLATFORM_WGL:
// create our cursor elements
cursors = new CursorElement[numImages];
for(int i=0; i<numImages; i++) {
cursors[i] = new CursorElement();
cursors[i].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, 1, images_copy, images_copy.position(), null, 0);
cursors[i].delay = (delays != null) ? delays.get(i) : 0;
cursors[i].timeout = System.currentTimeMillis();
// offset to next image
images_copy.position(width*height*(i+1));
}
break;
case Display.PLATFORM_AGL:
break;
String osName = System.getProperty("os.name", "");
if (osName.startsWith("Win")) {
// create our cursor elements
cursors = new CursorElement[numImages];
for(int i=0; i<numImages; i++) {
cursors[i] = new CursorElement();
cursors[i].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, 1, images_copy, images_copy.position(), null, 0);
cursors[i].delay = (delays != null) ? delays.get(i) : 0;
cursors[i].timeout = System.currentTimeMillis();
// offset to next image
images_copy.position(width*height*(i+1));
}
} else if (osName.startsWith("Lin")) {
// create our cursor elements
cursors = new CursorElement[1];
cursors[0] = new CursorElement();
cursors[0].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images_copy, images_copy.position(), delays, delays != null ? delays.position() : -1);
} else {
}
}

View File

@ -38,10 +38,9 @@ import java.util.HashMap;
import java.util.Map;
import org.lwjgl.BufferUtils;
import org.lwjgl.Display;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Window;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -568,7 +567,7 @@ public class Mouse {
* shouldn't be called otherwise
*/
public static void updateCursor() {
if (Display.getPlatform() == Display.PLATFORM_WGL && currentCursor != null && currentCursor.hasTimedOut()) {
if (System.getProperty("os.name").startsWith("Win") && currentCursor != null && currentCursor.hasTimedOut()) {
currentCursor.nextCursor();
try {
setNativeCursor(currentCursor);

View File

@ -35,9 +35,8 @@ import java.io.File;
import java.lang.reflect.Method;
import java.util.StringTokenizer;
import org.lwjgl.Display;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
/**
* $Id$
@ -141,18 +140,15 @@ public abstract class AL {
String seperator = System.getProperty("path.separator");
String jwsLibname;
switch (Display.getPlatform()) {
case Display.PLATFORM_WGL:
jwsLibname = "lwjglaudio";
break;
case Display.PLATFORM_GLX:
jwsLibname = "openal";
break;
case Display.PLATFORM_AGL:
jwsLibname = "openal";
break;
default:
throw new LWJGLException("Unknown platform");
String osName = System.getProperty("os.name");
if (osName.startsWith("Win")) {
jwsLibname = "lwjglaudio";
} else if (osName.startsWith("Lin")) {
jwsLibname = "openal";
} else if (osName.startsWith("Mac")) {
jwsLibname = "openal";
} else {
throw new LWJGLException("Unknown platform: "+osName);
}
String jwsPath = getPathFromJWS(jwsLibname);

View File

@ -510,23 +510,6 @@ public final class Window {
*/
private static native void nUpdate();
/**
* Determines to the best of the platform's ability whether monitor vysnc is enabled on
* this window. The failsafe assumption is that when vsync cannot be determined, this
* method returns false, and you should rely on using a hires timer to throttle your
* framerate rather than relying on monitor sync (even if monitor sync is actually working).
* Therefore you can guarantee that if we return true from this method that we're pretty
* certain vsync is enabled.
* @return boolean
*/
public static boolean isVSyncEnabled() {
if (!isCreated())
throw new IllegalStateException("Cannot determine vsync state of uncreated window");
return nIsVSyncEnabled();
}
private static native boolean nIsVSyncEnabled();
/**
* Enable or disable vertical monitor synchronization. This call is a best-attempt at changing
* the vertical refresh synchronization of the monitor, and is not guaranteed to be successful.

View File

@ -67,7 +67,6 @@ public class DisplayTest {
System.out.println("==== Test Current ====");
System.out.println("Info about current:");
System.out.println("Platform: " + getNameForPlatform());
System.out.println("Graphics card: " + Display.getAdapter() + ", version: " + Display.getVersion());
System.out.println("Resolution: " +
Display.getWidth() + "x" +
@ -228,24 +227,6 @@ public class DisplayTest {
}
}
/**
* Returns a String representation of the platform
*
* @return String representation of the platform
*/
private String getNameForPlatform() {
switch (Display.getPlatform()) {
case Display.PLATFORM_WGL:
return "WGL";
case Display.PLATFORM_GLX:
return "GLX";
case Display.PLATFORM_AGL:
return "AGL";
default:
return "Unknown platform";
}
}
/**
* Tests the Sys class, and serves as basic usage test
*

View File

@ -148,7 +148,6 @@ public final class Game {
*/
private static void init()
throws Exception {
Sys.setTime(0);
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
System.out.println("Timer resolution: " + Sys.getTimerResolution());
System.out.println("Number of texture units: " + Util.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS));

View File

@ -196,8 +196,7 @@ public final class VBOIndexTest {
* Initialize
*/
private static void init() throws Exception {
Sys.setTime(0);
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
System.out.println("Timer resolution: " + Sys.getTimerResolution());
// Go into orthographic projection mode.
GL11.glMatrixMode(GL11.GL_PROJECTION);

View File

@ -176,8 +176,6 @@ public final class VBOTest {
* Initialize
*/
private static void init() throws Exception {
Sys.setTime(0);
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
System.out.println("Timer resolution: " + Sys.getTimerResolution());
// Go into orthographic projection mode.
GL11.glMatrixMode(GL11.GL_PROJECTION);

View File

@ -45,20 +45,12 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
/*
* Class: org_lwjgl_Sys
* Method: getTime
* Method: ngetTime
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_Sys
* Method: setTime
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_Sys
* Method: setProcessPriority

View File

@ -1,4 +1,3 @@
/*
* Copyright (c) 2002 Light Weight Java Game Library Project
* All rights reserved.
*
@ -60,7 +59,7 @@ static unsigned short *b_ramp;
static bool getVidModeExtensionVersion(Display *disp, int screen, int *major, int *minor) {
int event_base, error_base;
if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) {
printfDebug("XF86VidMode extension not available\n");
return false;
@ -139,7 +138,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_init
if (disp == NULL)
return;
screen = DefaultScreen(disp);
if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) {
printfDebug("Could not get display modes\n");
}
@ -215,10 +214,10 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
if (disp == NULL)
return NULL;
screen = DefaultScreen(disp);
int bpp = XDefaultDepth(disp, screen);
if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) {
printfDebug("Could not get display modes\n");
decDisplay();
@ -228,7 +227,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
jclass displayModeClass = env->FindClass("org/lwjgl/DisplayMode");
jobjectArray ret = env->NewObjectArray(num_modes, displayModeClass, NULL);
jmethodID displayModeConstructor = env->GetMethodID(displayModeClass, "<init>", "(IIII)V");
for (i = 0; i < num_modes; i++) {
jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, bpp, 0);
env->SetObjectArrayElement(ret, i, displayMode);
@ -238,10 +237,6 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
return ret;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getPlatform(JNIEnv * env, jclass clazz) {
return org_lwjgl_Display_PLATFORM_GLX;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) {
return gamma_ramp_length;
}

View File

@ -45,8 +45,6 @@
#include "org_lwjgl_Sys.h"
#include "common_tools.h"
static long int hires_timer_freq; // Hires timer frequency
static long int hires_timer_start; // Hires timer start
static long int hires_timer; // Hires timer current time
/*
@ -57,7 +55,8 @@ static long int hires_timer; // Hires timer current time
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
(JNIEnv * env, jclass clazz)
{
return hires_timer_freq;
// Constant on linux
return 1000000;
}
static long queryTime(void) {
@ -76,29 +75,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebug(JNIEnv *env, jclass clazz, jb
/*
* Class: org_lwjgl_Sys
* Method: getTime
* Method: ngetTime
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime
(JNIEnv * env, jclass clazz)
{
hires_timer = queryTime();
hires_timer -= hires_timer_start;
return hires_timer;
}
/*
* Class: org_lwjgl_Sys
* Method: setTime
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime
(JNIEnv * env, jclass clazz, jlong startTime)
{
hires_timer_start = queryTime();
// We don't have a real resolution so assume highest possible
hires_timer_freq = 1000000;
hires_timer_start -= startTime;
return (jlong) hires_timer;
}
/*

View File

@ -613,12 +613,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsActive
return focused ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVSyncEnabled
(JNIEnv * env, jclass clazz)
{
return vsync_enabled;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetVSyncEnabled
(JNIEnv * env, jclass clazz, jboolean sync)
{

View File

@ -189,9 +189,6 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes(
return ret;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getPlatform(JNIEnv * env, jclass clazz) {
return org_lwjgl_Display_PLATFORM_AGL;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) {
return GAMMARAMP_LENGTH;

View File

@ -46,9 +46,7 @@
#include "org_lwjgl_Sys.h"
#include "common_tools.h"
long int hires_timer_freq; // Hires timer frequency
long int hires_timer_start; // Hires timer start
long int hires_timer; // Hires timer current time
static long int hires_timer; // Hires timer current time
/*
* Class: org_lwjgl_Sys
@ -58,7 +56,8 @@ long int hires_timer; // Hires timer current time
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
(JNIEnv * env, jclass clazz)
{
return hires_timer_freq;
// Constant on MacOS
return 1000000;
}
static long queryTime(void) {
@ -77,34 +76,20 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebug(JNIEnv *env, jclass clazz, jb
/*
* Class: org_lwjgl_Sys
* Method: getTime
* Method: ngetTime
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime
(JNIEnv * env, jclass clazz)
{
hires_timer = queryTime();
hires_timer -= hires_timer_start;
return hires_timer;
return (jlong) hires_timer;
}
JNIEXPORT jstring JNICALL Java_org_lwjgl_Sys_getNativeLibraryVersion(JNIEnv *env, jclass clazz) {
return getVersionString(env);
}
/*
* Class: org_lwjgl_Sys
* Method: setTime
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime
(JNIEnv * env, jclass clazz, jlong startTime)
{
hires_timer_start = queryTime();
// We don't have a real resolution so assume highest possible
hires_timer_freq = 1000000;
hires_timer_start -= startTime;
}
/*
* Class: org_lwjgl_Sys

View File

@ -1,35 +1,35 @@
/*
/*
* Copyright (c) 2002 Light Weight Java Game Library Project
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* $Id$
*
@ -49,7 +49,7 @@
static CGLContextObj context;
static bool vsync_enabled;
static bool current_fullscreen;
static void destroyMode(JNIEnv *env, jclass clazz) {
if (!current_fullscreen)
resetMode(env);
@ -162,7 +162,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nUpdate(JNIEnv *env, jclass
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jclass clazz) {
CGLFlushDrawable(context);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_minimize(JNIEnv *env, jclass clazz) {
}
@ -185,10 +185,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsMinimized(JNIEnv *env
return JNI_FALSE;
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVSyncEnabled(JNIEnv *env, jclass clazz) {
return vsync_enabled;
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVisible(JNIEnv *env, jclass clazz) {
return JNI_TRUE;
}

View File

@ -46,9 +46,8 @@
// Handle to the application's window
extern HWND hwnd;
unsigned __int64 hires_timer_freq; // Hires timer frequency
unsigned __int64 hires_timer_start; // Hires timer start
unsigned __int64 hires_timer; // Hires timer current time
unsigned __int64 hires_timer_freq = 0; // Hires timer frequency
unsigned __int64 hires_timer = 0; // Hires timer current time
/*
* Class: org_lwjgl_Sys
@ -58,7 +57,8 @@ unsigned __int64 hires_timer; // Hires timer current time
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
(JNIEnv * env, jclass clazz)
{
return hires_timer_freq;
QueryPerformanceFrequency((LARGE_INTEGER*) &hires_timer_freq);
return (jlong) hires_timer_freq;
}
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebug(JNIEnv *env, jclass clazz, jboolean enabled) {
@ -71,28 +71,14 @@ JNIEXPORT jstring JNICALL Java_org_lwjgl_Sys_getNativeLibraryVersion(JNIEnv *env
/*
* Class: org_lwjgl_Sys
* Method: getTime
* Method: ngetTime
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime
(JNIEnv * env, jclass clazz)
{
QueryPerformanceCounter((LARGE_INTEGER*) &hires_timer);
hires_timer -= hires_timer_start;
return hires_timer;
}
/*
* Class: org_lwjgl_Sys
* Method: setTime
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime
(JNIEnv * env, jclass clazz, jlong startTime)
{
QueryPerformanceFrequency((LARGE_INTEGER*) &hires_timer_freq);
QueryPerformanceCounter((LARGE_INTEGER*) &hires_timer_start);
hires_timer_start -= startTime;
return (jlong) hires_timer;
}
/*

View File

@ -58,7 +58,6 @@ extern HINSTANCE dll_handle; // Handle to the LWJGL dll
RECT clientSize;
static bool closerequested;
static jboolean vsync;
static jboolean allowSoftwareOpenGL; // Whether to allow software opengl
//CAS: commented these out as no longer used
@ -471,7 +470,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
isDirty = true;
isFullScreen = fullscreen == JNI_TRUE;
isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
vsync = JNI_FALSE;
// Speacial option for allowing software opengl
allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Window.allowSoftwareOpenGL");
@ -586,17 +584,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsActive
return isFocused;
}
/*
* Class: org_lwjgl_opengl_Window
* Method: nIsVSyncEnabled
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVSyncEnabled
(JNIEnv * env, jclass clazz)
{
return vsync;
}
/*
* Class: org_lwjgl_opengl_Window
* Method: nSetVSyncEnabled
@ -611,7 +598,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetVSyncEnabled
} else {
wglSwapIntervalEXT(0);
}
vsync = sync;
}
}