[source code] Android Development Tutorial - 71 & 72

0 Bucky Roberts · February 25, 2015
package com.thenewboston.buckyblaster;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class MyGdxGame extends ApplicationAdapter {

    private SpriteBatch batch;
    private BitmapFont font;

@Override
public void create () {
        batch = new SpriteBatch();
        font = new BitmapFont();
        font.setColor(Color.BLUE);
        font.scale(5);
}

    @Override
    public void dispose() {
        batch.dispose();
        font.dispose();
    }

    @Override
public void render () {
        Gdx.gl.glClearColor(1,1,1,1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        batch.begin();
        font.draw(batch, "Hello baby dont say maybe!", 100, 400);
        batch.end();
}

}

Post a Reply

Replies

Oldest  Newest  Rating
+1 Carlos Leonora · April 30, 2015
Hi bucky,

seems i have 2 small problems.

The scale appears every time in red and can't find how to change that and my emulator is not running.

Do i have to install more for this?

Greetz Carlos
0 haresh parmar · May 6, 2015
Hi bucky,
please answer this question regarding the tutorials created by you..

https://www.thenewboston.com/forum/topic.php?id=6614
0 Kostas Tsiapalis · August 17, 2015
The only thing you need to do is to write this line of code and its all ok!

font.getData().scale(5);
0 Awab Muhammad · June 26, 2015
Hi Bucky!!!

When I typed this code I got a  problem

The scale() appeared  red
  • 1

Java / Android Development

107,150 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator