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


Java CursorLoader类代码示例

本文整理汇总了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);
     }
  }
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:21,代码来源:AppletGameContainer.java

示例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);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:21,代码来源:AppGameContainer.java

示例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);
    }
 }
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:20,代码来源:AppletGameContainer.java

示例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);
	}
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:20,代码来源:AppGameContainer.java

示例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);
	}
}
 
开发者ID:nguillaumin,项目名称:slick2d-maven,代码行数:21,代码来源:AppGameContainer.java


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