本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.TextureRegion.getTexture方法的典型用法代码示例。如果您正苦于以下问题:Java TextureRegion.getTexture方法的具体用法?Java TextureRegion.getTexture怎么用?Java TextureRegion.getTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.TextureRegion
的用法示例。
在下文中一共展示了TextureRegion.getTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: textureRegion
import com.badlogic.gdx.graphics.g2d.TextureRegion; //导入方法依赖的package包/类
/** Sets the texture region. If this Batchable supports multi-texturing, multiple subsequent calls to this method or
* {@link #texture(GLTexture)} will sequentially set the textures in order.
* <p>
* This method must not be called in a Batchable that supports zero textures.
* @return This object for chaining. */
public Quad textureRegion (TextureRegion region) {
regionIndex = (regionIndex + 1) % getNumberOfTextures();
textures[regionIndex] = region.getTexture();
regions[regionIndex].set(region);
return this;
}
示例2: draw
import com.badlogic.gdx.graphics.g2d.TextureRegion; //导入方法依赖的package包/类
public void draw(TextureRegion region, float x, float y, float width, float height) {
if (!drawing) throw new IllegalStateException("DrawingBatch.begin must be called before draw.");
float[] vertices = this.verticies;
Texture texture = region.getTexture();
if (texture != lastTexture) {
switchTexture(texture);
} else if (index == vertices.length)
flush();
final float fx2 = x + width;
final float fy2 = y + height;
final float u = region.getU();
final float v = region.getV2();
final float u2 = region.getU2();
final float v2 = region.getV();
vertices[index++] = x;
vertices[index++] = y;
vertices[index++] = u;
vertices[index++] = v;
vertices[index++] = multTint;
vertices[index++] = addTint;
vertices[index++] = x;
vertices[index++] = fy2;
vertices[index++] = u;
vertices[index++] = v2;
vertices[index++] = multTint;
vertices[index++] = addTint;
vertices[index++] = fx2;
vertices[index++] = fy2;
vertices[index++] = u2;
vertices[index++] = v2;
vertices[index++] = multTint;
vertices[index++] = addTint;
vertices[index++] = fx2;
vertices[index++] = y;
vertices[index++] = u2;
vertices[index++] = v;
vertices[index++] = multTint;
vertices[index++] = addTint;
}