本文整理匯總了Java中org.lwjgl.Sys.initialize方法的典型用法代碼示例。如果您正苦於以下問題:Java Sys.initialize方法的具體用法?Java Sys.initialize怎麽用?Java Sys.initialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.Sys
的用法示例。
在下文中一共展示了Sys.initialize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Cursor
import org.lwjgl.Sys; //導入方法依賴的package包/類
/**
* Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create
* Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported.
* So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values.
* The constructor will copy the images and delays, so there's no need to keep them around.
*
* @param width cursor image width
* @param height cursor image height
* @param xHotspot the x coordinate of the cursor hotspot
* @param yHotspot the y coordinate of the cursor hotspot
* @param numImages number of cursor images specified. Must be 1 if animations are not supported.
* @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL.
* @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null
* @throws LWJGLException if the cursor could not be created for any reason
*/
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0)
throw new LWJGLException("Native cursors not supported");
BufferChecks.checkBufferSize(images, width*height*numImages);
if (delays != null)
BufferChecks.checkBufferSize(delays, numImages);
if (!Mouse.isCreated())
throw new IllegalStateException("Mouse must be created before creating cursor objects");
if (width*height*numImages > images.remaining())
throw new IllegalArgumentException("width*height*numImages > images.remaining()");
if (xHotspot >= width || xHotspot < 0)
throw new IllegalArgumentException("xHotspot > width || xHotspot < 0");
if (yHotspot >= height || yHotspot < 0)
throw new IllegalArgumentException("yHotspot > height || yHotspot < 0");
Sys.initialize();
// Hmm
yHotspot = height - 1 - yHotspot;
// create cursor (or cursors if multiple images supplied)
cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
}
}
示例2: Cursor
import org.lwjgl.Sys; //導入方法依賴的package包/類
/**
* Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create
* Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported.
* So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values.
* The constructor will copy the images and delays, so there's no need to keep them around.
*
* @param width cursor image width
* @param height cursor image height
* @param xHotspot the x coordinate of the cursor hotspot
* @param yHotspot the y coordinate of the cursor hotspot
* @param numImages number of cursor images specified. Must be 1 if animations are not supported.
* @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL.
* @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null
* @throws LWJGLException if the cursor could not be created for any reason
*/
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0)
throw new LWJGLException("Native cursors not supported");
images = NondirectBufferWrapper.wrapBuffer(images, width*height*numImages);
if (delays != null)
delays = NondirectBufferWrapper.wrapBuffer(delays, numImages);
if (!Mouse.isCreated())
throw new IllegalStateException("Mouse must be created before creating cursor objects");
if (width*height*numImages > images.remaining())
throw new IllegalArgumentException("width*height*numImages > images.remaining()");
if (xHotspot >= width || xHotspot < 0)
throw new IllegalArgumentException("xHotspot > width || xHotspot < 0");
if (yHotspot >= height || yHotspot < 0)
throw new IllegalArgumentException("yHotspot > height || yHotspot < 0");
Sys.initialize();
// Hmm
yHotspot = height - 1 - yHotspot;
// create cursor (or cursors if multiple images supplied)
cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
}
}
示例3: initialize
import org.lwjgl.Sys; //導入方法依賴的package包/類
/**
* Static initialization
*/
private static void initialize() {
Sys.initialize();
// Assign names to all the buttons
buttonName = new String[16];
for (int i = 0; i < 16; i++) {
buttonName[i] = "BUTTON" + i;
buttonMap.put(buttonName[i], i);
}
initialized = true;
}
示例4: initialize
import org.lwjgl.Sys; //導入方法依賴的package包/類
/**
* Static initialization
*/
private static void initialize() {
if (initialized)
return;
Sys.initialize();
initialized = true;
}