From ad910859adf3eee4729ab43d7f84cfdc1a00d9f3 Mon Sep 17 00:00:00 2001 From: lucasstarsz Date: Tue, 16 Aug 2022 01:54:37 -0400 Subject: [PATCH] update to FastJ 1.7.0-SNAPSHOT-1 - improve jpackage speed by disabling installer generation - bump gradle version to 7.5.1 - bump slf4j to 2.0.0-alpha7 - improve example game - format readme - update license --- LICENSE.md | 2 +- README.md | 31 ++++++++++------ build.gradle | 40 ++++++++++++--------- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/java/tech/fastj/template/Game.java | 15 ++++---- 5 files changed, 54 insertions(+), 36 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index fd1d36b..f407bd5 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Andrew Dey +Copyright (c) 2022 Andrew Dey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 8f11c64..a617bc8 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@ # FastJ Java Template Program ## Requirements -- [Java 11 JDK or Higher][jdk-link] -- Basic understanding of Java +- [Java 18 JDK or Higher][jdk-link] +- Basic understanding of Java ## Initial Setup ### Download the Template + You have a few options for getting the template: -#### Create from Template -1. Click the "Use This Template" button at the top of this project. Leave everything on the project creation screen as is, and hit "Create repository from template". +#### Create from Template - Recommended for Beginners + +1. Click the "Use This Template" button at the top of this project. Leave everything on the project creation screen as + is, and hit "Create repository from template". ![image](https://user-images.githubusercontent.com/64715411/125542737-6eb23326-d07a-4a28-89af-dcacb4f01cac.png) ![image](https://user-images.githubusercontent.com/64715411/125543010-b960404a-ad40-431c-ab31-c097f52574bb.png) @@ -21,13 +24,15 @@ You have a few options for getting the template: ![image](https://user-images.githubusercontent.com/64715411/125545310-c62610da-1eb5-4e80-86b3-352b1ea16612.png) #### Clone the template directly + 1. Clone the repository via terminal: `git clone https://github.com/lucasstarsz/fastj-java-template` #### Downloading the latest release -Download the archive (.zip file, or tar.gz file) from https://github.com/lucasstarsz/fastj-java-template/releases/latest +Download the archive (.zip file, or tar.gz file) from https://github.com/lucasstarsz/fastj-java-template/releases/latest ### Running the Program + 1. Build the program: ```bash ./gradlew build @@ -37,10 +42,10 @@ Download the archive (.zip file, or tar.gz file) from https://github.com/lucasst ./gradlew run ``` - ## General Usage ### Generating Installer/Executable + 1. Build the program: ```bash ./gradlew build @@ -53,18 +58,22 @@ Download the archive (.zip file, or tar.gz file) from https://github.com/lucasst _Having trouble using `gradlew`? Read [this][Terminals Are Different]._ - ## Learning FastJ + Check out the following links to learn how to use FastJ: + - [Example Programs][example-programs-readme-link] - [FastJ Documentation][documentation-link] - ## Configuring the Project Variables + Please view the [build.gradle](build.gradle) file -- it contains general instructions for modifying the base example. -[jdk-link]: https://adoptium.net/?variant=openjdk17 "Java JDK Download" +[jdk-link]: https://adoptium.net/temurin/releases?version=18 "Java JDK Download" + [Terminals Are Different]: https://gist.github.com/lucasstarsz/9bbc306f8655b916367d557043e498ad "Terminals Access Files Differently" -[example-programs-readme-link]: http://fastj.me/tree/main/src/example "FastJ Examples" -[documentation-link]: https://javadoc.io/doc/io.github.lucasstarsz.fastj/fastj-library "FastJ API Documentation" + +[example-programs-readme-link]: https://github.com/fastjengine/FastJ/tree/1.7.0-SNAPSHOT-1/examples "FastJ Examples" + +[documentation-link]: https://javadoc.io/doc/io.github.lucasstarsz.fastj/fastj-library/1.7.0-SNAPSHOT-1 "FastJ API Documentation" diff --git a/build.gradle b/build.gradle index 44495a1..17be42a 100644 --- a/build.gradle +++ b/build.gradle @@ -44,9 +44,9 @@ repositories.maven { repositories.mavenCentral() /* The dependency for FastJ, the game engine this template depends on. */ -dependencies.implementation('com.github.fastjengine:FastJ:1.6.0') +dependencies.implementation('io.github.lucasstarsz.fastj:fastj-library:1.7.0-SNAPSHOT-1') /* We'll stick with the simplest logging option for now -- you can change it however you need. */ -dependencies.implementation('org.slf4j:slf4j-simple:2.0.0-alpha5') +dependencies.implementation('org.slf4j:slf4j-simple:2.0.0-alpha7') /* JLink is used to configure the executables and other distributions for your project. */ @@ -70,26 +70,34 @@ jlink { def iconPath = 'project-resources/fastj_icon' def currentOs = org.gradle.internal.os.OperatingSystem.current() - installerOptions += [ - '--description', project.description, - '--vendor', project.group, - '--app-version', project.version - ] - - if (currentOs.windows) { - installerType = 'msi' icon = "${iconPath}.ico" - installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-shortcut'] } else if (currentOs.linux) { - installerType = 'deb' icon = "${iconPath}.png" - installerOptions += ['--linux-shortcut'] } else if (currentOs.macOsX) { - installerType = 'pkg' icon = "${iconPath}.icns" - installerOptions += ['--mac-package-name', project.name] + } + + /* Comment the line below to create an installer for your application */ + skipInstaller = true + + if (!skipInstaller) { + installerOptions += [ + '--description', project.description, + '--vendor', project.group, + '--app-version', project.version + ] + + if (currentOs.windows) { + installerType = 'msi' + installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-shortcut'] + } else if (currentOs.linux) { + installerType = 'deb' + installerOptions += ['--linux-shortcut'] + } else if (currentOs.macOsX) { + installerType = 'pkg' + installerOptions += ['--mac-package-name', project.name] + } } } } - diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d2880ba..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/tech/fastj/template/Game.java b/src/main/java/tech/fastj/template/Game.java index 641eec1..fb0f848 100644 --- a/src/main/java/tech/fastj/template/Game.java +++ b/src/main/java/tech/fastj/template/Game.java @@ -4,7 +4,7 @@ import tech.fastj.graphics.display.FastJCanvas; import tech.fastj.graphics.display.RenderSettings; import tech.fastj.graphics.game.Text2D; - +import tech.fastj.math.Pointf; import tech.fastj.systems.control.SimpleManager; public class Game extends SimpleManager { @@ -15,13 +15,14 @@ public void init(FastJCanvas canvas) { canvas.modifyRenderSettings(RenderSettings.Antialiasing.Enable); /* A very simple Text2D object, welcoming you to FastJ! */ - Text2D helloFastJText = Text2D.fromText("Hello, FastJ 1.6.0!"); - helloFastJText.translate(canvas.getCanvasCenter()); - drawableManager.addGameObject(helloFastJText); - } + Text2D helloFastJ = Text2D.fromText("Hello, FastJ 1.7.0-SNAPSHOT-1!"); - @Override - public void update(FastJCanvas canvas) { + /* Translate our hello text to the center of the screen */ + Pointf center = canvas.getCanvasCenter(); + helloFastJ.setTranslation(center.subtract(helloFastJ.width() / 2f, helloFastJ.height() / 2f)); + + /* Render hello fastj text */ + drawableManager().addGameObject(helloFastJ); } public static void main(String[] args) {