Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl
In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/java/org/lwjgl
Modified Files:
Display.java Sys.java
Log Message:
Replaced debug libraries with runtime debug condition
Index: Display.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- Display.java 22 Oct 2003 18:34:41 -0000 1.34
+++ Display.java 15 Dec 2003 11:49:16 -0000 1.35
@@ -80,7 +80,7 @@
static {
System.loadLibrary(Sys.getLibraryName());
init();
- if (Sys.DEBUG) {
+ if (Sys.atDebugLevel()) {
System.out.println("Adapter: "+getAdapter()+" Version: "+getVersion());
}
}
@@ -120,7 +120,7 @@
DisplayMode[] filteredModes = new DisplayMode[modes.size()];
modes.toArray(filteredModes);
- if (Sys.DEBUG) {
+ if (Sys.atDebugLevel()) {
System.out.println("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes");
}
@@ -239,7 +239,7 @@
gammaRamp.put(i, rampEntry);
}
setGammaRamp(gammaRamp);
- if (Sys.DEBUG) {
+ if (Sys.atDebugLevel()) {
System.out.println("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast);
}
}
Index: Sys.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- Sys.java 28 Oct 2003 21:44:46 -0000 1.32
+++ Sys.java 15 Dec 2003 11:49:16 -0000 1.33
@@ -47,6 +47,9 @@
* @version $Revision$
*/
public final class Sys {
+ /** Debug level constants */
+ public static final int DEBUG_DISABLED = 1;
+ public static final int DEBUG_ENABLED = 2;
/** Low process priority. @see #setProcessPriority() */
public static final int LOW_PRIORITY = -1;
@@ -78,38 +81,26 @@
public static final int REALTIME_PRIORITY = 2;
/** The native library name */
- private static String LIBRARY_NAME;
+ private static String LIBRARY_NAME = "lwjgl";
/**
- * Debug flag. This will tell you if you are using the debug version of
+ * Debug level. This will tell you if you are using the debug version of
* the library, and whether assertions are enabled or not.
*/
- public static final boolean DEBUG;
+ public static final int DEBUG;
- /**
- * The ByteBuffer equivalent of the native NULL constant
- */
-// public static final ByteBuffer NULL;
-
-
- private static boolean _debug;
static {
+ int _debug = DEBUG_DISABLED;
try {
assert false;
- LIBRARY_NAME = "lwjgl";
- _debug = false;
} catch (AssertionError e) {
- // Assertions are enabled, so we'll use the debug version of the
- // library
- LIBRARY_NAME = "lwjgl_d";
- _debug = true;
+ // Assertions are enabled, so we'll enabled debugging
+ _debug = DEBUG_ENABLED;
} finally {
DEBUG = _debug;
initialize();
}
}
-
-
/**
* @return the name of the native library to load
@@ -124,11 +115,16 @@
private Sys() {
}
+ public static boolean atDebugLevel() {
+ return DEBUG >= DEBUG_ENABLED;
+ }
+
/**
* Initialization.
*/
private static void initialize() {
System.loadLibrary(LIBRARY_NAME);
+ setDebugLevel(DEBUG);
setTime(0);
Runtime.getRuntime().addShutdownHook(new Thread() {
@@ -144,6 +140,11 @@
});
}
+
+ /**
+ * Set the debug level of the native library
+ */
+ private static native void setDebugLevel(int level);
/**
* Obtains the number of ticks that the hires timer does in a second.
|