@Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); font.drawMultiLine(batch, message, 20, Gdx.graphics.getHeight() - 20); batch.end(); }
@Override public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); font.drawMultiLine(batch, results, 20, 300); batch.end(); }
private void renderGuiGameOverMessage(SpriteBatch batch) { float x = cameraGUI.viewportWidth / 2; float y = cameraGUI.viewportHeight / 2; if (worldController.isGameOver()) { BitmapFont fontGameOver = Assets.instance.fonts.defaultBig; fontGameOver.setColor(1, 0.75f, 0.25f, 1); fontGameOver.drawMultiLine(batch, "GAME OVER", x, y, 0, BitmapFont.HAlignment.CENTER); fontGameOver.setColor(1, 1, 1, 1); } }
public int drawMultiLineText( AnimationState as, int x, int y, CharSequence str, int width, de.matthiasmann.twl.HAlignment align) { FontState fontState = evalFontState(as); x += fontState.offsetX; y += fontState.offsetY + yOffset; bitmapFont.setColor(renderer.getColor(fontState.color)); return bitmapFont.drawMultiLine(renderer.batch, str, x, y, width, gdxAlignment[align.ordinal()]) .width; }
/** * Draws a String at the given coordinates. The String may contain newlines (\n or \r).<br> * If <code>font == null</code> the Render's instance of <code>BitmapFont</code> is used. * * @param batch * @param font * @param string * @param x * @param y * @param centered */ public static void drawMultiLineString( SpriteBatch batch, BitmapFont font, String string, float x, float y, boolean centered) { if (font == null) font = font_; if (centered) { TextBounds bounds = font.getMultiLineBounds(string); float width = bounds.width; float height = bounds.height - font.getAscent(); x -= (width / 2); y -= (height / 2); } font.drawMultiLine(batch, string, x, y); }
@Override public void draw(float delta) { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0, 0, 480, 320); spriteBatch.setProjectionMatrix(viewMatrix); spriteBatch.setTransformMatrix(transformMatrix); spriteBatch.begin(); spriteBatch.disableBlending(); spriteBatch.setColor(Color.WHITE); spriteBatch.draw(background, 0, 0, 480, 320, 0, 0, 512, 512, false, false); spriteBatch.enableBlending(); spriteBatch.draw(logo, 0, 320 - 128, 480, 128, 0, 256, 512, 256, false, false); String text = "It is the end my friend.\nTouch to continue!"; TextBounds bounds = font.getMultiLineBounds(text); spriteBatch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); font.drawMultiLine(spriteBatch, text, 0, 160 + bounds.height / 2, 480, HAlignment.CENTER); spriteBatch.end(); }