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


Java BitmapFont.setColor方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.BitmapFont.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapFont.setColor方法的具体用法?Java BitmapFont.setColor怎么用?Java BitmapFont.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.g2d.BitmapFont的用法示例。


在下文中一共展示了BitmapFont.setColor方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: PlayState

import com.badlogic.gdx.graphics.g2d.BitmapFont; //导入方法依赖的package包/类
public PlayState(GameStateManager gsm) {
    super(gsm);
    font = new BitmapFont();
    font.setColor(1.0f, 1.0f, 1.0f, 1.0f);
    bird = new Bird(50, 300);
    camera.setToOrtho(false, FlappyBaran.WIDTH / 2, FlappyBaran.HEIGHT / 2);
    bg = new Texture("backgrnd.jpg");
    ground = new Texture("ground.png");
    groundPos1 = new Vector2(camera.position.x - camera.viewportWidth / 2, GROUND_Y_OFFSET);
    groundPos2 = new Vector2((camera.position.x - camera.viewportWidth / 2) + ground.getWidth(), GROUND_Y_OFFSET);

    tubes = new Array<com.kirdmiv.flappybaranus.sprites.Tube>();

    for (int i = 0; i < TUBE_COUNT; i++){
        tubes.add(new com.kirdmiv.flappybaranus.sprites.Tube(i * (TUBE_SPACING + com.kirdmiv.flappybaranus.sprites.Tube.TUBE_WIDTH)));
    }
}
 
开发者ID:kirdmiv,项目名称:Flappy-Baranus,代码行数:18,代码来源:PlayState.java

示例3: create

import com.badlogic.gdx.graphics.g2d.BitmapFont; //导入方法依赖的package包/类
@Override
public void create() {
    batch = new SpriteBatch();

    font = new BitmapFont();
    font.setColor(0, 0, 1, 1);

    // Origin
    TextureAtlas originTextureAtlas = new TextureAtlas(ORIGIN_PATH + "/test.atlas");
    Skin originSkin = new Skin(originTextureAtlas);
    originTextureRegion = originSkin.getRegion("badlogic");

    // Encrypt
    SimpleXorCryptoEncryptor.process("123", "atlas", "encryptedAtlas");

    // Decrypt
    CryptTextureAtlas cryptTextureAtlas = new CryptTextureAtlas(crypto, ENCRYPTED_PATH + "/test.atlas");
    Skin skin = new Skin(cryptTextureAtlas);
    decryptTextureRegion = skin.getRegion("badlogic");
}
 
开发者ID:akivamu,项目名称:libgdx-crypt-texture,代码行数:21,代码来源:TestCryptTextureAtlas.java

示例4: 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

示例5: 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

示例6: init

import com.badlogic.gdx.graphics.g2d.BitmapFont; //导入方法依赖的package包/类
@Override
public void init() {

	// Menu Choices
	menuChoices = new String[2];
	menuChoices[0] = "Play";
	menuChoices[1] = "Exit";

	// Start Font
	// Title
	bitmapFont = new BitmapFont();
	bitmapFont.setColor(Color.WHITE);

	// Start Option
	currentOption = 0;

	// Background
	menuBackgroundPath = "data/background/menuBackground.png";
	menuBackground = new Background(Game.WIDTH, 0, -0.75f, 0, 1920, 1080, true, menuBackgroundPath);
	menuBackground2 = new Background(0, 0, -0.75f, 0, 1920, 1080, true, menuBackgroundPath);

	// Start Music
	musicManager = game.getMusicManager();
	if (loadMusic) {
		musicManager.addMusic(MenuMusicPathName, menuMusicName);
		loadMusic = false;
	}
	musicManager.loopMusic(menuMusicName);

	// Start Sound
	soundManager = gsm.getGame().getSoundManager();
	soundManager.addSound(choiceSoundNamePathName, choiceOptionName);
}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:34,代码来源:MenuState.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: create

import com.badlogic.gdx.graphics.g2d.BitmapFont; //导入方法依赖的package包/类
@Override
public void create() {
    batch = new SpriteBatch();

    font = new BitmapFont();
    font.setColor(0, 0, 1, 1);

    originTexture = new Texture(originFilePath);

    originTextureByDecryptor = TextureDecryptor.loadTexture(null, originFilePath);

    TextureEncryptor.encryptToFile(crypto, originFilePath, encryptedFilePath);

    decryptedTexture = TextureDecryptor.loadTexture(crypto, encryptedFilePath);

    System.out.println("isEqual: " + isEqual(originTexture, decryptedTexture));
}
 
开发者ID:akivamu,项目名称:libgdx-crypt-texture,代码行数:18,代码来源:SimpleGame.java

示例9: getFont

import com.badlogic.gdx.graphics.g2d.BitmapFont; //导入方法依赖的package包/类
public static BitmapFont getFont(String id, String fileFNT, String filePNG, Color color, float scale) {
    BitmapFont font = new BitmapFont(Gdx.files.internal(fileFNT), Gdx.files.internal(filePNG),false);
    font.setColor(color);
    font.getData().setScale(scale);
    return font;
}
 
开发者ID:dsaves,项目名称:Ponytron,代码行数:7,代码来源:AssetDoctor.java


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