New getPlatform() method added

This commit is contained in:
Caspian Rychlik-Prince 2003-03-21 16:53:19 +00:00
parent 0d620e9125
commit c1fd8957df
3 changed files with 66 additions and 0 deletions

View File

@ -83,6 +83,7 @@ public final class Sys {
*/
public static final boolean DEBUG;
private static boolean _debug;
static {
try {
@ -100,6 +101,20 @@ public final class Sys {
}
}
/*
* Platforms. This will let you determine which platform you are running
* on, which is handy to know for some GL calls.
*/
/** Windows platform */
public static final int PLATFORM_WGL = 0;
/** GLX (Linux/Unix) platform */
public static final int PLATFORM_GLX = 1;
/** Apply platform */
public static final int PLATFORM_AGL = 2;
/**
* @return the name of the native library to load
*/
@ -207,5 +222,15 @@ public final class Sys {
* @param message The message text for the alert.
*/
public static native void alert(String title, String message);
/**
* 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();
}

View File

@ -19,6 +19,12 @@ extern "C" {
/* Inaccessible static: LIBRARY_NAME */
/* Inaccessible static: DEBUG */
/* Inaccessible static: _debug */
#undef org_lwjgl_Sys_PLATFORM_WGL
#define org_lwjgl_Sys_PLATFORM_WGL 0L
#undef org_lwjgl_Sys_PLATFORM_GLX
#define org_lwjgl_Sys_PLATFORM_GLX 1L
#undef org_lwjgl_Sys_PLATFORM_AGL
#define org_lwjgl_Sys_PLATFORM_AGL 2L
/* Inaccessible static: class_000240 */
/*
* Class: org_lwjgl_Sys
@ -76,6 +82,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_alert
(JNIEnv *, jclass, jstring, jstring);
/*
* Class: org_lwjgl_Sys
* Method: getPlatform
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_Sys_getPlatform
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif

View File

@ -49,6 +49,21 @@ __int64 hires_timer_freq; // Hires timer frequency
__int64 hires_timer_start; // Hires timer start
__int64 hires_timer; // Hires timer current time
// Platform
#ifdef _WIN32
#define PLATFORM 0
#else
#ifdef _X11
#define PLATFORM 1
#else
#ifdef APPLE
#define PLATFORM 2
#else
#error Unsupported Platform!
#endif
#endif
/*
* Class: org_lwjgl_Sys
* Method: getDirectBufferAddress
@ -163,3 +178,15 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_alert
env->ReleaseStringUTFChars(message, eMessageText);
env->ReleaseStringUTFChars(title, cTitleBarText);
}
/*
* Class: org_lwjgl_Sys
* Method: getPlatform
* Signature: ()I
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_getPlatform
(JNIEnv * env, jclass clazz)
{
return org_lwjgl_Sys_PLATFORM_WGL;
}