From 37fa029e9ed355d1266f4d63e24df375365e99a1 Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Fri, 28 Jan 2022 09:59:15 +0100 Subject: [PATCH] Added hello world libGDX example. --- .../distributedrebirth/demo4d/MainScreen.java | 31 +++++++++++++++++++ .../demo4d/desktop/DesktopLauncher.java | 12 +++++++ 2 files changed, 43 insertions(+) create mode 100644 core/src/love/distributedrebirth/demo4d/MainScreen.java create mode 100644 desktop/src/love/distributedrebirth/demo4d/desktop/DesktopLauncher.java diff --git a/core/src/love/distributedrebirth/demo4d/MainScreen.java b/core/src/love/distributedrebirth/demo4d/MainScreen.java new file mode 100644 index 00000000..dcccbbf5 --- /dev/null +++ b/core/src/love/distributedrebirth/demo4d/MainScreen.java @@ -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(); + } +} diff --git a/desktop/src/love/distributedrebirth/demo4d/desktop/DesktopLauncher.java b/desktop/src/love/distributedrebirth/demo4d/desktop/DesktopLauncher.java new file mode 100644 index 00000000..8ed403c7 --- /dev/null +++ b/desktop/src/love/distributedrebirth/demo4d/desktop/DesktopLauncher.java @@ -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); + } +}