diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 764da57..a5e77d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,6 +28,12 @@ build: paths: - build - .gradle + artifacts: + paths: + - "**/build/distributions/*.tar" + - "**/build/distributions/*.zip" + - "**/build/libs/*.jar" + expire_in: 7 days test: stage: test diff --git a/wizard-client/build.gradle b/wizard-client/build.gradle index 51f0e64..4334b09 100644 --- a/wizard-client/build.gradle +++ b/wizard-client/build.gradle @@ -1,6 +1,7 @@ - -dependencies { - implementation project(':wizard-common') +subprojects { + dependencies { + implementation project(':wizard-common') + } } description = 'wizard-client' diff --git a/wizard-client/wizard-client-libgdx/build.gradle b/wizard-client/wizard-client-libgdx/build.gradle index 16438d8..4916872 100644 --- a/wizard-client/wizard-client-libgdx/build.gradle +++ b/wizard-client/wizard-client-libgdx/build.gradle @@ -14,7 +14,7 @@ project(":wizard-client:wizard-client-libgdx:desktop") { dependencies { implementation project(":wizard-client:wizard-client-libgdx:core") - api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" } diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/font/coolvetica.fnt b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/coolvetica.fnt similarity index 100% rename from wizard-client/wizard-client-libgdx/core/src/main/resources/font/coolvetica.fnt rename to wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/coolvetica.fnt diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/font/coolvetica.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/coolvetica.png similarity index 100% rename from wizard-client/wizard-client-libgdx/core/src/main/resources/font/coolvetica.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/coolvetica.png diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/font/coolvetica.ttf b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/coolvetica.ttf similarity index 100% rename from wizard-client/wizard-client-libgdx/core/src/main/resources/font/coolvetica.ttf rename to wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/coolvetica.ttf diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/font/enchanted.fnt b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/enchanted.fnt similarity index 100% rename from wizard-client/wizard-client-libgdx/core/src/main/resources/font/enchanted.fnt rename to wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/enchanted.fnt diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/font/enchanted.png b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/enchanted.png similarity index 100% rename from wizard-client/wizard-client-libgdx/core/src/main/resources/font/enchanted.png rename to wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/enchanted.png diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/font/enchanted.ttf b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/enchanted.ttf similarity index 100% rename from wizard-client/wizard-client-libgdx/core/src/main/resources/font/enchanted.ttf rename to wizard-client/wizard-client-libgdx/core/src/main/resources/skin/font/enchanted.ttf diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/uiskin.json b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/uiskin.json index e0d76a3..ccd5b26 100644 --- a/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/uiskin.json +++ b/wizard-client/wizard-client-libgdx/core/src/main/resources/skin/uiskin.json @@ -1,10 +1,10 @@ { "com.badlogic.gdx.graphics.g2d.BitmapFont": { "default-font": { - "file": "../font/coolvetica.fnt" + "file": "font/coolvetica.fnt" }, "enchanted": { - "file": "../font/enchanted.fnt" + "file": "font/enchanted.fnt" } }, "com.badlogic.gdx.graphics.Color": { diff --git a/wizard-client/wizard-client-libgdx/desktop/build.gradle b/wizard-client/wizard-client-libgdx/desktop/build.gradle index 07e067b..2e8f573 100644 --- a/wizard-client/wizard-client-libgdx/desktop/build.gradle +++ b/wizard-client/wizard-client-libgdx/desktop/build.gradle @@ -1,14 +1,17 @@ -//file:noinspection GroovyAssignabilityCheck -//file:noinspection GroovyAccessibility -ext { - javaMainClass = "eu.jonahbauer.wizard.client.libgdx.desktop.DesktopLauncher" - assetsDir = new File("../core/src/main/resources") +plugins { + id 'application' } -task run(type: JavaExec, dependsOn: classes) { - mainClass = javaMainClass - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue true +application { + mainClass = "eu.jonahbauer.wizard.client.libgdx.desktop.DesktopLauncher" + + run { + ignoreExitValue true + } +} + +distributions { + main { + distributionBaseName = 'wizard-client' + } } \ 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 index e4582de..3957da3 100644 --- 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 @@ -1,14 +1,14 @@ package eu.jonahbauer.wizard.client.libgdx.desktop; -import com.badlogic.gdx.backends.lwjgl.LwjglApplication; -import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; +import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; +import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import eu.jonahbauer.wizard.client.libgdx.WizardGame; public class DesktopLauncher { public static void main (String[] arg) { - LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); - config.title = "Wizard Jubilaeumsedition 2021"; - config.foregroundFPS = 60; - new LwjglApplication(new WizardGame(), config); + Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); + config.setTitle("Wizard Jubilaeumsedition 2021"); + config.setForegroundFPS(60); + new Lwjgl3Application(new WizardGame(), config); } } diff --git a/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/Context.java b/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/Context.java index b91dec4..2f22345 100644 --- a/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/Context.java +++ b/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/Context.java @@ -54,14 +54,13 @@ public abstract class Context, C extends Context> { * @see State#onEnter(Context) * @see #handleError(Throwable) */ + @SuppressWarnings("unchecked") public void transition(@NotNull S state) { lock.lock(); try { - //noinspection unchecked this.state.onExit((C) this); onTransition(this.state, state); this.state = state; - //noinspection unchecked state.onEnter((C) this).ifPresent(this::transition); } catch (Throwable t) { handleError(t); diff --git a/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/TimeoutContext.java b/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/TimeoutContext.java index 4d1cc31..c1706ac 100644 --- a/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/TimeoutContext.java +++ b/wizard-common/src/main/java/eu/jonahbauer/wizard/common/machine/TimeoutContext.java @@ -15,12 +15,12 @@ public abstract class TimeoutContext, C extends Time super(initialState); } + @SuppressWarnings("unchecked") public void timeout(@NotNull S currentState, long delay) { scheduler.schedule(() -> { if (Objects.equals(getState(), currentState)) { execute(() -> { if (Objects.equals(getState(), currentState)) { - //noinspection unchecked return currentState.onTimeout((C) this); } else { return Optional.empty(); diff --git a/wizard-core/src/main/java/eu/jonahbauer/wizard/core/machine/states/GameData.java b/wizard-core/src/main/java/eu/jonahbauer/wizard/core/machine/states/GameData.java index 44b9e18..0a4e2cd 100644 --- a/wizard-core/src/main/java/eu/jonahbauer/wizard/core/machine/states/GameData.java +++ b/wizard-core/src/main/java/eu/jonahbauer/wizard/core/machine/states/GameData.java @@ -14,6 +14,7 @@ import org.jetbrains.annotations.Unmodifiable; import java.util.*; import java.util.function.Supplier; +@SuppressWarnings("unchecked") @Unmodifiable @EqualsAndHashCode(of = {"values", "present"}) public final class GameData { @@ -59,12 +60,10 @@ public final class GameData { public T get(@NotNull Key key) { int index = key.index(); if (present[index]) { - //noinspection unchecked return (T) values[index]; } else if (key.defaultValue() != null) { present[index] = true; values[index] = key.defaultValue().get(); - //noinspection unchecked return (T) values[index]; } else { throw new NoSuchElementException();