Skip to content

Commit

Permalink
Merge pull request #128 from fastjengine/1.6.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lucasstarsz authored Jan 31, 2022
2 parents 1a10bc9 + f2e52e1 commit 94d8fcf
Show file tree
Hide file tree
Showing 192 changed files with 7,618 additions and 2,158 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build
run: ./gradlew clean build
run: ./gradlew clean build --info -x :examples:build
- name: Analyze via SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
63 changes: 60 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,64 @@ gradle.properties
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


.project
.classpath
*.prefs
.project
*.classpath

# Other general gitignore content (Eclipse, VSC, other IDEs)
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# CDT- autotools
.autotools

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Annotation Processing
.apt_generated/
.apt_generated_test/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
117 changes: 70 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
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.


## Disclaimer
**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)
### Disclaimer
**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)


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

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


## Adding FastJ to a Project
## Get Started
There are many different ways to learn FastJ -- check them out!


### Template Projects
Use a template project! It's the fastest way to jump into using FastJ.

Choose a programming language from the ones below. We suggest Java, as it has the most support:
- Java: https://github.com/fastjengine/fastj-java-template

However, Kotlin and Groovy are reasonable options as well:
- Kotlin: https://github.com/fastjengine/fastj-kotlin-template
- Groovy: https://github.com/fastjengine/fastj-groovy-template


### Tutorials
[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!


### Code Examples
[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.


### API Documentation
[Check out FastJ's documentation][Javadoc] to get a better understanding of the code FastJ provides to improve your game-making experience.


### I'll add the dependency myself!
Ok, ok, I hear ya. Just follow through with these instructions below.


#### Dependency Management
This library can be found in the following places:
- [jitpack.io][Jitpack.IO], as a dependency.
- [Maven Central][Maven-Central], as a dependency or as a jarfile.
- The [Releases][Releases] section of this repository.


### Adding the Dependency
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**.
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**.

A few common dependencies are provided below:

- **Gradle**
- **Gradle Build Script**
- Groovy:
```groovy
repositories.maven {
Expand All @@ -75,7 +107,7 @@ A few common dependencies are provided below:

dependencies.implementation("com.github.fastjengine:FastJ:[latest version here]")
```
- **Maven**
- **Maven POM**
```xml
<repository>
<id>jitpack.io</id>
Expand All @@ -89,53 +121,41 @@ A few common dependencies are provided below:
</dependency>
```

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!
## Learning FastJ
There are many different ways to learn FastJ -- namely the API documentation, the examples, and the tutorials on the main website.


### Template Projects
Check out these template projects for FastJ! They're the fastest way to jump right into using FastJ.
- Java: https://github.com/fastjengine/fastj-java-template
- Kotlin: https://github.com/fastjengine/fastj-kotlin-template
- Groovy: https://github.com/fastjengine/fastj-groovy-template
#### Hello World Code (Java)
### Tutorials
[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!
```java
import tech.fastj.engine.FastJEngine;
import tech.fastj.graphics.display.FastJCanvas;
import tech.fastj.systems.control.SimpleManager;
public class HelloFastJ extends SimpleManager {
### Code Examples
[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.
@Override
public void init(FastJCanvas canvas) {}
@Override
public void update(FastJCanvas canvas) {}
### API Documentation
[Check out FastJ's documentation][Javadoc] to get a better understanding of the code FastJ provides to improve your game-making experience.
public static void main(String[] args) {
// Creates an empty window titled "Hello, FastJ!"
FastJEngine.init("Hello, FastJ!", new Main());
FastJEngine.run();
}
}
```
## Contributing to FastJ
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.
## External Dependencies
- [SLF4J][SLF4J]
### Building FastJ
You'll need a few things in order to work on the repository:
- [Git][Git-Link]
- [Java 11][AdoptOpenJDK-Java11-Link]
- (optional, but highly recommended!) A decent understanding of how to use [Gradle][Gradle-Link].
**Installation of Gradle is not required -- the project supplies the Gradle tools already.**
- For reference, this project currently makes use of Gradle 7.1.1.
## Contributing
Plan on contributing to the repository? Awesome! We're glad to have you ❤️

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


## Community
Expand Down Expand Up @@ -173,12 +193,14 @@ This repository is licensed under the [MIT License][MIT-License].
[JavaDoc]: https://javadoc.io/doc/io.github.lucasstarsz.fastj/fastj-library "FastJ Documentation"
[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,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAFEklEQVR4Xu1bbXLbNhBdgFR6mLoWSSX2AfLVnqYZKW4mR8iHPT1NIjfJTH7Gqi1Rck5TkdjOgoJCyaQIkASoicxf8hDE7j487GIfaQYHfrEDjx/uAbhnwJ4iMOn38WQ+t85Q6wbq4vtvGOGj2dS6f9YN1AVgEkZ4cg/AgTJgEoYIwOBgGUD09xiDwfTG+ha1bsA0B0yCEIExwGQJp7e31v2zbsAYgDBCesYF/cnOXgFA1HcZ/F4BoILnjMFDB3tfMXMvGKCCd736nTNgcnyM4PnrNOFq3+fzUmcMyK961cpfhxEKRDiJZ6372/qEOllfBrQaSA6UnfmvowEiYul9HVtVY5wDkF/5B5xDcHN9x4ebaIApyoJgvRw6BSAfPALC6WyT0t+CADnjTgJ3XgXywTMh4NE83gC/q0rghAEbCa8gmVHvnxHePuW3c4J1APLBlSW8NUCWMv2uRGgdgCpqd7n6Tg5CVQBU3a8qY03vO2NAWX9/MAD4jEFU0OSYnAibrnbR8w4YkMlblQnwZ60CFNeuPj+fBFVSciGHd3IQ0mUBnf9PLTQ+nWwBZfQqjJAAKGp5r4IQGdvcja5aY+s5II860Z3+LqJ4V8nQKQAUPLW4QojC3r6LkugcAAJhGg2wsCSuJHGXPUEnAFCA8e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gegyuC+3f8fARJ0X9/EzrEAAAAASUVORK5CYIIA
[SLF4J]: https://www.slf4j.org/ "Simple Logging Facade for Java"
[Releases]: https://github.com/fastjengine/FastJ/releases/ "FastJ Releases"
[MIT-License]: https://github.com/fastjengine/FastJ/tree/main/LICENSE.txt "MIT Licensing"
[FastJ-Tutorials]: https://fastj.tech/wiki/fastj-basics/fastj-quick-start "FastJ Tutorials"
[FastJ-Examples]: https://github.com/fastjengine/FastJ/tree/main/src/example "FastJ: Example Game"
[FastJ-Examples]: https://github.com/fastjengine/FastJ/tree/main/src/example "FastJ Examples"
[Contributing-Guidelines]: https://github.com/fastjengine/FastJ/tree/main/.github/CONTRIBUTING.md "Contributing to FastJ"
Expand All @@ -187,3 +209,4 @@ This repository is licensed under the [MIT License][MIT-License].
[AdoptOpenJDK-Java11-Link]: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot "Download Java 11"
[Git-Link]: https://git-scm.com/downloads "Download Git, the powerful source control management tool."
[Gradle-Link]: https://gradle.org/install/ "Download Gradle, the powerful build tool."
79 changes: 32 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ plugins {
// For publishing to Maven Central, we'll want these.
id 'maven-publish'
id 'signing'

// To be able to use Spotless in the project, this will be needed.
id "com.diffplug.spotless" version "5.16.0"
}

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

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

import java.nio.file.Files
import java.nio.file.Path


/* ********************* *
* General Configuration *
Expand Down Expand Up @@ -49,49 +49,11 @@ wrapper.gradleVersion = '7.1.1'
wrapper.distributionType = Wrapper.DistributionType.ALL

repositories.mavenCentral()
dependencies.testImplementation(dependencies.platform('org.junit:junit-bom:5.7.2'))
dependencies.testImplementation('org.junit.jupiter:junit-jupiter:5.7.2')


/* ********************* *
* Example Programs *
* ********************* */


sourceSets {
example {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
output.setResourcesDir(java.destinationDirectory)

task example(type: Exec) {
doFirst {
if (!project.hasProperty('toRun')) {
throw new IllegalArgumentException(
'You need to specify which example using the \"toRun\" property!\nE.G. \"./gradlew example -PtoRun=hellofastj\"'
)
}

if (!Files.exists(Path.of(projectDir.toString(), 'src', 'example', 'java', 'tech', 'fastj', 'example', project.getProperty('toRun') as String))) {
throw new IllegalArgumentException(
"The example ${project.getProperty('toRun')} does not exist."
)
}
}

dependsOn(tasks.compileExampleJava)
description = 'Runs a FastJ example program.'
group = 'Execution'

commandLine(
'java',
'-classpath', sourceSets.example.runtimeClasspath.getAsPath(),
"tech.fastj.example.${project.hasProperty('toRun') ? project.getProperty('toRun') : ''}.Main"
)
}
}
}

dependencies.testImplementation(dependencies.platform('org.junit:junit-bom:5.8.2'))
dependencies.testImplementation('org.junit.jupiter:junit-jupiter:5.8.2')
dependencies.testRuntimeOnly("org.junit.platform:junit-platform-launcher")
dependencies.api('org.slf4j:slf4j-api:2.0.0-alpha5')
dependencies.testImplementation('org.slf4j:slf4j-simple:2.0.0-alpha5')

/* ********************* *
* Unit Testing *
Expand Down Expand Up @@ -128,6 +90,28 @@ tasks.withType(Test) {
}
}

/* ************************* *
* Spotless Integration *
* ************************* */

spotless {
java {
trimTrailingWhitespace()
importOrder(
'tech.fastj.engine',
'tech.fastj.math',
'tech.fastj.graphics',
'tech.fastj.input',
'tech.fastj.resources',
'tech.fastj.systems',
'java',
'javax',
'\\#'
)
removeUnusedImports()
}
}


/* ********************* *
* Code Coverage *
Expand All @@ -138,6 +122,7 @@ sonarqube.properties {
property 'sonar.projectKey', 'fastjengine_FastJ'
property 'sonar.organization', 'fastjengine'
property 'sonar.host.url', 'https://sonarcloud.io'
property 'sonar.exclusions', ['examples/**']
}

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

0 comments on commit 94d8fcf

Please sign in to comment.