本文整理汇总了Java中org.andengine.opengl.texture.region.ITiledTextureRegion.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java ITiledTextureRegion.getWidth方法的具体用法?Java ITiledTextureRegion.getWidth怎么用?Java ITiledTextureRegion.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.opengl.texture.region.ITiledTextureRegion
的用法示例。
在下文中一共展示了ITiledTextureRegion.getWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createItem
import org.andengine.opengl.texture.region.ITiledTextureRegion; //导入方法依赖的package包/类
private void createItem(final Item.Type type, final Item.Role role) {
final ITiledTextureRegion texture;
final float angleD;
switch (type) {
case VITAMIN:
angleD = -45 + CalcUtils.randomOf(90, random);
texture = activity.getTexture(ResMan.GUT_VITAMIN);
break;
case PROTEIN:
angleD = CalcUtils.randomOf(360, random);
texture = activity.getTexture(ResMan.GUT_PROTEIN);
break;
case IMMUNO:
angleD = 90;
texture = activity.getTexture(ResMan.GUT_PHAGE);
break;
case ANTIBIO:
angleD = CalcUtils.randomOf(360, random);
texture = activity.getTexture(ResMan.GUT_ANTIBIO);
break;
default:
throw new IllegalStateException("No default!");
}
final float lanePos = POS_FLOW[getRandomLane()] + 5;
final float laneHeight = POS_FLOW[1] - POS_FLOW[0];
final float textureHeight = Item.SCALE_DEFAULT * (type == Item.Type.IMMUNO ? texture.getWidth() : texture.getHeight());
final float itemY = lanePos + (laneHeight - textureHeight) / 2;
final float speedCoeff = (float) ((50.0 + gameScore) / 50);
final Item item = new Item(POS_ITEM_X, itemY, (float) Math.toRadians(angleD), type, role, speedCoeff, texture, this);
activity.markForAddition(item);
}
示例2: TiledSprite
import org.andengine.opengl.texture.region.ITiledTextureRegion; //导入方法依赖的package包/类
public TiledSprite(final float pX, final float pY, final ITiledTextureRegion pTiledTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
this(pX, pY, pTiledTextureRegion.getWidth(), pTiledTextureRegion.getHeight(), pTiledTextureRegion, pVertexBufferObjectManager, pDrawType);
}
示例3: getIdealScale
import org.andengine.opengl.texture.region.ITiledTextureRegion; //导入方法依赖的package包/类
protected static float getIdealScale(float scale, ITiledTextureRegion textureRegion) {
if (textureRegion.getHeight() + textureRegion.getWidth() <= 256) {
return scale * 4;
}
return scale;
}