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


Java Font类代码示例

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


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

示例1: createTextRectangle

import org.andengine.opengl.font.Font; //导入依赖的package包/类
public Rectangle createTextRectangle(String titleStr, Font titleFont, String detatilStr, Font detailFont,
		VertexBufferObjectManager pVertexBufferObjectManager) {
	
	Text titleText = new Text(0, 0, titleFont, titleStr, 
			pVertexBufferObjectManager);
	Text detatilText = new Text(0, 0, detailFont, detatilStr, 
			pVertexBufferObjectManager);
	titleText.setPosition(0, 0);
	detatilText.setPosition(titleText.getX() + titleText.getWidth(), titleText.getY());
	
	float textWidth = titleText.getWidth() + detatilText.getWidth();
	float textHeight = titleText.getHeight();
	Rectangle resultRectangle = new Rectangle(0, 0, textWidth, textHeight, 
			pVertexBufferObjectManager);
	
	resultRectangle.setColor(Color.TRANSPARENT);
	resultRectangle.setAlpha(0.0f);
	resultRectangle.attachChild(titleText);
	resultRectangle.attachChild(detatilText);
	return resultRectangle;
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:22,代码来源:TextLogic.java

示例2: initLayer

import org.andengine.opengl.font.Font; //导入依赖的package包/类
private void initLayer(KeyListenScene pBaseScene, String pText) {
	// レイヤー作成
	setColor(Color.BLACK);
	setAlpha(0.7f);
	setVisible(false);
	setZIndex(LayerZIndexType.CUTIN_LAYER.getValue());
	
	// フォント
	Font titleFont = pBaseScene.createFont(Typeface.SANS_SERIF, 36, Color.WHITE);
	// 表示テキスト
	Text winConditionTitle = new Text(16, 16, titleFont, 
			pText, 
			new TextOptions(HorizontalAlign.CENTER), 
			pBaseScene.getBaseActivity().getVertexBufferObjectManager());
	pBaseScene.placeToCenter(winConditionTitle);
	winConditionTitle.setY(winConditionTitle.getY() - 40);
	attachChild(winConditionTitle);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:19,代码来源:TextCutInTouchLayer.java

示例3: initFps

import org.andengine.opengl.font.Font; //导入依赖的package包/类
/**
 * FPSの画面表示.
 */
protected void initFps(float x, float y, Font font) {
	mFpsText= new Text(x, y, font, "FPS:0.000000000000000000000000", 
			getBaseActivity().getVertexBufferObjectManager());
	mFpsText.setZIndex(999);
	mFpsText.setTag(FPS_TAG);
	attachChild(mFpsText);

	mFpsCounter = new AverageFPSCounter(1) {
		
		@Override
		protected void onHandleAverageDurationElapsed(float pFPS) {
			mFpsText.setText("FPS:" + pFPS);
		}
	};
	registerUpdateHandler(mFpsCounter);
	
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:21,代码来源:KeyListenScene.java

示例4: dialogText

import org.andengine.opengl.font.Font; //导入依赖的package包/类
/**
 * Font used for displaying text in a Button
 * @return
 */
public static Font dialogText() {
    if (dialogFont == null) {
        BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
        dialogFont = FontFactory.create(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 32, true, new Color(0.5f, 0.5f, 0.5f).getABGRPackedInt());
        dialogFont.load();
    }
    return dialogFont;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java

示例5: itemCost

import org.andengine.opengl.font.Font; //导入依赖的package包/类
/**
 * Font used for displaying the cost of an InventoryItem.
 * @return
 */
public static Font itemCost() {
    if (itemCostFont == null) {
        BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
        itemCostFont = FontFactory.createStroke(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 24, true, new Color(0.96f, 0.70f, 0f).getARGBPackedInt(), 0.5f, new Color(0.95f, 0.61f, 0f).getARGBPackedInt());
        itemCostFont.load();
    }
    return itemCostFont;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java

示例6: inventoryCount

import org.andengine.opengl.font.Font; //导入依赖的package包/类
/**
 * Font used for displaying the quantity of an InventoryItem.
 * @return
 */
public static Font inventoryCount() {
    if (inventoryCountFont == null) {
        BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
        inventoryCountFont = FontFactory.create(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 24, true, new Color(0.5f, 0.5f, 0.5f).getABGRPackedInt());
        inventoryCountFont.load();
    }
    return inventoryCountFont;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java

示例7: defaultHUDDisplay

import org.andengine.opengl.font.Font; //导入依赖的package包/类
/**
 * Font used for displaying the level and account balance in the DefaultHUD.
 * @return
 */
public static Font defaultHUDDisplay() {
    if (defaultHUDDisplayFont == null) {
        BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
        defaultHUDDisplayFont = FontFactory.create(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 30, true, Color.WHITE_ARGB_PACKED_INT);
        defaultHUDDisplayFont.load();
    }
    return defaultHUDDisplayFont;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:GameFonts.java

示例8: introText

import org.andengine.opengl.font.Font; //导入依赖的package包/类
public static Font introText() {
    if (introTextFont == null) {
        BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
        introTextFont = FontFactory.create(PhoeniciaContext.fontManager, PhoeniciaContext.textureManager, 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 36, Color.BLUE_ARGB_PACKED_INT);
        introTextFont.load();
    }
    return introTextFont;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:9,代码来源:GameFonts.java

示例9: buttonText

import org.andengine.opengl.font.Font; //导入依赖的package包/类
/**
 * Font used for displaying text in a Button
 * @return
 */
public static Font buttonText() {
    if (buttonFont == null) {
        Color borderColor = new Color(20/255f, 91/255f, 164/255f);
        BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
        buttonFont = FontFactory.createStroke(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 32, true, Color.WHITE_ARGB_PACKED_INT, 0.75f, borderColor.getARGBPackedInt());
        buttonFont.load();
    }
    return buttonFont;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:14,代码来源:GameFonts.java

示例10: progressText

import org.andengine.opengl.font.Font; //导入依赖的package包/类
public static Font progressText() {
    if (progressFont == null) {
        BitmapTextureAtlas texture = new BitmapTextureAtlas(PhoeniciaContext.textureManager, 1024, 1024, TextureOptions.BILINEAR);
        progressFont = FontFactory.createStroke(PhoeniciaContext.fontManager, texture, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD), 24, true, Color.WHITE_ARGB_PACKED_INT, 0.5f, Color.BLUE_ARGB_PACKED_INT);
        progressFont.load();
    }
    return progressFont;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:9,代码来源:GameFonts.java

示例11: Button

import org.andengine.opengl.font.Font; //导入依赖的package包/类
public Button(float x, float y, float w, float h, String text, Color color, VertexBufferObjectManager pVertexBufferObjectManager, OnClickListener pOnClickListener) {
    super(x, y, w, h);
    this.clickDetector = new ClickDetector(this);
    this.clickListener = pOnClickListener;

    this.background = new Rectangle(this.getWidth()/2, this.getHeight()/2, w, h, pVertexBufferObjectManager);
    this.background.setColor(color);
    this.attachChild(this.background);

    final Font buttonFont = GameFonts.buttonText();
    this.buttonText = new Text(this.getWidth()/2, this.getHeight()/2, buttonFont, text, text.length(), new TextOptions(HorizontalAlign.CENTER), pVertexBufferObjectManager);
    this.attachChild(this.buttonText);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:14,代码来源:Button.java

示例12: loadFont

import org.andengine.opengl.font.Font; //导入依赖的package包/类
private Font loadFont(String fontName, int fontSize) {
    FontFactory.setAssetBasePath("font/");
    Font fontRes;
    fontRes = FontFactory.createFromAsset(engine.getFontManager(), engine.getTextureManager(), 512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA, context.getAssets(), fontName
            , fontSize, true, Color.WHITE);
    fontRes.load();
    return fontRes;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:9,代码来源:ResourceManager.java

示例13: loadGameFonts

import org.andengine.opengl.font.Font; //导入依赖的package包/类
public void loadGameFonts() {

        mTypeface = Typeface.createFromAsset(mContext.getAssets(), "LCD.ttf");
        final ITexture scoreTexture = new BitmapTextureAtlas(mContext.getTextureManager(), 256, 512, TextureOptions.BILINEAR);
        mGameFont = new Font(mContext.getFontManager(), scoreTexture, mTypeface, 18, true, new Color(Color.BLACK));
        scoreTexture.load();
        mGameFont.load();

        final BitmapTextureAtlas gamePlayTexture = new BitmapTextureAtlas(mContext.getTextureManager(), 512, 512, TextureOptions.BILINEAR);
        mGamePlayFont = new StrokeFont(mContext.getFontManager(), gamePlayTexture, mTypeface, 96, true, new Color(Color.WHITE), 0, new Color(Color.WHITE));
        gamePlayTexture.load();
        mGamePlayFont.load();

    }
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:15,代码来源:ResourceManager.java

示例14: init

import org.andengine.opengl.font.Font; //导入依赖的package包/类
@Override
public void init(GameLevel gameLevel, PhysicsWorld physicsWorld, Engine engine) {
    super.init(gameLevel, physicsWorld, engine);

    float camHeight = engine.getCamera().getHeight();
    float originalHeight = 1920;
    float heightScale = camHeight / originalHeight;

    Typeface typeFace = Typeface.createFromAsset(GoogleFlipGameApplication.sContext.getAssets(), FontFaceType.FUTURA_BOOK.getAssetName());

    Font explanationFont = FontFactory.create(_engine.getFontManager(), _engine.getTextureManager(), 512, 768, TextureOptions.BILINEAR, typeFace, (int) 20 * GoogleFlipGameApplication.sContext.getResources().getDisplayMetrics().density, Color.WHITE_ABGR_PACKED_INT);
    explanationFont.load();

    _engine.getFontManager().loadFont(explanationFont);

    Vector2 textPoint = Vector2Pool.obtain(_engine.getCamera().getWidth() / 2, _engine.getCamera().getHeight() * .70f);
    String explanation1, explanation2;

    switch (GoogleFlipGameApplication.getUserModel().getTutorialLevel()) {
        case 1:
            explanation1 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_2a);
            explanation2 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_2b);
            break;
        case 2:
            explanation1 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_3);
            explanation2 = "";
            break;
        default:
            explanation1 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_1a);
            explanation2 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_1b);
break;
    }

    _explanationText1 = new Text(textPoint.x, textPoint.y, explanationFont, explanation1, new TextOptions(HorizontalAlign.CENTER), _engine.getVertexBufferObjectManager());
    _explanationText2 = new Text(textPoint.x, textPoint.y - (_explanationText1.getHeight()), explanationFont, explanation2, new TextOptions(HorizontalAlign.CENTER), _engine.getVertexBufferObjectManager());

    _engine.getScene().attachChild(_explanationText1);
    _engine.getScene().attachChild(_explanationText2);
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:40,代码来源:TutorialLevelController.java

示例15: loadFonts

import org.andengine.opengl.font.Font; //导入依赖的package包/类
private void loadFonts(BaseGame game) {
    checkSetFontPath();

    for (FontAsset asset : game.getFontAssets()) {
        Font font = loadFont(asset);
        font.load();
        putFont(asset.toString(), font);
    }

    Log.d(TAG, "loadFonts - Finished loading fonts.");
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:12,代码来源:AbstractGameActivity.java


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