当前位置: 首页>>代码示例>>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;未经允许,请勿转载。