added distribution task to client buildscript

main
Jonah Bauer 3 years ago
parent f7b1f94a4f
commit 6bbdfbc4a6

@ -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

@ -1,6 +1,7 @@
dependencies {
subprojects {
dependencies {
implementation project(':wizard-common')
}
}
description = 'wizard-client'

@ -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"
}

@ -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": {

@ -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
application {
mainClass = "eu.jonahbauer.wizard.client.libgdx.desktop.DesktopLauncher"
run {
ignoreExitValue true
}
}
distributions {
main {
distributionBaseName = 'wizard-client'
}
}

@ -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);
}
}

@ -54,14 +54,13 @@ public abstract class Context<S extends State<S,C>, C extends Context<S,C>> {
* @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);

@ -15,12 +15,12 @@ public abstract class TimeoutContext<S extends TimeoutState<S,C>, 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();

@ -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> T get(@NotNull Key<T> 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();

Loading…
Cancel
Save