/** Draw score counters */ private void drawScore(SpriteBatch batch) { BitmapFont font = getFont(); if (!bareScoreCnt.isStopped()) { bareScoreCnt.update(Gdx.graphics.getDeltaTime()); String str = "" + bareScoreCnt.getValue(); font.draw( batch, str, -(str.length() * font.getSpaceWidth()) / 2.0f, font.getXHeight() + 150.0f); } else if (!additionalPointsCnt.isStopped()) { additionalPointsCnt.update(Gdx.graphics.getDeltaTime()); String str = bareScoreCnt.getValue() + " + " + additionalPointsCnt.getValue(); font.draw( batch, str, -(str.length() * font.getSpaceWidth()) / 2.0f, font.getXHeight() + 150.0f); } else { String str = bareScoreCnt.getValue() + " + " + additionalPointsCnt.getValue() + scoreText; font.draw( batch, str, -(str.length() * font.getSpaceWidth()) / 2.0f, font.getXHeight() + 150.0f); } }
/** Draw score counters and badges */ private void drawStats(SpriteBatch batch) { BitmapFont font = getFont(); /* Level cleared text */ font.draw( batch, levelClearedText, -(levelClearedText.length() * font.getSpaceWidth()) / 2.0f, font.getXHeight() + 250.0f); drawScore(batch); drawBadges(batch); }
@Override public void update(float deltaTime) { getSpriteBatch().begin(); String text = getAshEngine().getCurrentCalendar().getFormattedCalendarString(); mDefaultFont.draw( getSpriteBatch(), text, Gdx.graphics.getWidth() - (text.length() * mDefaultFont.getXHeight()), 50); getSpriteBatch().end(); }
public CommonDrawer() { myTextureChecker = new TextureChecker(); w = Gdx.graphics.getWidth(); h = Gdx.graphics.getHeight(); r = w / h; mySpriteBatch = new SpriteBatch(); final FileHandle fontFile = FileManager.getInstance().getFontsDirectory().child("main.fnt"); myFont = new BitmapFont(fontFile, true); myFont.setUseIntegerPositions(false); myOrigFontHeight = myFont.getXHeight(); layout = new GlyphLayout(); }
public int getEX() { return (int) bitmapFont.getXHeight(); }