當前位置: 首頁>>代碼示例>>Java>>正文


Java BitmapFont.draw方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.BitmapFont.draw方法的典型用法代碼示例。如果您正苦於以下問題:Java BitmapFont.draw方法的具體用法?Java BitmapFont.draw怎麽用?Java BitmapFont.draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.g2d.BitmapFont的用法示例。


在下文中一共展示了BitmapFont.draw方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderGuiFpsCounter

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
private void renderGuiFpsCounter(SpriteBatch batch) {
    float x = cameraGUI.viewportWidth - 55;
    float y = cameraGUI.viewportHeight - 15;
    int fps = Gdx.graphics.getFramesPerSecond();
    BitmapFont fpsFont = Assets.instance.fonts.defaultNormal;
    if (fps >= 45) {
        // 45 or more FPS show up in green
        fpsFont.setColor(0, 1, 0, 1);
    } else if (fps >= 30) {
        // 30 or more FPS show up in yellow
        fpsFont.setColor(1, 1, 0, 1);
    } else {
        // less than 30 FPS show up in red
        fpsFont.setColor(1, 0, 0, 1);
    }
    fpsFont.draw(batch, "FPS: " + fps, x, y);
    fpsFont.setColor(1, 1, 1, 1);
}
 
開發者ID:davyjoneswang,項目名稱:libgdx-learnlib,代碼行數:19,代碼來源:WorldRenderer.java

示例2: drawSprite

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
@Override
protected void drawSprite(SpriteBatch batch, float x, float y) {
	BitmapFont font = GameCore.getFont();
	font.setColor(shadow);
	font.draw(batch, text, x-1, y+1, 0, Align.center, false);
	font.setColor(main);
	font.draw(batch, text, x, y, 0, Align.center, false);
}
 
開發者ID:chrisj42,項目名稱:miniventure,代碼行數:9,代碼來源:TextParticle.java

示例3: writeOutlinedText

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
public static void writeOutlinedText(BitmapFont font, SpriteBatch batch, String text, float x, float y, Color center, Color outline) {
	font.setColor(outline);
	font.draw(batch, text, x-1, y-1);
	font.draw(batch, text, x-1, y+1);
	font.draw(batch, text, x+1, y-1);
	font.draw(batch, text, x+1, y+1);
	font.setColor(center);
	font.draw(batch, text, x, y);
}
 
開發者ID:chrisj42,項目名稱:miniventure,代碼行數:10,代碼來源:MyUtils.java

示例4: drawText

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
@Override
public void drawText(BitmapFont font,CharSequence text,float X, float Y)
{
	font.setUseIntegerPositions(true);
	font.draw(getSpriteBatch(), text, X,Y);
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:7,代碼來源:Game3DService.java

示例5: drawText

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
@Override
   public void drawText(BitmapFont font, CharSequence text, float X, float Y) {
font.draw(batch, text, X, Y);
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:5,代碼來源:GameService.java

示例6: drawTextCentered

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
public static void drawTextCentered(BitmapFont font, SpriteBatch batch, String text, float width, float height) {
	font.draw(batch, text, width/2, height/2, 0, Align.center, true);
}
 
開發者ID:chrisj42,項目名稱:miniventure,代碼行數:4,代碼來源:MyUtils.java

示例7: debugRender

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
public void debugRender(ShapeRenderer shapeRenderer, SpriteBatch spriteBatch, BitmapFont font, Camera camera) {
        // box
        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.setColor(Color.BLACK);
        for (float x = 0; x < mapWidth; x++) {
            for (float y = 0; y < mapHeight; y++) {
                shapeRenderer.box(x, y, 0, 1f, 1f, 0f);
            }
        }
        shapeRenderer.end();
        // fps
        spriteBatch.begin();
        font.setColor(Color.RED);
        font.draw(spriteBatch, Gdx.graphics.getFramesPerSecond() + "", 0, 15);
        font.setColor(Color.WHITE);
        // costs + cords
        for (int x = 0; x < mapWidth; x++) {
            for (int y = 0; y < mapHeight; y++) {
                Vector2 point = new Vector2(x, y + 1);
                CoordinateUtil.worldToTouch(point, camera);
                font.draw(spriteBatch, cost[x][y] + "", point.x, point.y);

//                point = new Vector2(x, y);
//                CoordinateUtil.worldToTouch(point, camera);
//                font.draw(spriteBatch, x + "", point.x, point.y);
//
//                point = new Vector2(x + 1, y);
//                CoordinateUtil.worldToTouch(point, camera);
//                font.draw(spriteBatch, y + "", point.x, point.y);
            }
        }
        spriteBatch.end();
        // vector
        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.setColor(Color.RED);
        for (int x = 0; x < mapWidth; x++) {
            for (int y = 0; y < mapHeight; y++) {
                Vector2 dir = direction[x][y];
                dir = dir.cpy().scl(0.5f);
                shapeRenderer.circle(x + 0.5f, y + 0.5f, 0.1f, 20);
                shapeRenderer.line(x + 0.5f, y + 0.5f, x + dir.x + 0.5f, y + dir.y + 0.5f);
            }
        }
        shapeRenderer.end();
    }
 
開發者ID:MiniDigger,項目名稱:projecttd,代碼行數:46,代碼來源:PathFindingSystem.java

示例8: DrawText

import com.badlogic.gdx.graphics.g2d.BitmapFont; //導入方法依賴的package包/類
public void DrawText(SpriteBatch batch, String text, float x, float y)
{
	BitmapFont font = skin.getFont("default-font");
	font.draw(batch, text, x, y);
}
 
開發者ID:bp2008,項目名稱:blueirisviewer,代碼行數:6,代碼來源:UI.java


注:本文中的com.badlogic.gdx.graphics.g2d.BitmapFont.draw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。