Sample LibGDX project setup
@ -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"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 3.1 MiB |
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 264 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@ -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
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|