本文整理匯總了Java中org.newdawn.slick.opengl.Texture.getImageWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Texture.getImageWidth方法的具體用法?Java Texture.getImageWidth怎麽用?Java Texture.getImageWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.newdawn.slick.opengl.Texture
的用法示例。
在下文中一共展示了Texture.getImageWidth方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setup
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
/**
* Setup.
*
* @param u the u
* @return the shader args
*/
public static ShaderArgs setup(FightUnit u) {
Unit unit = u.getUnit();
ShaderArgs args = new ShaderArgs();
if(unit.getTheClass().name.equals("Lord")) return args;
String c = unit.functionalClassName();
Texture t = palettes.get(c);
if(t == null) return args;
if(lookup.get(c) == null) return args;
int offset = lookup.get(c).indexOf(unit.name);
if(offset < 0) return args;
args.programName = "paletteSwap";
args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()};
GL13.glActiveTexture(GL13.GL_TEXTURE8);
t.bind();
GL13.glActiveTexture(GL13.GL_TEXTURE0);
return args;
}
示例2: Animation
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
/**
* Instantiates a new single-frame animation.
*
* @param t the texture
* @param blend the blend mode to use when drawing this animation
*/
public Animation(Texture t, BlendModeArgs blend) {
texture = t;
width = t.getImageWidth();
height = t.getImageHeight();
length = 1;
rows = 1;
columns = 1;
speed = 0;
currentFrame = 0;
counter = 0;
this.blend = blend;
}
示例3: Button
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public Button(String name, Texture texture, int x, int y) {
this.name = name;
this.texture = texture;
this.x = x;
this.y = y;
this.width = texture.getImageWidth();
this.height = texture.getImageHeight();
}
示例4: colorAt
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
public static Vector3f colorAt(int x, int y, Texture tex){
byte[] texData = tex.getTextureData();
int red = texData[ (y * tex.getImageWidth() + x) * 3 ];
int green = texData[ (y * tex.getImageWidth() + x) * 3 + 1 ];
int blue = texData[ (y * tex.getImageWidth() + x) * 3 + 2 ];
return new Vector3f( (red > 0) ? reMap(red, 0, 255f, 0, 1f) : reMap(red+256, 0, 255f, 0f, 1f),
(green > 0) ? reMap(green, 0, 255f, 0, 1f) : reMap(green+256, 0, 255f, 0f, 1f),
(blue > 0) ? reMap(blue, 0, 255f, 0, 1f) : reMap(blue+256, 0, 255f, 0f, 1f) );
}
示例5: convertImage
import org.newdawn.slick.opengl.Texture; //導入方法依賴的package包/類
private Image convertImage(String path) throws IOException {
BufferedImage bufferedImage = ImageIO.read(DuskMoon.class.getResourceAsStream("/"+path));
Texture texture = BufferedImageUtil.getTexture("", bufferedImage);
Image image = null;
try {
image = new Image(texture.getImageWidth(), texture.getImageHeight());
image.setTexture(texture);
} catch (SlickException e) {
e.printStackTrace();
}
return image;
}