Skip to content

Commit

Permalink
update to FastJ 1.7.0-SNAPSHOT-1
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
lucasstarsz committed Aug 16, 2022
1 parent 282fb15 commit ad91085
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 36 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
40 changes: 24 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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]
}
}
}
}

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
15 changes: 8 additions & 7 deletions src/main/java/tech/fastj/template/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down

0 comments on commit ad91085

Please sign in to comment.