当前位置: 首页>>代码示例>>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;未经允许,请勿转载。