當前位置: 首頁>>代碼示例>>Java>>正文


Java Sys.initialize方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:Superloup10,項目名稱:Wolf_game,代碼行數:41,代碼來源:Cursor.java

示例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);
	}
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:41,代碼來源:Cursor.java

示例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;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:16,代碼來源:Mouse.java

示例4: initialize

import org.lwjgl.Sys; //導入方法依賴的package包/類
/**
 * Static initialization
 */
private static void initialize() {
	if (initialized)
		return;
	Sys.initialize();
	initialized = true;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:10,代碼來源:Keyboard.java


注:本文中的org.lwjgl.Sys.initialize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。