• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FontException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.andengine.opengl.font.exception.FontException的典型用法代码示例。如果您正苦于以下问题:Java FontException类的具体用法?Java FontException怎么用?Java FontException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FontException类属于org.andengine.opengl.font.exception包,在下文中一共展示了FontException类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseKernings

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private void parseKernings(final int pKerningsCount, final BufferedReader pBufferedReader) throws IOException {
	for (int i = pKerningsCount - 1; i >= 0; i--) {
		final String kerning = pBufferedReader.readLine();
		final String[] charAttributes = TextUtils.SPLITPATTERN_SPACES.split(kerning, BitmapFont.TAG_KERNING_ATTRIBUTECOUNT + 1);
		if ((charAttributes.length - 1) != BitmapFont.TAG_KERNING_ATTRIBUTECOUNT) {
			throw new FontException("Expected: '" + BitmapFont.TAG_KERNING_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_KERNING + " attributes, found: '" + (charAttributes.length - 1) + "'.");
		}
		if (!charAttributes[0].equals(BitmapFont.TAG_KERNING)) {
			throw new FontException("Expected: '" + BitmapFont.TAG_KERNING + "' attributes.");
		}

		final int first = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_KERNING_ATTRIBUTE_FIRST_INDEX, BitmapFont.TAG_KERNING_ATTRIBUTE_FIRST);
		final int second = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_KERNING_ATTRIBUTE_SECOND_INDEX, BitmapFont.TAG_KERNING_ATTRIBUTE_SECOND);
		final int amount = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_KERNING_ATTRIBUTE_AMOUNT_INDEX, BitmapFont.TAG_KERNING_ATTRIBUTE_AMOUNT);

		this.mCharacterToLetterMap.get(first).addKerning(second, amount);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:19,代码来源:BitmapFont.java


示例2: BitmapFontPage

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
public BitmapFontPage(final AssetManager pAssetManager, final String pAssetBasePath, final String pData) throws IOException {
	final String[] pageAttributes = TextUtils.SPLITPATTERN_SPACE.split(pData, BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + 1);

	if ((pageAttributes.length - 1) != BitmapFont.TAG_PAGE_ATTRIBUTECOUNT) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_PAGE + " attributes, found: '" + (pageAttributes.length - 1) + "'.");
	}
	if (!pageAttributes[0].equals(BitmapFont.TAG_PAGE)) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE + "' attributes.");
	}

	this.mID = BitmapFont.getIntAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_ID);
	final String file = BitmapFont.getStringAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE);

	final String assetPath = pAssetBasePath + file;
	this.mTexture = new BitmapTexture(BitmapFont.this.mTextureManager, new AssetInputStreamOpener(pAssetManager, assetPath), BitmapFont.this.mBitmapTextureFormat, BitmapFont.this.mTextureOptions);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:17,代码来源:BitmapFont.java


示例3: getLetterBitmap

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
protected Bitmap getLetterBitmap(final Letter pLetter) throws FontException {
	final char character = pLetter.mCharacter;
	final String characterAsString = String.valueOf(character);

	final int width = pLetter.mWidth + (2 * Font.LETTER_TEXTURE_PADDING);
	final int height = pLetter.mHeight + (2 * Font.LETTER_TEXTURE_PADDING);

	final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
	this.mCanvas.setBitmap(bitmap);

	/* Make background transparent. */
	this.mCanvas.drawRect(0, 0, bitmap.getWidth(), bitmap.getHeight(), this.mBackgroundPaint);

	/* Actually draw the character. */
	final float drawLetterLeft = -pLetter.mOffsetX;
	final float drawLetterTop = -pLetter.mOffsetY;

	this.drawLetter(characterAsString, drawLetterLeft, drawLetterTop);

	return bitmap;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:22,代码来源:Font.java


示例4: parseKernings

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private void parseKernings(final int pKerningsCount, final BufferedReader pBufferedReader) throws IOException {
	for(int i = pKerningsCount - 1; i >= 0; i--) {
		final String kerning = pBufferedReader.readLine();
		final String[] charAttributes = TextUtils.SPLITPATTERN_SPACES.split(kerning, BitmapFont.TAG_KERNING_ATTRIBUTECOUNT + 1);
		if((charAttributes.length - 1) != BitmapFont.TAG_KERNING_ATTRIBUTECOUNT) {
			throw new FontException("Expected: '" + BitmapFont.TAG_KERNING_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_KERNING + " attributes, found: '" + (charAttributes.length - 1) + "'.");
		}
		if(!charAttributes[0].equals(BitmapFont.TAG_KERNING)) {
			throw new FontException("Expected: '" + BitmapFont.TAG_KERNING + "' attributes.");
		}

		final int first = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_KERNING_ATTRIBUTE_FIRST_INDEX, BitmapFont.TAG_KERNING_ATTRIBUTE_FIRST);
		final int second = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_KERNING_ATTRIBUTE_SECOND_INDEX, BitmapFont.TAG_KERNING_ATTRIBUTE_SECOND);
		final int amount = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_KERNING_ATTRIBUTE_AMOUNT_INDEX, BitmapFont.TAG_KERNING_ATTRIBUTE_AMOUNT);

		this.mCharacterToLetterMap.get(first).addKerning(second, amount);
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:19,代码来源:BitmapFont.java


示例5: BitmapFontPage

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
public BitmapFontPage(final AssetManager pAssetManager, final String pAssetBasePath, final String pData) throws IOException {
	final String[] pageAttributes = TextUtils.SPLITPATTERN_SPACE.split(pData, BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + 1);

	if((pageAttributes.length - 1) != BitmapFont.TAG_PAGE_ATTRIBUTECOUNT) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_PAGE + " attributes, found: '" + (pageAttributes.length - 1) + "'.");
	}
	if(!pageAttributes[0].equals(BitmapFont.TAG_PAGE)) {
		throw new FontException("Expected: '" + BitmapFont.TAG_PAGE + "' attributes.");
	}

	this.mID = BitmapFont.getIntAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_ID);
	final String file = BitmapFont.getStringAttribute(pageAttributes, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE_INDEX, BitmapFont.TAG_PAGE_ATTRIBUTE_FILE);

	final String assetPath = pAssetBasePath + file;
	this.mTexture = new BitmapTexture(BitmapFont.this.mTextureManager, new AssetInputStreamOpener(pAssetManager, assetPath), BitmapFont.this.mBitmapTextureFormat, BitmapFont.this.mTextureOptions);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:17,代码来源:BitmapFont.java


示例6: getLetterBitmap

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
protected Bitmap getLetterBitmap(final Letter pLetter) throws FontException {
	final char character = pLetter.mCharacter;
	final String characterAsString = String.valueOf(character);

	final int width = pLetter.mWidth + (2 * Font.LETTER_TEXTURE_PADDING);
	final int height = pLetter.mHeight + (2 * Font.LETTER_TEXTURE_PADDING);

	final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
	this.mCanvas.setBitmap(bitmap);

	/* Make background transparent. */
	this.mCanvas.drawRect(0, 0, bitmap.getWidth(), bitmap.getHeight(), this.mBackgroundPaint);

	/* Actually draw the character. */
	final float drawLetterLeft = -pLetter.mOffsetX;
	final float drawLetterTop = -(pLetter.mOffsetY + this.getAscent());

	this.drawLetter(characterAsString, drawLetterLeft, drawLetterTop);

	return bitmap;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:22,代码来源:Font.java


示例7: parseCharacters

import org.andengine.opengl.font.exception.FontException; //导入依赖的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


示例8: getBooleanAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static boolean getBooleanAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if (!data.startsWith(pAttribute) || (data.charAt(attributeLength) != '=')) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return Integer.parseInt(data.substring(attributeLength + 1)) != 0;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:BitmapFont.java


示例9: getIntAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static int getIntAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if (!data.startsWith(pAttribute) || (data.charAt(attributeLength) != '=')) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return Integer.parseInt(data.substring(attributeLength + 1));
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:BitmapFont.java


示例10: getStringAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static String getStringAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if (!data.startsWith(pAttribute) || (data.charAt(attributeLength) != '=')) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return data.substring(attributeLength + 2, data.length() - 1);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:BitmapFont.java


示例11: getAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static String getAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if (!data.startsWith(pAttribute)) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return data.substring(attributeLength + 1);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:BitmapFont.java


示例12: BitmapFontInfo

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
public BitmapFontInfo(final String pData) throws FontException {
	if (pData == null) {
		throw new FontException("pData must not be null.");
	}

	final String[] infoAttributes = TextUtils.SPLITPATTERN_SPACE.split(pData, BitmapFont.TAG_INFO_ATTRIBUTECOUNT + 1);

	if ((infoAttributes.length - 1) != BitmapFont.TAG_INFO_ATTRIBUTECOUNT) {
		throw new FontException("Expected: '" + BitmapFont.TAG_INFO_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_INFO + " attributes, found: '" + (infoAttributes.length - 1) + "'.");
	}
	if (!infoAttributes[0].equals(BitmapFont.TAG_INFO)) {
		throw new FontException("Expected: '" + BitmapFont.TAG_INFO + "' attributes.");
	}

	this.mFace = BitmapFont.getStringAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_FACE_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_FACE);
	this.mSize = BitmapFont.getIntAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_SIZE_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_SIZE);
	this.mBold = BitmapFont.getBooleanAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_BOLD_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_BOLD);
	this.mItalic = BitmapFont.getBooleanAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_ITALIC_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_ITALIC);
	this.mCharset = BitmapFont.getStringAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_CHARSET_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_CHARSET);
	this.mUnicode = BitmapFont.getIntAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_UNICODE_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_UNICODE);
	this.mStretchHeight = BitmapFont.getIntAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_STRETCHHEIGHT_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_STRETCHHEIGHT);
	this.mSmooth = BitmapFont.getBooleanAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_SMOOTH_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_SMOOTH);
	this.mAntiAliased = BitmapFont.getBooleanAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_ANTIALIASED_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_ANTIALIASED);

	final String padding = BitmapFont.getAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_PADDING_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_PADDING);
	final String[] paddings = TextUtils.SPLITPATTERN_COMMA.split(padding, 4);
	this.mPaddingLeft = Integer.parseInt(paddings[BitmapFontInfo.PADDING_LEFT_INDEX]);
	this.mPaddingTop = Integer.parseInt(paddings[BitmapFontInfo.PADDING_TOP_INDEX]);
	this.mPaddingRight = Integer.parseInt(paddings[BitmapFontInfo.PADDING_RIGHT_INDEX]);
	this.mPaddingBottom = Integer.parseInt(paddings[BitmapFontInfo.PADDING_BOTTOM_INDEX]);

	final String spacing = BitmapFont.getAttribute(infoAttributes, BitmapFont.TAG_INFO_ATTRIBUTE_SPACING_INDEX, BitmapFont.TAG_INFO_ATTRIBUTE_SPACING);
	final String[] spacings = TextUtils.SPLITPATTERN_COMMA.split(spacing, 2);
	this.mSpacingX = Integer.parseInt(spacings[BitmapFontInfo.SPACING_X_INDEX]);
	this.mSpacingY = Integer.parseInt(spacings[BitmapFontInfo.SPACING_Y_INDEX]);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:37,代码来源:BitmapFont.java


示例13: getLetter

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
@Override
public synchronized Letter getLetter(final char pCharacter) throws FontException {
	Letter letter = this.mManagedCharacterToLetterMap.get(pCharacter);
	if (letter == null) {
		letter = this.createLetter(pCharacter);

		this.mLettersPendingToBeDrawnToTexture.add(letter);
		this.mManagedCharacterToLetterMap.put(pCharacter, letter);
	}
	return letter;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:Font.java


示例14: parseCharacters

import org.andengine.opengl.font.exception.FontException; //导入依赖的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


示例15: getBooleanAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static boolean getBooleanAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if(!data.startsWith(pAttribute) || (data.charAt(attributeLength) != '=')) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return Integer.parseInt(data.substring(attributeLength + 1)) != 0;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:11,代码来源:BitmapFont.java


示例16: getIntAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static int getIntAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if(!data.startsWith(pAttribute) || (data.charAt(attributeLength) != '=')) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return Integer.parseInt(data.substring(attributeLength + 1));
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:11,代码来源:BitmapFont.java


示例17: getStringAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static String getStringAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if(!data.startsWith(pAttribute) || (data.charAt(attributeLength) != '=')) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return data.substring(attributeLength + 2, data.length() - 1);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:11,代码来源:BitmapFont.java


示例18: getAttribute

import org.andengine.opengl.font.exception.FontException; //导入依赖的package包/类
private static String getAttribute(final String[] pData, final int pPosition, final String pAttribute) {
	final String data = pData[pPosition];
	final int attributeLength = pAttribute.length();

	if(!data.startsWith(pAttribute)) {
		throw new FontException("Expected '" + pAttribute + "' at position '" + pPosition + "', but found: '" + data + "'.");
	}

	return data.substring(attributeLength + 1);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:11,代码来源:BitmapFont.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Builder类代码示例发布时间:2022-05-23
下一篇:
Java ShorthandCompletion类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap