Added hello world libGDX example.

This commit is contained in:
Willem Cazander 2022-01-28 09:59:15 +01:00
parent bd923f1a76
commit 37fa029e9e
2 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,31 @@
package love.distributedrebirth.demo4d;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
public class MainScreen extends ApplicationAdapter {
SpriteBatch batch;
BitmapFont font;
@Override
public void create () {
batch = new SpriteBatch();
font = new BitmapFont();
}
@Override
public void render () {
ScreenUtils.clear(1, 0, 0, 1);
batch.begin();
font.draw(batch, "Hello World.", 33, 33);
batch.end();
}
@Override
public void dispose () {
batch.dispose();
font.dispose();
}
}

View file

@ -0,0 +1,12 @@
package love.distributedrebirth.demo4d.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import love.distributedrebirth.demo4d.MainScreen;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new MainScreen(), config);
}
}