added distribution task to client buildscript
This commit is contained in:
parent
f7b1f94a4f
commit
6bbdfbc4a6
@ -28,6 +28,12 @@ build:
|
|||||||
paths:
|
paths:
|
||||||
- build
|
- build
|
||||||
- .gradle
|
- .gradle
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- "**/build/distributions/*.tar"
|
||||||
|
- "**/build/distributions/*.zip"
|
||||||
|
- "**/build/libs/*.jar"
|
||||||
|
expire_in: 7 days
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
subprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':wizard-common')
|
implementation project(':wizard-common')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
description = 'wizard-client'
|
description = 'wizard-client'
|
||||||
|
@ -14,7 +14,7 @@ project(":wizard-client:wizard-client-libgdx:desktop") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":wizard-client:wizard-client-libgdx:core")
|
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-platform:$gdxVersion:natives-desktop"
|
||||||
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
|
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 265 KiB After Width: | Height: | Size: 265 KiB |
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
|
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
|
||||||
"default-font": {
|
"default-font": {
|
||||||
"file": "../font/coolvetica.fnt"
|
"file": "font/coolvetica.fnt"
|
||||||
},
|
},
|
||||||
"enchanted": {
|
"enchanted": {
|
||||||
"file": "../font/enchanted.fnt"
|
"file": "font/enchanted.fnt"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"com.badlogic.gdx.graphics.Color": {
|
"com.badlogic.gdx.graphics.Color": {
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
//file:noinspection GroovyAssignabilityCheck
|
plugins {
|
||||||
//file:noinspection GroovyAccessibility
|
id 'application'
|
||||||
ext {
|
|
||||||
javaMainClass = "eu.jonahbauer.wizard.client.libgdx.desktop.DesktopLauncher"
|
|
||||||
assetsDir = new File("../core/src/main/resources")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task run(type: JavaExec, dependsOn: classes) {
|
application {
|
||||||
mainClass = javaMainClass
|
mainClass = "eu.jonahbauer.wizard.client.libgdx.desktop.DesktopLauncher"
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
|
||||||
standardInput = System.in
|
run {
|
||||||
workingDir = project.assetsDir
|
|
||||||
ignoreExitValue true
|
ignoreExitValue true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
distributions {
|
||||||
|
main {
|
||||||
|
distributionBaseName = 'wizard-client'
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,14 @@
|
|||||||
package eu.jonahbauer.wizard.client.libgdx.desktop;
|
package eu.jonahbauer.wizard.client.libgdx.desktop;
|
||||||
|
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
||||||
|
|
||||||
public class DesktopLauncher {
|
public class DesktopLauncher {
|
||||||
public static void main (String[] arg) {
|
public static void main (String[] arg) {
|
||||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||||
config.title = "Wizard Jubilaeumsedition 2021";
|
config.setTitle("Wizard Jubilaeumsedition 2021");
|
||||||
config.foregroundFPS = 60;
|
config.setForegroundFPS(60);
|
||||||
new LwjglApplication(new WizardGame(), config);
|
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 State#onEnter(Context)
|
||||||
* @see #handleError(Throwable)
|
* @see #handleError(Throwable)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void transition(@NotNull S state) {
|
public void transition(@NotNull S state) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
//noinspection unchecked
|
|
||||||
this.state.onExit((C) this);
|
this.state.onExit((C) this);
|
||||||
onTransition(this.state, state);
|
onTransition(this.state, state);
|
||||||
this.state = state;
|
this.state = state;
|
||||||
//noinspection unchecked
|
|
||||||
state.onEnter((C) this).ifPresent(this::transition);
|
state.onEnter((C) this).ifPresent(this::transition);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
handleError(t);
|
handleError(t);
|
||||||
|
@ -15,12 +15,12 @@ public abstract class TimeoutContext<S extends TimeoutState<S,C>, C extends Time
|
|||||||
super(initialState);
|
super(initialState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void timeout(@NotNull S currentState, long delay) {
|
public void timeout(@NotNull S currentState, long delay) {
|
||||||
scheduler.schedule(() -> {
|
scheduler.schedule(() -> {
|
||||||
if (Objects.equals(getState(), currentState)) {
|
if (Objects.equals(getState(), currentState)) {
|
||||||
execute(() -> {
|
execute(() -> {
|
||||||
if (Objects.equals(getState(), currentState)) {
|
if (Objects.equals(getState(), currentState)) {
|
||||||
//noinspection unchecked
|
|
||||||
return currentState.onTimeout((C) this);
|
return currentState.onTimeout((C) this);
|
||||||
} else {
|
} else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@ -14,6 +14,7 @@ import org.jetbrains.annotations.Unmodifiable;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Unmodifiable
|
@Unmodifiable
|
||||||
@EqualsAndHashCode(of = {"values", "present"})
|
@EqualsAndHashCode(of = {"values", "present"})
|
||||||
public final class GameData {
|
public final class GameData {
|
||||||
@ -59,12 +60,10 @@ public final class GameData {
|
|||||||
public <T> T get(@NotNull Key<T> key) {
|
public <T> T get(@NotNull Key<T> key) {
|
||||||
int index = key.index();
|
int index = key.index();
|
||||||
if (present[index]) {
|
if (present[index]) {
|
||||||
//noinspection unchecked
|
|
||||||
return (T) values[index];
|
return (T) values[index];
|
||||||
} else if (key.defaultValue() != null) {
|
} else if (key.defaultValue() != null) {
|
||||||
present[index] = true;
|
present[index] = true;
|
||||||
values[index] = key.defaultValue().get();
|
values[index] = key.defaultValue().get();
|
||||||
//noinspection unchecked
|
|
||||||
return (T) values[index];
|
return (T) values[index];
|
||||||
} else {
|
} else {
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user