diff --git a/settings.gradle b/settings.gradle index 63a8dff..8c2e219 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,6 +5,7 @@ rootProject.name = 'wizard' include(':wizard-common') include(':wizard-client:wizard-client-cli') -include(':wizard-client:wizard-client-libgdx') +include(':wizard-client:wizard-client-libgdx:core') +include(':wizard-client:wizard-client-libgdx:desktop') include(':wizard-server') include(':wizard-core') diff --git a/wizard-client/wizard-client-libgdx/build.gradle b/wizard-client/wizard-client-libgdx/build.gradle index e69de29..16438d8 100644 --- a/wizard-client/wizard-client-libgdx/build.gradle +++ b/wizard-client/wizard-client-libgdx/build.gradle @@ -0,0 +1,30 @@ +subprojects { + ext { + gdxVersion = '1.10.0' + roboVMVersion = '2.3.12' + box2DLightsVersion = '1.5' + ashleyVersion = '1.7.3' + aiVersion = '1.8.2' + gdxControllersVersion = '2.1.0' + } +} + +project(":wizard-client:wizard-client-libgdx:desktop") { + apply plugin: "java-library" + + dependencies { + implementation project(":wizard-client:wizard-client-libgdx:core") + api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" + } +} + +project(":wizard-client:wizard-client-libgdx:core") { + apply plugin: "java-library" + + dependencies { + api "com.badlogicgames.gdx:gdx:$gdxVersion" + api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + } +} diff --git a/wizard-client/wizard-client-libgdx/core/build.gradle b/wizard-client/wizard-client-libgdx/core/build.gradle new file mode 100644 index 0000000..be0393d --- /dev/null +++ b/wizard-client/wizard-client-libgdx/core/build.gradle @@ -0,0 +1 @@ +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' diff --git a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/MyGdxGame.java b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/MyGdxGame.java new file mode 100644 index 0000000..4a704cd --- /dev/null +++ b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/MyGdxGame.java @@ -0,0 +1,31 @@ +package eu.jonahbauer.wizard.client.libgdx; + +import com.badlogic.gdx.ApplicationAdapter; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.utils.ScreenUtils; + +public class MyGdxGame extends ApplicationAdapter { + SpriteBatch batch; + Texture img; + + @Override + public void create () { + batch = new SpriteBatch(); + img = new Texture("badlogic.jpg"); + } + + @Override + public void render () { + ScreenUtils.clear(1, 0, 0, 1); + batch.begin(); + batch.draw(img, 0, 0); + batch.end(); + } + + @Override + public void dispose () { + batch.dispose(); + img.dispose(); + } +} diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/badlogic.jpg b/wizard-client/wizard-client-libgdx/core/src/main/resources/badlogic.jpg new file mode 100644 index 0000000..4390da6 Binary files /dev/null and b/wizard-client/wizard-client-libgdx/core/src/main/resources/badlogic.jpg differ diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/ecke_lo.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_lo.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/ecke_lo.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_lo.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/ecke_lu.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_lu.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/ecke_lu.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_lu.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/ecke_ro.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_ro.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/ecke_ro.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_ro.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/ecke_ru.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_ru.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/ecke_ru.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/ecke_ru.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/font.ttf b/wizard-client/wizard-client-libgdx/core/src/main/resources/font.ttf similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/font.ttf rename to wizard-client/wizard-client-libgdx/core/src/main/resources/font.ttf diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/hintergrund.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/hintergrund.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/hintergrund.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/hintergrund.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/schriftzug.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/schriftzug.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/schriftzug.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/schriftzug.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/symbol1.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/symbol1.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/symbol1.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/symbol1.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/symbol2.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/symbol2.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/symbol2.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/symbol2.png diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/symbol3.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/symbol3.png similarity index 100% rename from wizard-client/wizard-client-libgdx/src/main/resources/symbol3.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/symbol3.png diff --git a/wizard-client/wizard-client-libgdx/desktop/build.gradle b/wizard-client/wizard-client-libgdx/desktop/build.gradle new file mode 100644 index 0000000..07e067b --- /dev/null +++ b/wizard-client/wizard-client-libgdx/desktop/build.gradle @@ -0,0 +1,14 @@ +//file:noinspection GroovyAssignabilityCheck +//file:noinspection GroovyAccessibility +ext { + javaMainClass = "eu.jonahbauer.wizard.client.libgdx.desktop.DesktopLauncher" + assetsDir = new File("../core/src/main/resources") +} + +task run(type: JavaExec, dependsOn: classes) { + mainClass = javaMainClass + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue true +} \ No newline at end of file diff --git a/wizard-client/wizard-client-libgdx/desktop/src/main/java/eu/jonahbauer/wizard/client/libgdx/desktop/DesktopLauncher.java b/wizard-client/wizard-client-libgdx/desktop/src/main/java/eu/jonahbauer/wizard/client/libgdx/desktop/DesktopLauncher.java new file mode 100644 index 0000000..213bd70 --- /dev/null +++ b/wizard-client/wizard-client-libgdx/desktop/src/main/java/eu/jonahbauer/wizard/client/libgdx/desktop/DesktopLauncher.java @@ -0,0 +1,12 @@ +package eu.jonahbauer.wizard.client.libgdx.desktop; + +import com.badlogic.gdx.backends.lwjgl.LwjglApplication; +import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; +import eu.jonahbauer.wizard.client.libgdx.MyGdxGame; + +public class DesktopLauncher { + public static void main (String[] arg) { + LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); + new LwjglApplication(new MyGdxGame(), config); + } +} diff --git a/wizard-client/wizard-client-libgdx/src/main/java/eu/jonahbauer/wizard/client/libgdx/.gitkeep b/wizard-client/wizard-client-libgdx/src/main/java/eu/jonahbauer/wizard/client/libgdx/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/wizard-client/wizard-client-libgdx/src/main/resources/.gitkeep b/wizard-client/wizard-client-libgdx/src/main/resources/.gitkeep deleted file mode 100644 index e69de29..0000000