Introduction
FXGL is a JavaFX Game Development Framework. jDeploy is a tool that simplifies the deployment of Java desktop applications. This tutorial will show you how to use the jDeploy IntelliJ plugin to bootstrap an FXGL project that includes automated deployment via GitHub releases.
Prerequisites
This tutorial requires you to have IntelliJ with the jDeploy IntelliJ Plugin installed.
You may also want to check out this tutorial first, for an introduction to jDeploy and the IntelliJ plugin.
Creating a new FXGL Game
In IntelliJ, with the jDeploy plugin installed, select "File" > "New" > "Project"
In the "Project", select "jDeploy" from the options on the left.
Note
|
If the "jDeploy" option does not appear, that means that you need to install the jDeploy IntelliJ Plugin. |
Select "fxgl" in the "Project Template" drop-down.
In the "GitHub User" field, enter the GitHub username under which the companion repository should be created.
E.g. If you enter "shannah", then the repository will be created at https://github.com/shannah/<project-name>
.
In the "GitHub Token" field, you should paste your GitHub personal access token. If you don’t have one yet, see GitHub’s documentation on how to create one.
This token will be used to create the repository, and, in some cases, add secrets for use by the project’s GitHub workflows.
Then click "Next".
On the next step, enter the project name and location.
The project name will be used as the GitHub repository name as well.
Then click "Create".
After a few seconds, it should prompt you to open the new project, and shortly after that, you should see a notice that it has identified the project as a maven project, as shown here:
Press the "Load Maven Project" button on this panel. This will cause the "Maven" side tab to appear in the project window (on the right), and it will cause the project panel to rearrange itself.
Once the project is finished loading, it should look something like the following.
The default project is a simple "Droplet" game, where you try to catch drops of water in a bucket.
Running the Project
You can run the project using the javafx:run
maven goal.
Tip
|
You can run the |
If all goes well, it should open the game in a window as shown here:
Tip
|
If you receive an error, please ensure that you are running the project with Java 21 or higher, as this is a requirement for this project template. |
Deploying the Application
While you were getting acquainted with the project, GitHub actions was already busily building native desktop installers and publishing them to GitHub releases. If you go to the "Releases" page of the companion GitHub repository, you should find download links for your application on Mac, Windows, and Linux, as shown below:
Furthermore, GitHub will automatically generate new installers on each commit.
Sample Project
Check out the following links to an example project created with the FXGL template. You can download and install the app from the "Releases" page to try it for yourself.