List of usage examples for com.badlogic.gdx.graphics.g2d BitmapFont setColor
public void setColor(Color color)
From source file:at.juggle.games.counting.CountingGameModel.java
License:Apache License
public void drawGameState(SpriteBatch batch, float delta, BitmapFont buttonFont) { animationTime += delta * 10;//from w ww .ja v a 2 s.c om balloonList = getBalloonList(); for (int i = 0; i < balloonList.size(); i++) { for (int j = 0; j < balloonList.size(); j++) { if (i != j) { // check for collision float distX = (balloonList.get(i).getX() - balloonList.get(j).getX()); float distY = (balloonList.get(i).getY() - balloonList.get(j).getY()); if (Math.abs(distX) < balloonList.get(i).getWidth() && Math.abs(distY) < balloonList.get(i).getHeight()) { // it's a collision balloonList.get(i).setPosition(balloonList.get(i).getX() + distX * 0.05f, balloonList.get(i).getY() + distY * 0.05f); } } } balloonList.get(i).draw(batch, delta); // batch.draw(spriteAnimRed[((int) (animationTime % spriteAnimRed.length))], sprite.getX(), sprite.getY()); } for (int i = 0; i < answers.length; i++) { String answer = Integer.toString(answers[i]); layout.setText(buttonFont, answer); if (answerIsGiven && answers[i] == numberOfSprites) buttonFont.setColor(Color.GREEN); else buttonFont.setColor(Color.BLACK); float posX = CountingGame.GAME_WIDTH / 4 * (i + 1) - layout.width / 2; buttonFont.draw(batch, answer, posX, posButtonsY); } }
From source file:CB_Locator.Map.MapViewBase.java
License:Open Source License
protected void renderDebugInfo(Batch batch) { CB_RectF r = this.thisWorldRec; Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST); BitmapFont font = Fonts.getNormal(); font.setColor(Color.BLACK); Matrix4 def = new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); def.translate(r.getX(), r.getY(), 1); batch.setProjectionMatrix(def);/*from w ww. j a v a 2s. co m*/ // str = debugString; font.draw(batch, str, 20, 120); str = "fps: " + Gdx.graphics.getFramesPerSecond(); font.draw(batch, str, 20, 100); str = String.valueOf(aktZoom) + " - camzoom: " + Math.round(camera.zoom * 100) / 100; font.draw(batch, str, 20, 80); str = "lTiles: " + mapTileLoader.LoadedTilesSize() + " - qTiles: " + mapTileLoader.QueuedTilesSize(); font.draw(batch, str, 20, 60); str = "lastMove: " + lastMovement.x + " - " + lastMovement.y; font.draw(batch, str, 20, 20); Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST); }
From source file:com.evoluzion.Organismo.java
License:Open Source License
public void verMarcado(ShapeRenderer sr, SpriteBatch sb, BitmapFont f) { if (marcado == -1) { sr.begin(ShapeType.Rectangle); sr.setColor(Color.GREEN); sr.rect(borde.x - 2, borde.y - 2, borde.width + 4, borde.height + 4); sr.end();// w ww. j a v a 2s . c om sb.begin(); f.setColor(Color.GREEN); f.draw(sb, nombre, posicion.x + ancho + 5, posicion.y + (alto) + 5); f.draw(sb, "" + format.format(energia), posicion.x + ancho + 5, posicion.y); sb.end(); } }
From source file:com.kotcrab.vis.ui.widget.HighlightTextArea.java
License:Apache License
@Override protected void drawText(Batch batch, BitmapFont font, float x, float y) { maxAreaHeight = 0;// w w w . ja v a 2s . c o m float offsetY = 0; for (int i = firstLineShowing * 2; i < (firstLineShowing + linesShowing) * 2 && i < linesBreak.size; i += 2) { for (Chunk chunk : renderChunks) { if (chunk.lineIndex == i) { font.setColor(chunk.color); font.draw(batch, chunk.text, x + chunk.offsetX, y + offsetY); } } offsetY -= font.getLineHeight(); maxAreaHeight += font.getLineHeight(); } maxAreaHeight += 30; }
From source file:com.lyeeedar.Roguelike3D.Game.Level.LevelGraphics.java
License:Open Source License
public void createMap(Tile[][] levelArray) { BitmapFont font = new BitmapFont(); SpriteBatch sB = new SpriteBatch(); FrameBuffer fB = new FrameBuffer(Format.RGBA4444, width * STEP, height * STEP, false); fB.begin();// w ww. jav a2s .co m sB.begin(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { char c = levelArray[x][y].character; if (c == ' ') continue; font.setColor(colours.get(c)); font.draw(sB, "" + c, x * STEP, y * STEP); } } sB.end(); fB.end(); map = fB.getColorBufferTexture(); }
From source file:com.lyeeedar.Roguelike3D.Graphics.TextureDrawer.java
License:Open Source License
public static Texture drawText(BitmapFont font, int xSpacing, int ySpacing, String... text) { int height = ySpacing * (text.length + 2); int width = 0; int temp;/* w w w . ja va 2 s . c o m*/ for (int i = 0; i < text.length; i++) { temp = xSpacing * (text[i].length() + 2); if (temp > width) width = temp; } FrameBuffer fB = new FrameBuffer(format, width, height, false); fB.begin(); Gdx.graphics.getGL20().glClearColor(1.0f, 1.0f, 1.0f, 1.0f); Gdx.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT); font.setColor(Color.BLACK); sB.begin(); for (int line = 0; line < text.length; line++) { for (int c = 0; c < text[line].length(); c++) { font.draw(sB, "" + text[line].charAt(c), c * xSpacing, (line - 1) * ySpacing); } } sB.end(); fB.end(); return fB.getColorBufferTexture(); }
From source file:com.sixth.fodder.graphics.TextActor.java
public TextActor(BitmapFont font, String text) { this.text = text; this.font = font; font.setColor(Color.RED); }
From source file:core.september.morra.scoreboard.ScoreLevel.java
License:Apache License
public void renderColorized(SpriteBatch batch) { BitmapFont font = Assets.instance.font.defaultNormal; BitmapFont big = Assets.instance.font.defaultBig; boolean winner = win > loose; font.setColor(winner ? Color.YELLOW : Color.RED); font.draw(batch, String.format("YOU %s %s matches of %s!!!", winner ? "WIN" : "LOOSE", winner ? win : loose, matches), Constants.VIEWPORT_WIDTH / 16, Constants.VIEWPORT_HEIGHT / 2); }
From source file:core.september.morra.win.WinLevel.java
License:Apache License
public void renderColorizedInfos(SpriteBatch batch) { BitmapFont font = Assets.instance.font.defaultBig; if (cpu + player == playerBound) { font.setColor(Color.YELLOW); font.draw(batch, String.valueOf(playerBound), Constants.VIEWPORT_WIDTH / 8, Constants.VIEWPORT_HEIGHT * 0.65f); }// w w w .j a v a 2 s.c o m else { font.setColor(Color.RED); font.draw(batch, String.valueOf(cpuBound), (Constants.VIEWPORT_WIDTH / 8) * 7, Constants.VIEWPORT_HEIGHT * 0.65f); } }
From source file:core.september.pushathon.workers.BatchRenderer.java
License:Apache License
protected void renderText(SpriteBatch batch) { BitmapFont font = Assets.instance.fonts.defaultNormal; font.setColor(Color.ORANGE); font.draw(batch, "This is a test!!!!", 1, 2); }