本文整理汇总了Java中org.andengine.opengl.font.IFont类的典型用法代码示例。如果您正苦于以下问题:Java IFont类的具体用法?Java IFont怎么用?Java IFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFont类属于org.andengine.opengl.font包,在下文中一共展示了IFont类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getHudElements
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
@Override
public List<HUDElement> getHudElements() {
if (elements.isEmpty()) {
final ITiledTextureRegion textureScore = activity.getTexture(ResMan.HUD_SCORE);
final ITiledTextureRegion textureLives = activity.getTexture(ResMan.HUD_LIVES);
final float scale = 0.08f;
Vector2 posS = new Vector2(5, 0);
Vector2 posL = new Vector2(350, 0);
Vector2 offS = new Vector2(75, 30);
Vector2 offL = new Vector2(340, 27.5f);
IFont fontRoboto = activity.getFont(FontAsset.name(ResMan.F_HUD_GUT, ResMan.F_HUD_GUT_SIZE, ResMan.F_HUD_BIN_COLOR, ResMan.F_HUD_BIN_ANTI));
Log.d(TAG, "getHudElements - sprites: " + posS + ", " + posL + " - text:" + offS.add(posS) + ", " + offL.add(posL));
final VertexBufferObjectManager vbom = activity.getVBOM();
HUDScore = new HUDElement()
.buildSprite(posS, textureScore, vbom, scale)
.buildText("", "31337".length(), offS, fontRoboto, vbom);
HUDLives = new HUDElement()
.buildSprite(posL, textureLives, vbom, scale)
.buildText("", "999".length(), offL, fontRoboto, vbom);
elements.add(HUDScore);
elements.add(HUDLives);
}
return elements;
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:33,代码来源:GutGame.java
示例2: getHudElements
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
@Override
public List<HUDElement> getHudElements() {
if (elements.isEmpty()) {
final ITiledTextureRegion textureScore = activity.getTexture(ResMan.HUD_SCORE);
final ITiledTextureRegion textureTime = activity.getTexture(ResMan.HUD_TIME);
final float scale = 0.08f;
Vector2 posS = new Vector2(5, 0);
Vector2 offS = new Vector2(65, 23);
Vector2 posT = new Vector2(350, 0);
Vector2 offT = new Vector2(345, 21);
IFont fontRoboto = activity.getFont(FontAsset.name(ResMan.F_HUD_BIN, ResMan.F_HUD_BIN_SIZE, ResMan.F_HUD_BIN_COLOR, ResMan.F_HUD_BIN_ANTI));
Log.d(TAG, "getHudElements - Score: sprite: " + posS + " - text:" + offS.add(posS));
Log.d(TAG, "getHudElements - Time: sprite: " + posT + " - text:" + offT.add(posT));
final VertexBufferObjectManager vbom = activity.getVBOM();
HUDScore = new HUDElement()
.buildSprite(posS, textureScore, vbom, scale)
.buildText("", "31337".length(), offS, fontRoboto, vbom);
HUDTime = new HUDElement()
.buildSprite(posT, textureTime, vbom, scale)
.buildText("", 8, offT, fontRoboto, vbom)
.setUrgent(false);
elements.add(HUDScore);
elements.add(HUDTime);
}
return elements;
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:34,代码来源:PianoGame.java
示例3: setText
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
/**
* @param pText
* @throws OutOfCharactersException leaves this {@link Text} object in an undefined state, until {@link #setText(CharSequence)} is called again and no {@link OutOfCharactersException} is thrown.
*/
public void setText(final CharSequence pText) throws OutOfCharactersException {
this.mText = pText;
final IFont font = this.mFont;
this.mLines.clear();
this.mLineWidths.clear();
if (this.mTextOptions.mAutoWrap == AutoWrap.NONE) {
this.mLines = FontUtils.splitLines(this.mText, this.mLines); // TODO Add whitespace-trimming.
} else {
this.mLines = FontUtils.splitLines(this.mFont, this.mText, this.mLines, this.mTextOptions.mAutoWrap, this.mTextOptions.mAutoWrapWidth);
}
final int lineCount = this.mLines.size();
float maximumLineWidth = 0;
for (int i = 0; i < lineCount; i++) {
final float lineWidth = FontUtils.measureText(font, this.mLines.get(i));
maximumLineWidth = Math.max(maximumLineWidth, lineWidth);
this.mLineWidths.add(lineWidth);
}
this.mLineWidthMaximum = maximumLineWidth;
if (this.mTextOptions.mAutoWrap == AutoWrap.NONE) {
this.mLineAlignmentWidth = this.mLineWidthMaximum;
} else {
this.mLineAlignmentWidth = this.mTextOptions.mAutoWrapWidth;
}
final float width = this.mLineAlignmentWidth;
final float height = lineCount * font.getLineHeight() + (lineCount - 1) * this.mTextOptions.mLeading;
this.setSize(width, height);
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:39,代码来源:Text.java
示例4: Text
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public Text(final float pX, final float pY, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final ITextVertexBufferObject pTextVertexBufferObject, final ShaderProgram pShaderProgram) {
super(pX, pY, pShaderProgram);
this.mFont = pFont;
this.mTextOptions = pTextOptions;
this.mCharactersMaximum = pCharactersMaximum;
this.mVertexCount = Text.VERTICES_PER_LETTER * this.mCharactersMaximum;
this.mTextVertexBufferObject = pTextVertexBufferObject;
this.onUpdateColor();
this.setText(pText);
this.setBlendingEnabled(true);
this.initBlendFunction(this.mFont.getTexture());
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:16,代码来源:Text.java
示例5: onWin
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public void onWin(int score, float posRatioX, float posRatioY) {
music.pause();
final IFont menuFont = getFont(FontAsset.name(ResMan.F_HUD_BIN, ResMan.F_HUD_BIN_SIZE, ResMan.F_HUD_BIN_COLOR, ResMan.F_HUD_BIN_ANTI));
winText = new Text(0, 0, menuFont, getEndTextAndUpdateHighScore(true, score), 32, new TextOptions(HorizontalAlign.CENTER), getVBOM());
final Vector2 textPosition = spritePosition(winText.getWidth(), winText.getHeight(), posRatioX, posRatioY);
winText.setPosition(textPosition.x, textPosition.y);
winScene.attachChild(winText);
updateNextGame();
currentGame.logLevelEnd(score, true);
gameScene.setChildScene(winScene, false, true, true);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:12,代码来源:AbstractGameActivity.java
示例6: Text
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public Text(final float pX, final float pY, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final ITextVertexBufferObject pTextVertexBufferObject, final ShaderProgram pShaderProgram) {
super(pX, pY, 0, 0, pShaderProgram);
this.mFont = pFont;
this.mTextOptions = pTextOptions;
this.mCharactersMaximum = pCharactersMaximum;
this.mVertexCount = Text.VERTICES_PER_LETTER * this.mCharactersMaximum;
this.mTextVertexBufferObject = pTextVertexBufferObject;
this.onUpdateColor();
this.setText(pText);
this.setBlendingEnabled(true);
this.initBlendFunction(this.mFont.getTexture());
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:16,代码来源:Text.java
示例7: setText
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
/**
* @param pText
* @throws org.andengine.entity.text.exception.OutOfCharactersException leaves this {@link org.andengine.entity.text.Text} object in an undefined state, until {@link #setText(CharSequence)} is called again and no {@link org.andengine.entity.text.exception.OutOfCharactersException} is thrown.
*/
public void setText(final CharSequence pText) throws OutOfCharactersException {
this.mText = pText;
final IFont font = this.mFont;
this.mLines.clear();
this.mLineWidths.clear();
if (this.mTextOptions.mAutoWrap == AutoWrap.NONE) {
this.mLines = FontUtils.splitLines(this.mText, this.mLines); // TODO Add whitespace-trimming.
} else {
this.mLines = FontUtils.splitLines(this.mFont, this.mText, this.mLines, this.mTextOptions.mAutoWrap, this.mTextOptions.mAutoWrapWidth);
}
final int lineCount = this.mLines.size();
float maximumLineWidth = 0;
for (int i = 0; i < lineCount; i++) {
final float lineWidth = FontUtils.measureText(font, this.mLines.get(i));
maximumLineWidth = Math.max(maximumLineWidth, lineWidth);
this.mLineWidths.add(lineWidth);
}
this.mLineWidthMaximum = maximumLineWidth;
if (this.mTextOptions.mAutoWrap == AutoWrap.NONE) {
this.mLineAlignmentWidth = this.mLineWidthMaximum;
} else {
this.mLineAlignmentWidth = this.mTextOptions.mAutoWrapWidth;
}
final float width = this.mLineAlignmentWidth;
final float height = lineCount * font.getLineHeight() + (lineCount - 1) * this.mTextOptions.mLeading;
this.setSize(width, height);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:39,代码来源:Text.java
示例8: getHudElements
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
@Override
public List<HUDElement> getHudElements() {
final ITiledTextureRegion textureScore = activity.getTexture(ResMan.HUD_SCORE);
final ITiledTextureRegion textureTime = activity.getTexture(ResMan.HUD_TIME);
final float scale = 0.120f;
Vector2 posS = new Vector2(5, 0); //activity.spritePosition(textureScore, 0.1f, 0.05f, HUDElement.SCALE_DEFAULT);
Vector2 posT = new Vector2(155, 0); //activity.spritePosition(textureTime, 0.6f, 0.05f, HUDElement.SCALE_DEFAULT);
Vector2 offS = new Vector2(90, 45);
Vector2 offT = new Vector2(185, 45);
IFont fontRoboto = activity.getFont(FontAsset.name(ResMan.F_HUD_BIN, ResMan.F_HUD_BIN_SIZE, ResMan.F_HUD_PICTO_COLOR, ResMan.F_HUD_BIN_ANTI));
final VertexBufferObjectManager vbom = activity.getVBOM();
HUDScore = new HUDElement()
.buildSprite(posS, textureScore, vbom, scale)
.buildText("", 8, posS.add(offS), fontRoboto, vbom)
.setUrgent(false);
HUDTime = new HUDElement()
.buildSprite(posT, textureTime, vbom, scale)
.buildText("", 8, posT.add(offT), fontRoboto, vbom)
.setUrgent(false);
elements.add(HUDScore);
elements.add(HUDTime);
return elements;
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:32,代码来源:PictoGame.java
示例9: getFont
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public IFont getFont(String fontName) {
final IFont font = fontMap.get(fontName);
if (font != null) {
Log.v(TAG, "getFont - returning font " + fontName);
} else {
Log.v(TAG, "getFont - missing font " + fontName);
}
return font;
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:10,代码来源:AbstractGameActivity.java
示例10: onLose
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public void onLose(int score, float posRatioX, float posRatioY) {
music.pause();
final IFont menuFont = getFont(FontAsset.name(ResMan.F_HUD_BIN, ResMan.F_HUD_BIN_SIZE, ResMan.F_HUD_BIN_COLOR, ResMan.F_HUD_BIN_ANTI));
gameOverText = new Text(0, 0, menuFont, getEndTextAndUpdateHighScore(false, score), 32, new TextOptions(HorizontalAlign.CENTER), getVBOM());
final Vector2 textPosition = spritePosition(gameOverText.getWidth(), gameOverText.getHeight(), posRatioX, posRatioY);
gameOverText.setPosition(textPosition.x, textPosition.y);
pauseScene.attachChild(gameOverText);
currentGame.logLevelEnd(score, false);
gameScene.setChildScene(pauseScene, false, true, true);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:11,代码来源:AbstractGameActivity.java
示例11: TextMenuItem
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType, final ShaderProgram pShaderProgram) {
super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pVertexBufferObjectManager, pDrawType, pShaderProgram);
this.mID = pID;
}
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:6,代码来源:TextMenuItem.java
示例12: TextMenuItem
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final VertexBufferObjectManager pVertexBufferObjectManager, final ShaderProgram pShaderProgram) {
super(0, 0, pFont, pText, pVertexBufferObjectManager, pShaderProgram);
this.mID = pID;
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:6,代码来源:TextMenuItem.java
示例13: buildText
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
public HUDElement buildText(CharSequence textDefault, int textMaxLength, Vector2 pos, IFont font, VertexBufferObjectManager manager) {
return buildText(textDefault, textMaxLength, pos.x, pos.y, font, manager);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:4,代码来源:HUDElement.java
示例14: putFont
import org.andengine.opengl.font.IFont; //导入依赖的package包/类
private void putFont(String fontName, IFont font) {
fontMap.put(fontName, font);
Log.v(TAG, "putFont - Added font " + fontName);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:5,代码来源:AbstractGameActivity.java
注:本文中的org.andengine.opengl.font.IFont类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论