本文整理汇总了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);
}
示例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)));
}
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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));
}
示例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;
}