Package org.lwjgl
Class LWJGLUtil
- java.lang.Object
-
- org.lwjgl.LWJGLUtil
-
public class LWJGLUtil extends Object
Internal library methods
- Version:
- $Revision$ $Id$
- Author:
- Brian Matzon
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLWJGLUtil.TokenFilterSimple interface for Field filtering.
-
Field Summary
Fields Modifier and Type Field Description static booleanCHECKSstatic booleanDEBUGDebug flag.static ByteBufferLWJGLIcon16x16LWJGL Logo - 16 by 16 pixelsstatic ByteBufferLWJGLIcon32x32LWJGL Logo - 32 by 32 pixelsstatic intPLATFORM_LINUXstatic StringPLATFORM_LINUX_NAMEstatic intPLATFORM_MACOSXstatic StringPLATFORM_MACOSX_NAMEstatic intPLATFORM_WINDOWSstatic StringPLATFORM_WINDOWS_NAME
-
Constructor Summary
Constructors Constructor Description LWJGLUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<Integer,String>getClassTokens(LWJGLUtil.TokenFilter filter, Map<Integer,String> target, Class... tokenClasses)Returns a map of public static final integer fields in the specified classes, to their String representations.static Map<Integer,String>getClassTokens(LWJGLUtil.TokenFilter filter, Map<Integer,String> target, Iterable<Class> tokenClasses)Returns a map of public static final integer fields in the specified classes, to their String representations.static String[]getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader)Locates the paths required by a library.static String[]getLibraryPaths(String libname, String platform_lib_name, ClassLoader classloader)Locates the paths required by a library.static intgetPlatform()static StringgetPlatformName()static booleangetPrivilegedBoolean(String property_name)Gets a boolean property as a privileged action.static IntegergetPrivilegedInteger(String property_name)Gets an integer property as a privileged action.static IntegergetPrivilegedInteger(String property_name, int default_val)Gets an integer property as a privileged action.static booleanisMacOSXEqualsOrBetterThan(int major_required, int minor_required)Method to determine if the current system is running a version of Mac OS X better than the given version.static voidlog(CharSequence msg)Prints the given message to System.err if DEBUG is true.static StringmapLibraryName(String name)static StringtoHexString(int value)Returns a string representation of the integer argument as an unsigned integer in base 16.
-
-
-
Field Detail
-
PLATFORM_LINUX
public static final int PLATFORM_LINUX
- See Also:
- Constant Field Values
-
PLATFORM_MACOSX
public static final int PLATFORM_MACOSX
- See Also:
- Constant Field Values
-
PLATFORM_WINDOWS
public static final int PLATFORM_WINDOWS
- See Also:
- Constant Field Values
-
PLATFORM_LINUX_NAME
public static final String PLATFORM_LINUX_NAME
- See Also:
- Constant Field Values
-
PLATFORM_MACOSX_NAME
public static final String PLATFORM_MACOSX_NAME
- See Also:
- Constant Field Values
-
PLATFORM_WINDOWS_NAME
public static final String PLATFORM_WINDOWS_NAME
- See Also:
- Constant Field Values
-
LWJGLIcon16x16
public static final ByteBuffer LWJGLIcon16x16
LWJGL Logo - 16 by 16 pixels
-
LWJGLIcon32x32
public static final ByteBuffer LWJGLIcon32x32
LWJGL Logo - 32 by 32 pixels
-
DEBUG
public static final boolean DEBUG
Debug flag.
-
CHECKS
public static final boolean CHECKS
-
-
Method Detail
-
getPlatform
public static int getPlatform()
- Returns:
- the current platform type
- See Also:
PLATFORM_WINDOWS,PLATFORM_LINUX,PLATFORM_MACOSX
-
getPlatformName
public static String getPlatformName()
- Returns:
- current platform name
- See Also:
PLATFORM_WINDOWS_NAME,PLATFORM_LINUX_NAME,PLATFORM_MACOSX_NAME
-
mapLibraryName
public static String mapLibraryName(String name)
WrapsSystem.mapLibraryName(java.lang.String). On OS X with JDK 6, the .jnilib file extension will be replaced with .dylib.- Parameters:
name- the name of the library.- Returns:
- a platform-dependent native library name.
-
getLibraryPaths
public static String[] getLibraryPaths(String libname, String platform_lib_name, ClassLoader classloader)
Locates the paths required by a library.- Parameters:
libname- Local Library Name to search the classloader with ("openal").platform_lib_name- The native library name ("libopenal.so")classloader- The classloader to ask for library paths- Returns:
- Paths to located libraries, if any
-
getLibraryPaths
public static String[] getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader)
Locates the paths required by a library.- Parameters:
libname- Local Library Name to search the classloader with ("openal").platform_lib_names- The list of possible library names ("libopenal.so")classloader- The classloader to ask for library paths- Returns:
- Paths to located libraries, if any
-
getPrivilegedBoolean
public static boolean getPrivilegedBoolean(String property_name)
Gets a boolean property as a privileged action.
-
getPrivilegedInteger
public static Integer getPrivilegedInteger(String property_name)
Gets an integer property as a privileged action.- Parameters:
property_name- the integer property name- Returns:
- the property value
-
getPrivilegedInteger
public static Integer getPrivilegedInteger(String property_name, int default_val)
Gets an integer property as a privileged action.- Parameters:
property_name- the integer property namedefault_val- the default value to use if the property is not defined- Returns:
- the property value
-
log
public static void log(CharSequence msg)
Prints the given message to System.err if DEBUG is true.- Parameters:
msg- Message to print
-
isMacOSXEqualsOrBetterThan
public static boolean isMacOSXEqualsOrBetterThan(int major_required, int minor_required)Method to determine if the current system is running a version of Mac OS X better than the given version. This is only useful for Mac OS X specific code and will not work for any other platform.
-
getClassTokens
public static Map<Integer,String> getClassTokens(LWJGLUtil.TokenFilter filter, Map<Integer,String> target, Class... tokenClasses)
Returns a map of public static final integer fields in the specified classes, to their String representations. An optional filter can be specified to only include specific fields. The target map may be null, in which case a new map is allocated and returned.This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs.
- Parameters:
filter- the filter to use (optional)target- the target map (optional)tokenClasses- an array of classes to get tokens from- Returns:
- the token map
-
getClassTokens
public static Map<Integer,String> getClassTokens(LWJGLUtil.TokenFilter filter, Map<Integer,String> target, Iterable<Class> tokenClasses)
Returns a map of public static final integer fields in the specified classes, to their String representations. An optional filter can be specified to only include specific fields. The target map may be null, in which case a new map is allocated and returned.This method is useful when debugging to quickly identify values returned from the AL/GL/CL APIs.
- Parameters:
filter- the filter to use (optional)target- the target map (optional)tokenClasses- the classes to get tokens from- Returns:
- the token map
-
toHexString
public static String toHexString(int value)
Returns a string representation of the integer argument as an unsigned integer in base 16. The string will be uppercase and will have a leading '0x'.- Parameters:
value- the integer value- Returns:
- the hex string representation
-
-