本文整理汇总了Java中org.newdawn.slick.opengl.CursorLoader类的典型用法代码示例。如果您正苦于以下问题:Java CursorLoader类的具体用法?Java CursorLoader怎么用?Java CursorLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CursorLoader类属于org.newdawn.slick.opengl包,在下文中一共展示了CursorLoader类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMouseCursor
import org.newdawn.slick.opengl.CursorLoader; //导入依赖的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.newdawn.slick.opengl.CursorLoader; //导入依赖的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: setMouseCursor
import org.newdawn.slick.opengl.CursorLoader; //导入依赖的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 (Exception e) {
Log.error("Failed to load and apply cursor.", e);
}
}
示例4: setMouseCursor
import org.newdawn.slick.opengl.CursorLoader; //导入依赖的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 (Exception e) {
Log.error("Failed to load and apply cursor.", e);
}
}
示例5: setMouseCursor
import org.newdawn.slick.opengl.CursorLoader; //导入依赖的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(),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);
}
}