diff --git a/.gitignore b/.gitignore index f4ea906..6d0d72f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /ui/ +/submission/ /Particle Park Code/.nb-gradle/ Particle Park Code/.nb-gradle-properties diff --git a/Particle Park Code/build.gradle b/Particle Park Code/build.gradle index 415a464..fca436f 100644 --- a/Particle Park Code/build.gradle +++ b/Particle Park Code/build.gradle @@ -21,7 +21,7 @@ allprojects { version = '1.0' ext { - appName = "my-gdx-game" + appName = "particle-park" gdxVersion = '1.9.10-SNAPSHOT' roboVMVersion = '2.3.3' box2DLightsVersion = '1.4' diff --git a/Particle Park Code/core/assets/icons/icon-16.png b/Particle Park Code/core/assets/icons/icon-16.png deleted file mode 100644 index 4cf59c8..0000000 Binary files a/Particle Park Code/core/assets/icons/icon-16.png and /dev/null differ diff --git a/Particle Park Code/core/assets/icons/icon-32.png b/Particle Park Code/core/assets/icons/icon-32.png deleted file mode 100644 index 55ca296..0000000 Binary files a/Particle Park Code/core/assets/icons/icon-32.png and /dev/null differ diff --git a/Particle Park Code/core/assets/icons/icon-48.png b/Particle Park Code/core/assets/icons/icon-48.png deleted file mode 100644 index a12c4e0..0000000 Binary files a/Particle Park Code/core/assets/icons/icon-48.png and /dev/null differ diff --git a/Particle Park Code/core/assets/icons/icon_16x16.png b/Particle Park Code/core/assets/icons/icon_16x16.png new file mode 100644 index 0000000..4e12cb2 Binary files /dev/null and b/Particle Park Code/core/assets/icons/icon_16x16.png differ diff --git a/Particle Park Code/core/assets/icons/icon_256x256.png b/Particle Park Code/core/assets/icons/icon_256x256.png new file mode 100644 index 0000000..9f0588b Binary files /dev/null and b/Particle Park Code/core/assets/icons/icon_256x256.png differ diff --git a/Particle Park Code/core/assets/icons/icon_32x32.png b/Particle Park Code/core/assets/icons/icon_32x32.png new file mode 100644 index 0000000..51201bd Binary files /dev/null and b/Particle Park Code/core/assets/icons/icon_32x32.png differ diff --git a/Particle Park Code/core/assets/icons/icon_48x48.png b/Particle Park Code/core/assets/icons/icon_48x48.png new file mode 100644 index 0000000..c8bf298 Binary files /dev/null and b/Particle Park Code/core/assets/icons/icon_48x48.png differ diff --git a/Particle Park Code/core/assets/icons/icon_512x512.png b/Particle Park Code/core/assets/icons/icon_512x512.png new file mode 100644 index 0000000..057e0d4 Binary files /dev/null and b/Particle Park Code/core/assets/icons/icon_512x512.png differ diff --git a/Particle Park Code/core/assets/splash.png b/Particle Park Code/core/assets/splash.png new file mode 100644 index 0000000..146c197 Binary files /dev/null and b/Particle Park Code/core/assets/splash.png differ diff --git a/Particle Park Code/desktop/build.gradle b/Particle Park Code/desktop/build.gradle index e5cf415..ceee80d 100644 --- a/Particle Park Code/desktop/build.gradle +++ b/Particle Park Code/desktop/build.gradle @@ -24,6 +24,7 @@ task debug(dependsOn: classes, type: JavaExec) { } task dist(type: Jar) { + archiveName = "particle_park.jar"; from files(sourceSets.main.output.classesDir) from files(sourceSets.main.output.resourcesDir) from {configurations.compile.collect {zipTree(it)}} @@ -31,12 +32,114 @@ task dist(type: Jar) { exclude("/particles/") manifest { - attributes 'Main-Class': project.mainClassName + attributes ('Main-Class': project.mainClassName, 'SplashScreen-Image' : 'splash.png') } } dist.dependsOn classes +// creates application bundle (executable + runtime) +task javaPackager(type: Exec, dependsOn: dist) { + workingDir project.projectDir + def commands = [ + 'javapackager', + '-deploy', + '-nosign', + '-outdir', "${buildDir}/distribution", + '-srcdir', "${buildDir}/libs", + '-native', 'image', + '-name', project.appName, + '-appclass', project.mainClassName + ] + + def osName = System.getProperty('os.name').toLowerCase(Locale.ROOT) + if (osName.contains('windows')) { + commands << "-Bicon=${project.projectDir}/logo.ico" + commands << "-BjvmOptions=-splash:splash.png" + } else if (osName.contains('linux')) { + commands << "-Bicon=${project.projectDir}/logo.png" + commands << "-BjvmOptions=-splash:splash.png" + } else if (osName.contains('mac')) { + commands << "-Bicon=${project.projectDir}/logo.icns" + commands << "-BjvmOptions=-XstartOnFirstThread" + } + + commandLine = commands + + doLast() { + copy { + from file("${project.projectDir}/splash.png"); + into file("${buildDir}/distribution/${project.appName}/app"); + } + } +} + +// removes bloated runtime created by javapackager +task cleanPackagerRuntime(dependsOn: javaPackager) { + doLast() { + File runtimeFile = new File("${buildDir}/distribution/${project.appName}/runtime") + runtimeFile.deleteDir() + delete { + delete fileTree("${buildDir}/distribution/${project.appName}").matching { + include "api*.dll" + } + } + System.out.println("deleting bloated runtime in " + runtimeFile) + } +} + +// creates a replacement runtime via jlink command (much smaller than jpackager) +task createFinalAppBundle(type: Exec, dependsOn: [cleanPackagerRuntime]) { + def jdk = System.getProperty("java.home") + + workingDir project.projectDir + commandLine = [ + 'jlink', + '-p', "${jdk}/jmods", + '--add-modules', 'java.base,java.desktop,jdk.unsupported', + '--strip-debug', + '--no-header-files', + '--no-man-pages', + '--strip-native-commands', + "--vm=server", + "--compress=2", + '--output', "${buildDir}/distribution/${project.appName}/runtime" + ] + + doLast{ + System.out.println("Application '${project.appName}' packaged.") + System.out.println(" -> location: ${buildDir}/distribution/${project.appName}/") + } +} + +task updateAndCreateZip(type: Zip, dependsOn: [dist]) { + doFirst { + copy { + from "${buildDir}/libs" + into "${buildDir}/distribution/${project.appName}/app" + } + + copy { + from '../README.md' + into "${buildDir}/distribution/${project.appName}" + } + + copy { + from '../CHANGES.md' + into "${buildDir}/distribution/${project.appName}" + } + + copy { + from '../core/assets/splash.png' + into "${buildDir}/distribution/${project.appName}/app" + } + } + + archiveName "particle_park_${org.gradle.internal.os.OperatingSystem.current().getFamilyName()}.zip" + from "${buildDir}/distribution/${project.appName}" + destinationDir = file("${buildDir}/distribution/") +} + eclipse { project { name = appName + "-desktop" diff --git a/Particle Park Code/desktop/logo.icns b/Particle Park Code/desktop/logo.icns new file mode 100644 index 0000000..1e72c5f Binary files /dev/null and b/Particle Park Code/desktop/logo.icns differ diff --git a/Particle Park Code/desktop/logo.ico b/Particle Park Code/desktop/logo.ico new file mode 100644 index 0000000..f555435 Binary files /dev/null and b/Particle Park Code/desktop/logo.ico differ diff --git a/Particle Park Code/desktop/logo.png b/Particle Park Code/desktop/logo.png new file mode 100644 index 0000000..9f0588b Binary files /dev/null and b/Particle Park Code/desktop/logo.png differ diff --git a/Particle Park Code/desktop/src/com/ray3k/particlepark/desktop/DesktopLauncher.java b/Particle Park Code/desktop/src/com/ray3k/particlepark/desktop/DesktopLauncher.java index e8e8786..829eedb 100644 --- a/Particle Park Code/desktop/src/com/ray3k/particlepark/desktop/DesktopLauncher.java +++ b/Particle Park Code/desktop/src/com/ray3k/particlepark/desktop/DesktopLauncher.java @@ -14,7 +14,7 @@ public class DesktopLauncher implements DesktopWorker{ public static void main(String[] arg) { Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); config.setWindowedMode(800, 800); - config.setWindowIcon("icons/icon-16.png", "icons/icon-32.png", "icons/icon-48.png"); + config.setWindowIcon("icons/icon_16x16.png", "icons/icon_32x32.png", "icons/icon_48x48.png"); Core core = new Core(); core.desktopWorker = new DesktopLauncher(); new Lwjgl3Application(core, config); diff --git a/Particle Park Code/settings.gradle b/Particle Park Code/settings.gradle index 74fc652..6a6e4f9 100644 --- a/Particle Park Code/settings.gradle +++ b/Particle Park Code/settings.gradle @@ -1 +1,2 @@ -include 'desktop', 'core' \ No newline at end of file +include 'desktop', 'core' +rootProject.name = 'ParticlePark' \ No newline at end of file diff --git a/graphics/work/Particle Park.spine b/graphics/work/Particle Park.spine index e9d3e8e..975c510 100644 Binary files a/graphics/work/Particle Park.spine and b/graphics/work/Particle Park.spine differ