当前位置: 首页>>代码示例>>Java>>正文


Java Cursor.getCapabilities方法代码示例

本文整理汇总了Java中org.lwjgl.input.Cursor.getCapabilities方法的典型用法代码示例。如果您正苦于以下问题:Java Cursor.getCapabilities方法的具体用法?Java Cursor.getCapabilities怎么用?Java Cursor.getCapabilities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.input.Cursor的用法示例。


在下文中一共展示了Cursor.getCapabilities方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.lwjgl.input.Cursor; //导入方法依赖的package包/类
public void initialize() {
    if (!context.isRenderable())
        return;

    try {
        Mouse.create();
        logger.info("Mouse created.");
        supportHardwareCursor = (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0;
        
        // Recall state that was set before initialization
        Mouse.setGrabbed(!cursorVisible);
    } catch (LWJGLException ex) {
        logger.log(Level.SEVERE, "Error while creating mouse", ex);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:LwjglMouseInput.java

示例2: NativeCursor

import org.lwjgl.input.Cursor; //导入方法依赖的package包/类
public NativeCursor(GLIntImage image_16_1, int offset_x_16_1, int offset_y_16_1,
					GLIntImage image_32_1, int offset_x_32_1, int offset_y_32_1,
					GLIntImage image_32_8, int offset_x_32_8, int offset_y_32_8) {
	org.lwjgl.input.Cursor native_cursor = null;
	int caps = Cursor.getCapabilities();
	
	int alpha_bits = 0;
	if ((caps & Cursor.CURSOR_8_BIT_ALPHA) != 0)
		alpha_bits = 8;
	else if ((caps & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0)
		alpha_bits = 1;

	int max_size = Cursor.getMaxCursorSize();
		
	try {
		if (max_size < 32 && max_size >= 16 && alpha_bits >= 1)
			native_cursor = new org.lwjgl.input.Cursor(image_16_1.getWidth(), image_16_1.getHeight(), offset_x_16_1, offset_y_16_1, 1, image_16_1.createCursorPixels(), null);
		else if (max_size >= 32) {
			if (alpha_bits == 8)
				native_cursor = new org.lwjgl.input.Cursor(image_32_8.getWidth(), image_32_8.getHeight(), offset_x_32_8, offset_y_32_8, 1, image_32_8.createCursorPixels(), null);
			else if (alpha_bits == 1)
				native_cursor = new org.lwjgl.input.Cursor(image_32_1.getWidth(), image_32_1.getHeight(), offset_x_32_1, offset_y_32_1, 1, image_32_1.createCursorPixels(), null);
		}
	} catch (LWJGLException e) {
		e.printStackTrace();
	}
	cursor = native_cursor;
}
 
开发者ID:sunenielsen,项目名称:tribaltrouble,代码行数:29,代码来源:NativeCursor.java


注:本文中的org.lwjgl.input.Cursor.getCapabilities方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。