-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloWorld.java
More file actions
35 lines (30 loc) · 912 Bytes
/
Copy pathHelloWorld.java
File metadata and controls
35 lines (30 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class HelloWorld extends ApplicationAdapter {
SpriteBatch batch;
BitmapFont font;
@Override
public void create() {
batch = new SpriteBatch();
font = new BitmapFont();
font.getData().setScale(2.0f);
}
@Override
public void render() {
Gdx.gl.glClearColor(0.2f, 0.3f, 0.3f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
font.draw(batch, "Hello, World!",
Gdx.graphics.getWidth() / 2f - 100,
Gdx.graphics.getHeight() / 2f);
batch.end();
}
@Override
public void dispose() {
batch.dispose();
font.dispose();
}
}