當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureRegion.getTexture方法代碼示例

本文整理匯總了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;
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:12,代碼來源:Quad.java

示例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;
}
 
開發者ID:SergeySave,項目名稱:SpaceGame,代碼行數:47,代碼來源:DrawingBatch.java


注:本文中的com.badlogic.gdx.graphics.g2d.TextureRegion.getTexture方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。