本文整理汇总了Java中org.lwjgl.input.Mouse.setNativeCursor方法的典型用法代码示例。如果您正苦于以下问题:Java Mouse.setNativeCursor方法的具体用法?Java Mouse.setNativeCursor怎么用?Java Mouse.setNativeCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.input.Mouse
的用法示例。
在下文中一共展示了Mouse.setNativeCursor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMouseCursor
import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void setMouseCursor(Image image, int hotSpotX, int hotSpotY) throws SlickException {
try {
Image temp = new Image(get2Fold(image.getWidth()), get2Fold(image.getHeight()));
Graphics g = temp.getGraphics();
ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
g.drawImage(image.getFlippedCopy(false, true), 0, 0);
g.flush();
g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);
Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),temp.getHeight());
Mouse.setNativeCursor(cursor);
} catch (Throwable e) {
Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
}
}
示例2: setMouseCursor
import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.Image, int, int)
*/
public void setMouseCursor(Image image, int hotSpotX, int hotSpotY) throws SlickException {
try {
Image temp = new Image(get2Fold(image.getWidth()), get2Fold(image.getHeight()));
Graphics g = temp.getGraphics();
ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
g.drawImage(image.getFlippedCopy(false, true), 0, 0);
g.flush();
g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);
Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),image.getHeight());
Mouse.setNativeCursor(cursor);
} catch (Throwable e) {
Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
}
}
示例3: setDefaultMouseCursor
import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.GameContainer#setDefaultMouseCursor()
*/
public void setDefaultMouseCursor() {
try {
Mouse.setNativeCursor(null);
} catch (LWJGLException e) {
Log.error("Failed to reset mouse cursor", e);
}
}
示例4: setCursor
import org.lwjgl.input.Mouse; //导入方法依赖的package包/类
public static final void setCursor(final Cursor cursor) {
try {
Mouse.setNativeCursor(cursor);
} catch (final LWJGLException e) {
e.printStackTrace();
}
}