Skip to content

Commit 94d8fcf

Browse files
authored
Merge pull request #128 from fastjengine/1.6.0
FastJ 1.6.0 Highlights - [SLF4J](https://www.slf4j.org/) integration (currently `2.0.0-alpha-5)` in #127 - Fixed dozens of concurrency "random crashes and errors" in #161 - Added custom input event system for keyboard and mouse usage - Added `origin`, `unit`, and directional vectors for `Point/Pointf` in #155 - added substantial logging to the engine - added `EngineConfig` for easier engine configuration - revamped Display system, added simple dialog system in #124 - added Drawable `lookAt` functionality - added simple sprites and textures support in #117 - added resource management system in #117 - added support for textures in `.psdf` in #117 - added `.obj` and `.mtl` support in #117 - removed game crashing errors in the audio engine Breaking Changes - Deprecated `Point/Pointf.Origin` - Deprecated `FastJEngine#init(gameTitle, gameManager, fps, ups, windowResolution, canvasResolution, hardwareAcceleration, exceptionAction)` - original display system is no longer supported Other Changes - Added [Spotless](https://github.com/diffplug/spotless) integration for import order (and hopefully more things later) - Added trace-level logging and date/time recording to `test` logging - moved `src/example` to its own Gradle subproject in #127 - fixed audio example sound usage **Full Changelog**: 1.5.1...1.6.0
2 parents 1a10bc9 + f2e52e1 commit 94d8fcf

192 files changed

Lines changed: 7618 additions & 2158 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/code-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Grant execute permission for gradlew
3232
run: chmod +x ./gradlew
3333
- name: Build
34-
run: ./gradlew clean build
34+
run: ./gradlew clean build --info -x :examples:build
3535
- name: Analyze via SonarQube
3636
env:
3737
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any

.gitignore

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,64 @@ gradle.properties
4646
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
4747
hs_err_pid*
4848

49-
50-
.project
51-
.classpath
5249
*.prefs
50+
.project
51+
*.classpath
52+
53+
# Other general gitignore content (Eclipse, VSC, other IDEs)
54+
.metadata
55+
bin/
56+
tmp/
57+
*.tmp
58+
*.bak
59+
*.swp
60+
*~.nib
61+
local.properties
62+
.settings/
63+
.loadpath
64+
.recommenders
65+
66+
# External tool builders
67+
.externalToolBuilders/
68+
69+
# Locally stored "Eclipse launch configurations"
70+
*.launch
71+
72+
# PyDev specific (Python IDE for Eclipse)
73+
*.pydevproject
74+
75+
# CDT-specific (C/C++ Development Tooling)
76+
.cproject
77+
78+
# CDT- autotools
79+
.autotools
80+
81+
# Java annotation processor (APT)
82+
.factorypath
83+
84+
# PDT-specific (PHP Development Tools)
85+
.buildpath
86+
87+
# sbteclipse plugin
88+
.target
89+
90+
# Tern plugin
91+
.tern-project
92+
93+
# TeXlipse plugin
94+
.texlipse
95+
96+
# STS (Spring Tool Suite)
97+
.springBeans
98+
99+
# Code Recommenders
100+
.recommenders/
101+
102+
# Annotation Processing
103+
.apt_generated/
104+
.apt_generated_test/
105+
106+
# Scala IDE specific (Scala & Java development for Eclipse)
107+
.cache-main
108+
.scala_dependencies
109+
.worksheet

README.md

Lines changed: 70 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
FastJ is an open-source, Java-based 2D game engine and framework. Originally named the FastJ Engine, it aims to provide an easy-to-use, 2D game-making library.
1818

1919

20-
## Disclaimer
21-
**This project is still under heavy development.** There is a very good chance bugs are still prevalent and untracked, as the engine is not fully covered by unit tests. Documentation is readily available, but may change over time. [If you would like to help out, all help is appreciated!](#contributing-to-fastj)
20+
### Disclaimer
21+
**This project is still under heavy development.** There is a very good chance bugs are still prevalent and untracked, as the engine is not fully covered by unit tests. Documentation is readily available, but may change over time. [Feel free to help us out by contributing to the project!](#contributing-to-fastj)
2222

2323

2424
## Projected Feature List
@@ -30,10 +30,13 @@ FastJ is an open-source, Java-based 2D game engine and framework. Originally nam
3030
| Scriptable Behaviors | Control GameObject state ||
3131
| Desktop Support | Full Compatibility on Windows, Linux, and macOS ||
3232
| Audio Engine | Loading, Playing, and Controlling .wav, .au, .aiff files ||
33-
| Image Support | Image rendering, Sprite Animation | |
34-
| Animation Support | Interpolation, Tweening Framework | |
33+
| Image Support | Image rendering, Sprite Animation | |
34+
| Animation Support | Interpolation, Tweening Framework | |
3535
| UI System | Flexible UI System to replace Swing UI ||
36-
| FastJ Model Creator | Create & Export 2D Models ||
36+
| Particle Engine | Configurable and Customizable Particle Management ||
37+
| Physics Engine | Custom 2D Physics Engine. ||
38+
| Asset Manager | Load, Unload, and Hot Reload Game Assets ||
39+
| FastJ Model Creator | Create & Export 2D Models ||
3740
| FastJ Editor | View, Run, Build, and Export FastJ programs from an editor ||
3841
| Web Support | Run FastJ Programs in a Web Browser ||
3942

@@ -46,19 +49,48 @@ FastJ is an open-source, Java-based 2D game engine and framework. Originally nam
4649
❌ is not yet implemented.
4750

4851

49-
## Adding FastJ to a Project
52+
## Get Started
53+
There are many different ways to learn FastJ -- check them out!
54+
55+
56+
### Template Projects
57+
Use a template project! It's the fastest way to jump into using FastJ.
58+
59+
Choose a programming language from the ones below. We suggest Java, as it has the most support:
60+
- Java: https://github.com/fastjengine/fastj-java-template
61+
62+
However, Kotlin and Groovy are reasonable options as well:
63+
- Kotlin: https://github.com/fastjengine/fastj-kotlin-template
64+
- Groovy: https://github.com/fastjengine/fastj-groovy-template
65+
66+
67+
### Tutorials
68+
[FastJ provides article tutorials on its website][FastJ-Tutorials] to accommodate as many types of developers as possible. From beginners to experts, the website tutorials are written to give enough information to satisfy anyone willing to learn!
69+
70+
71+
### Code Examples
72+
[Explore FastJ's code examples][FastJ-Examples] to see the different ways FastJ can be used, and all of its features. These come with in-example explanations and easy plug-and-playability to give you the best chance at understanding how FastJ works.
73+
74+
75+
### API Documentation
76+
[Check out FastJ's documentation][Javadoc] to get a better understanding of the code FastJ provides to improve your game-making experience.
77+
78+
79+
### I'll add the dependency myself!
80+
Ok, ok, I hear ya. Just follow through with these instructions below.
81+
82+
83+
#### Dependency Management
5084
This library can be found in the following places:
5185
- [jitpack.io][Jitpack.IO], as a dependency.
5286
- [Maven Central][Maven-Central], as a dependency or as a jarfile.
5387
- The [Releases][Releases] section of this repository.
5488

55-
56-
### Adding the Dependency
57-
When adding the dependency, **make sure to replace `[latest version here]` with the actual version** (you'll find this in the jitpack.io or Maven Central link up above). **The current latest version is 1.5.1**.
89+
When adding the dependency, **make sure to replace `[latest version here]` with the actual version** (you'll find this in the jitpack.io or Maven Central link up above). **The current latest version is 1.6.0**.
5890

5991
A few common dependencies are provided below:
6092

61-
- **Gradle**
93+
- **Gradle Build Script**
6294
- Groovy:
6395
```groovy
6496
repositories.maven {
@@ -75,7 +107,7 @@ A few common dependencies are provided below:
75107
76108
dependencies.implementation("com.github.fastjengine:FastJ:[latest version here]")
77109
```
78-
- **Maven**
110+
- **Maven POM**
79111
```xml
80112
<repository>
81113
<id>jitpack.io</id>
@@ -89,53 +121,41 @@ A few common dependencies are provided below:
89121
</dependency>
90122
```
91123

124+
You'll also want to make sure you add a dependency for a logging framework from [SLF4J][SLF4J], since FastJ uses it for all its logging purposes. Take your pick!
92125

93-
## Learning FastJ
94-
There are many different ways to learn FastJ -- namely the API documentation, the examples, and the tutorials on the main website.
95-
96-
97-
### Template Projects
98-
Check out these template projects for FastJ! They're the fastest way to jump right into using FastJ.
99-
100-
- Java: https://github.com/fastjengine/fastj-java-template
101-
- Kotlin: https://github.com/fastjengine/fastj-kotlin-template
102-
- Groovy: https://github.com/fastjengine/fastj-groovy-template
103126

127+
#### Hello World Code (Java)
104128

105-
### Tutorials
106-
[FastJ provides article tutorials][FastJ-Tutorials] on its website to accommodate as many types of developers as possible. From beginners to experts, the website tutorials are written to give enough information to satisfy anyone willing to learn!
129+
```java
130+
import tech.fastj.engine.FastJEngine;
131+
import tech.fastj.graphics.display.FastJCanvas;
132+
import tech.fastj.systems.control.SimpleManager;
107133

134+
public class HelloFastJ extends SimpleManager {
108135

109-
### Code Examples
110-
[Explore FastJ's code examples][FastJ-Examples] to see the different ways FastJ can be used, and all of its features. These come with in-example explanations and easy plug-and-playability to give you the best chance at understanding how FastJ works.
136+
@Override
137+
public void init(FastJCanvas canvas) {}
111138

139+
@Override
140+
public void update(FastJCanvas canvas) {}
112141

113-
### API Documentation
114-
[Check out FastJ's documentation][Javadoc] to get a better understanding of the code FastJ provides to improve your game-making experience.
142+
public static void main(String[] args) {
143+
// Creates an empty window titled "Hello, FastJ!"
144+
FastJEngine.init("Hello, FastJ!", new Main());
145+
FastJEngine.run();
146+
}
147+
}
148+
```
115149

116150

117-
## Contributing to FastJ
118-
Plan on contributing to the repository? Great! Be sure to read over the [contribution guidelines][Contributing-Guidelines], and read on to discover how to get started.
151+
## External Dependencies
152+
- [SLF4J][SLF4J]
119153

120154

121-
### Building FastJ
122-
You'll need a few things in order to work on the repository:
123-
- [Git][Git-Link]
124-
- [Java 11][AdoptOpenJDK-Java11-Link]
125-
- (optional, but highly recommended!) A decent understanding of how to use [Gradle][Gradle-Link].
126-
**Installation of Gradle is not required -- the project supplies the Gradle tools already.**
127-
- For reference, this project currently makes use of Gradle 7.1.1.
155+
## Contributing
156+
Plan on contributing to the repository? Awesome! We're glad to have you ❤️
128157

129-
Once you have what you need, follow these simple steps:
130-
- Clone the FastJ repository.
131-
```bash
132-
git clone https://github.com/fastjengine/FastJ.git
133-
```
134-
- Ensure that the FastJ project works on your device.
135-
```bash
136-
./gradlew check
137-
```
138-
_Having trouble using `gradlew`? Read [this][Terminals Are Different]._
158+
Please be sure to read over the [contribution guidelines][Contributing-Guidelines] so that you can get started.
139159

140160

141161
## Community
@@ -173,12 +193,14 @@ This repository is licensed under the [MIT License][MIT-License].
173193
[JavaDoc]: https://javadoc.io/doc/io.github.lucasstarsz.fastj/fastj-library "FastJ Documentation"
174194
[JavaDoc-SVG]: https://javadoc.io/badge2/io.github.lucasstarsz.fastj/fastj-library/Javadocs.svg?style=for-the-badge&color=blue&labelColor=363e45&logo=data:image/png;base64,iVBORw0KGgoAAA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+T2Yvnm800dl04T2ebDtALBhIUtw9NmLSBOpDKk0Sb8Z94F4K2mzvrPJhzQRsPj7blmjPU8VYt6g/LYKgHI7evUFMU1qs1qWQiFKDzSD11/l/NO3Txr733gC3SiPXoyx5zG5xoIBcGRy1ecGCUvXlsk4ZwCYOOVy7D0ANtBWZaluZrbhU9mcVhiQb5Kk4dxRlwwKpPcE9D0kZYSsShRVASEoR5i11KbgWQGAnFAnM1OHNsYzDrN3T635aOUkuB2wFEi4B6QX7L6Y7ASpIdLp/BoBm3u4FrpSfOBUxgBiQwWmLce35zkafsTvmhpA7ZNgePZJdhuIDOJzM+nJVuBqXtpys3fmPmkzIJ/Y9im7B0PSIDlMa+YKLQD6ZGSld2zQh/uQpMvaAoYpK3598QF7ngfcW+WUkiRJW9SKInQ0+ogP/F+yhJaTre4EwjjQuz5MScVTV/ZrVfiAPpOTxZCOxeoGXz1Hc28rS1RKuQ/L5L/duqDhVtBigM5KHY/GSLqenHBV96W2pyWR0Vkgc4W6O3qGPpS81Uxqvw2pz/AkqKZ5oDUAdEBqa8zRnx+w1/Oz/3ZABMa92p1hawCQEkSr2GaC7A/HyDlRn/Y8vXXItpE6OZq+BClagNYAUJNTH6B+J8sEPI8BU5/EK9EDVSg/pJG1I7QVpEROFZdU4maCRxXrWgegyuC+3f8fARJ0X9/EzrEAAAAASUVORK5CYIIA
175195

196+
[SLF4J]: https://www.slf4j.org/ "Simple Logging Facade for Java"
197+
176198
[Releases]: https://github.com/fastjengine/FastJ/releases/ "FastJ Releases"
177199

178200
[MIT-License]: https://github.com/fastjengine/FastJ/tree/main/LICENSE.txt "MIT Licensing"
179201

180202
[FastJ-Tutorials]: https://fastj.tech/wiki/fastj-basics/fastj-quick-start "FastJ Tutorials"
181-
[FastJ-Examples]: https://github.com/fastjengine/FastJ/tree/main/src/example "FastJ: Example Game"
203+
[FastJ-Examples]: https://github.com/fastjengine/FastJ/tree/main/src/example "FastJ Examples"
182204

183205
[Contributing-Guidelines]: https://github.com/fastjengine/FastJ/tree/main/.github/CONTRIBUTING.md "Contributing to FastJ"
184206

@@ -187,3 +209,4 @@ This repository is licensed under the [MIT License][MIT-License].
187209
[AdoptOpenJDK-Java11-Link]: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot "Download Java 11"
188210
[Git-Link]: https://git-scm.com/downloads "Download Git, the powerful source control management tool."
189211
[Gradle-Link]: https://gradle.org/install/ "Download Gradle, the powerful build tool."
212+

build.gradle

Lines changed: 32 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ plugins {
99
// For publishing to Maven Central, we'll want these.
1010
id 'maven-publish'
1111
id 'signing'
12+
13+
// To be able to use Spotless in the project, this will be needed.
14+
id "com.diffplug.spotless" version "5.16.0"
1215
}
1316

1417
group('io.github.lucasstarsz.fastj')
@@ -17,9 +20,6 @@ description('An open source, Java-based 2D game engine.')
1720

1821
import org.gradle.api.internal.tasks.testing.results.DefaultTestResult
1922

20-
import java.nio.file.Files
21-
import java.nio.file.Path
22-
2323

2424
/* ********************* *
2525
* General Configuration *
@@ -49,49 +49,11 @@ wrapper.gradleVersion = '7.1.1'
4949
wrapper.distributionType = Wrapper.DistributionType.ALL
5050

5151
repositories.mavenCentral()
52-
dependencies.testImplementation(dependencies.platform('org.junit:junit-bom:5.7.2'))
53-
dependencies.testImplementation('org.junit.jupiter:junit-jupiter:5.7.2')
54-
55-
56-
/* ********************* *
57-
* Example Programs *
58-
* ********************* */
59-
60-
61-
sourceSets {
62-
example {
63-
compileClasspath += sourceSets.main.output
64-
runtimeClasspath += sourceSets.main.output
65-
output.setResourcesDir(java.destinationDirectory)
66-
67-
task example(type: Exec) {
68-
doFirst {
69-
if (!project.hasProperty('toRun')) {
70-
throw new IllegalArgumentException(
71-
'You need to specify which example using the \"toRun\" property!\nE.G. \"./gradlew example -PtoRun=hellofastj\"'
72-
)
73-
}
74-
75-
if (!Files.exists(Path.of(projectDir.toString(), 'src', 'example', 'java', 'tech', 'fastj', 'example', project.getProperty('toRun') as String))) {
76-
throw new IllegalArgumentException(
77-
"The example ${project.getProperty('toRun')} does not exist."
78-
)
79-
}
80-
}
81-
82-
dependsOn(tasks.compileExampleJava)
83-
description = 'Runs a FastJ example program.'
84-
group = 'Execution'
85-
86-
commandLine(
87-
'java',
88-
'-classpath', sourceSets.example.runtimeClasspath.getAsPath(),
89-
"tech.fastj.example.${project.hasProperty('toRun') ? project.getProperty('toRun') : ''}.Main"
90-
)
91-
}
92-
}
93-
}
94-
52+
dependencies.testImplementation(dependencies.platform('org.junit:junit-bom:5.8.2'))
53+
dependencies.testImplementation('org.junit.jupiter:junit-jupiter:5.8.2')
54+
dependencies.testRuntimeOnly("org.junit.platform:junit-platform-launcher")
55+
dependencies.api('org.slf4j:slf4j-api:2.0.0-alpha5')
56+
dependencies.testImplementation('org.slf4j:slf4j-simple:2.0.0-alpha5')
9557

9658
/* ********************* *
9759
* Unit Testing *
@@ -128,6 +90,28 @@ tasks.withType(Test) {
12890
}
12991
}
13092

93+
/* ************************* *
94+
* Spotless Integration *
95+
* ************************* */
96+
97+
spotless {
98+
java {
99+
trimTrailingWhitespace()
100+
importOrder(
101+
'tech.fastj.engine',
102+
'tech.fastj.math',
103+
'tech.fastj.graphics',
104+
'tech.fastj.input',
105+
'tech.fastj.resources',
106+
'tech.fastj.systems',
107+
'java',
108+
'javax',
109+
'\\#'
110+
)
111+
removeUnusedImports()
112+
}
113+
}
114+
131115

132116
/* ********************* *
133117
* Code Coverage *
@@ -138,6 +122,7 @@ sonarqube.properties {
138122
property 'sonar.projectKey', 'fastjengine_FastJ'
139123
property 'sonar.organization', 'fastjengine'
140124
property 'sonar.host.url', 'https://sonarcloud.io'
125+
property 'sonar.exclusions', ['examples/**']
141126
}
142127

143128
jacocoTestReport {
@@ -195,4 +180,4 @@ publishing.repositories.maven {
195180
url = version.toString().endsWith('-SNAPSHOT') ? 'https://oss.sonatype.org/content/repositories/snapshots/' : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
196181
credentials.username = System.getenv('ossrhUsername')
197182
credentials.password = System.getenv('ossrhPassword')
198-
}
183+
}

0 commit comments

Comments
 (0)