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


Java ITexture.getWidth方法代码示例

本文整理汇总了Java中org.andengine.opengl.texture.ITexture.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java ITexture.getWidth方法的具体用法?Java ITexture.getWidth怎么用?Java ITexture.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.andengine.opengl.texture.ITexture的用法示例。


在下文中一共展示了ITexture.getWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Font

import org.andengine.opengl.texture.ITexture; //导入方法依赖的package包/类
public Font(final FontManager pFontManager, final ITexture pTexture, final Typeface pTypeface, final float pSize, final boolean pAntiAlias, final int pColorARGBPackedInt) {
	this.mFontManager = pFontManager;
	this.mTexture = pTexture;
	this.mTextureWidth = pTexture.getWidth();
	this.mTextureHeight = pTexture.getHeight();

	this.mBackgroundPaint = new Paint();
	this.mBackgroundPaint.setColor(Color.TRANSPARENT_ARGB_PACKED_INT);
	this.mBackgroundPaint.setStyle(Style.FILL);

	this.mPaint = new Paint();
	this.mPaint.setTypeface(pTypeface);
	this.mPaint.setColor(pColorARGBPackedInt);
	this.mPaint.setTextSize(pSize);
	this.mPaint.setAntiAlias(pAntiAlias);

	this.mFontMetrics = this.mPaint.getFontMetrics();
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:19,代码来源:Font.java

示例2: updateUV

import org.andengine.opengl.texture.ITexture; //导入方法依赖的package包/类
public void updateUV() {
		final ITexture texture = this.mTexture;
		final float textureWidth = texture.getWidth();
		final float textureHeight = texture.getHeight();

		final float x = this.getTextureX();
		final float y = this.getTextureY();

		this.mU = x / textureWidth;
		this.mU2 = (x + this.mTextureWidth) / textureWidth;

		this.mV = y / textureHeight;
		this.mV2 = (y + this.mTextureHeight) / textureHeight;

//		this.mU = (x + 0.5f) / textureWidth;
//		this.mU2 = (x + this.mTextureWidth - 0.5f) / textureWidth;
//
//		this.mV = (y + 0.5f) / textureHeight;
//		this.mV2 = (y + this.mTextureHeight - 0.5f) / textureHeight;
	}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:21,代码来源:TextureRegion.java

示例3: parseCharacters

import org.andengine.opengl.texture.ITexture; //导入方法依赖的package包/类
private void parseCharacters(final int pCharacterCount, final BufferedReader pBufferedReader) throws IOException {
		for (int i = pCharacterCount - 1; i >= 0; i--) {
			final String character = pBufferedReader.readLine();
			final String[] charAttributes = TextUtils.SPLITPATTERN_SPACES.split(character, BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + 1);
			if ((charAttributes.length - 1) != BitmapFont.TAG_CHAR_ATTRIBUTECOUNT) {
				throw new FontException("Expected: '" + BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_CHAR + " attributes, found: '" + (charAttributes.length - 1) + "'.");
			}
			if (!charAttributes[0].equals(BitmapFont.TAG_CHAR)) {
				throw new FontException("Expected: '" + BitmapFont.TAG_CHAR + "' attributes.");
			}

			final char id = BitmapFont.getCharAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_ID);
			final int x = this.mBitmapFontOptions.mTextureOffsetX + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_X_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_X);
			final int y = this.mBitmapFontOptions.mTextureOffsetY + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_Y_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_Y);
			final int width = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH);
			final int height = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT);
			final int xOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET);
			final int yOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET);
			final int xAdvance = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE);
			final int page = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE);
//			final int channel = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL);

			final ITexture bitmapFontPageTexture = this.mBitmapFontPages[page].getTexture();
			final float textureWidth = bitmapFontPageTexture.getWidth();
			final float textureHeight = bitmapFontPageTexture.getHeight();

			final float u = x / textureWidth;
			final float v = y / textureHeight;
			final float u2 = (x + width) / textureWidth;
			final float v2 = (y + height) / textureHeight;

			this.mCharacterToLetterMap.put(id, new Letter((char) id, x, y, width, height, xOffset, yOffset, xAdvance, u, v, u2, v2));
		}
	}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:35,代码来源:BitmapFont.java

示例4: parseCharacters

import org.andengine.opengl.texture.ITexture; //导入方法依赖的package包/类
private void parseCharacters(final int pCharacterCount, final BufferedReader pBufferedReader) throws IOException {
		for(int i = pCharacterCount - 1; i >= 0; i--) {
			final String character = pBufferedReader.readLine();
			final String[] charAttributes = TextUtils.SPLITPATTERN_SPACES.split(character, BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + 1);
			if((charAttributes.length - 1) != BitmapFont.TAG_CHAR_ATTRIBUTECOUNT) {
				throw new FontException("Expected: '" + BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_CHAR + " attributes, found: '" + (charAttributes.length - 1) + "'.");
			}
			if(!charAttributes[0].equals(BitmapFont.TAG_CHAR)) {
				throw new FontException("Expected: '" + BitmapFont.TAG_CHAR + "' attributes.");
			}

			final char id = BitmapFont.getCharAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_ID);
			final int x = this.mBitmapFontOptions.mTextureOffsetX + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_X_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_X);
			final int y = this.mBitmapFontOptions.mTextureOffsetY + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_Y_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_Y);
			final int width = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH);
			final int height = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT);
			final int xOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET);
			final int yOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET);
			final int xAdvance = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE);
			final int page = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE);
//			final int channel = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL);

			final ITexture bitmapFontPageTexture = this.mBitmapFontPages[page].getTexture();
			final float textureWidth = bitmapFontPageTexture.getWidth();
			final float textureHeight = bitmapFontPageTexture.getHeight();

			final float u = x / textureWidth;
			final float v = y / textureHeight;
			final float u2 = (x + width) / textureWidth;
			final float v2 = (y + height) / textureHeight;

			this.mCharacterToLetterMap.put(id, new Letter(id, x, y, width, height, xOffset, yOffset, xAdvance, u, v, u2, v2));
		}
	}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:35,代码来源:BitmapFont.java

示例5: extractFromTexture

import org.andengine.opengl.texture.ITexture; //导入方法依赖的package包/类
public static TextureRegion extractFromTexture(final ITexture pTexture, final boolean pRotated) {
	return new TextureRegion(pTexture, 0, 0, pTexture.getWidth(), pTexture.getHeight(), pRotated);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:4,代码来源:TextureRegionFactory.java


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