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

Java IFont类代码示例

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

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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