An open-source, Java-based 2D game engine.
Thank you to everyone who has supported the project so far -- you've helped us get this far, and we'll be getting even further on very soon. This update sparks the official change of the repository name and the addition of a logo! We are no longer FastJ-Game-Library... we are FastJ. The repository name and URL have been changed to reflect this, as well as the addition of the logo.
This update brings you more unit test coverage, Javadoc cleaning, package redistribution, and numerous improved engine features.
systems.render → graphics
- all classes under system.render
have been moved to the graphics
package.
Camera.java
and Display.java
Camera.java
Drawable.java
GameObject.java
Camera.java
equals
, hashCode
, and toString
implementationsDrawUtil.java
DrawUtil#randomFont()
to generate random fontsKeyboard.java
Keyboard#stop()
method to reset the keyboard and close all of its threads.Maths.java
Maths#randomInteger()
to generate random integersMaths#randomBoolean()
to generate psuedorandom booleans.Maths#floatEquals
-- checks for 'equality' by ensuring the difference between two floats is less than the value of Maths#FloatingPrecision
.
Model2D.java
toString()
overrideshow
value.Model2D(Polygon2D[])
that sets the show
variable to the default show
value (the one mentioned above).Mouse.java
Mouse#stop()
method to reset the mouse and close all of its threads.Polygon2D.java
toString()
overrideText2D.java
color
and show
constantsCamera.java
Camera#getTransformation()
to ensure rotation/translation doesn't happen when the camera hasn't been moved.Camera
constructor where the translation would be set to a reference to the default Camera translation, causing checks to fail in getTransformation
DrawUtil.java
Model2D(Polygon2D[], Pointf, float, Pointf, boolean)
where translations were attempted to be performed before the collision object was made, resulting in a null pointer exception.FastJEngine.java
0
for the default refresh rate, causing the default FPS to be set to 0. Now, it will set to be at least 1
.Display.java
Display#getJFrame
-- The method now returns JFrame
instead of Frame
.FastJEngine.java
FastJEngine#exit()
in two key ways:
System.exit(0)
FastJEngine#exit()
now calls Keyboard#stop()
and Mouse#stop()
rather than their respective reset()
methods, and no longer exits the VM.FastJEngine#error(...)
method - no longer closes the JVM instance. Instead, it closes the game and throws the provided exception with the provided error message.Keyboard.java
Maths.java
Maths
class that previously returned double
values now return float
values.Maths.FloatPrecision
) to 0.00001f
trueMin
value in the random(min, max)
method would be set to trueMax
no matter what.Model2D.java
Model2D#getObjects()
to Model2D#getPolygons()
Keyboard#reset()
no longer closes the keyboard threads.GameObject
.Polygon2D.java
GameObject
.Polygon2D#modifyPoints
to set translation, rotation, and scale to, if requested, the default GameObject
translation, rotation, and scale.Text2D.java
Text2D#DEFAULT_FONT
to Text2D#defaultFont
.FastJ will consist of 4 main packages:
This package contains the game loop on which the game engine runs, as well as engine-related configurable settings.
This package contains all non-rendering graphical content -- game objects, UI, and helper methods to simplify the general process of working with graphics, as well as handling rendering to the screen.
This package contains all mathematics-related content -- Point
and Pointf
, as well as a secondary math class called Maths
are defined here.
This package contains FastJ's numerous features which make it a viable choice for game development. Currently, it contains the following features:
update
methodChanged Packages:
src/main/java/io/github/lucasstarsz/fastj/graphics/GameObject.java → src/main/java/io/github/lucasstarsz/fastj/graphics/game/GameObject.java
src/main/java/io/github/lucasstarsz/fastj/graphics/shapes/Model2D.java → src/main/java/io/github/lucasstarsz/fastj/graphics/game/Model2D.java
src/main/java/io/github/lucasstarsz/fastj/graphics/shapes/Polygon2D.java → src/main/java/io/github/lucasstarsz/fastj/graphics/game/Polygon2D.java
src/main/java/io/github/lucasstarsz/fastj/graphics/text/Text2D.java → src/main/java/io/github/lucasstarsz/fastj/graphics/game/Text2D.java
src/main/java/io/github/lucasstarsz/fastj/ui/EventCondition.java → src/main/java/io/github/lucasstarsz/fastj/graphics/ui/EventCondition.java
src/main/java/io/github/lucasstarsz/fastj/ui/UIElement.java → src/main/java/io/github/lucasstarsz/fastj/graphics/ui/UIElement.java
src/main/java/io/github/lucasstarsz/fastj/ui/elements/Button.java → src/main/java/io/github/lucasstarsz/fastj/graphics/ui/elements/Button.java
src/main/java/io/github/lucasstarsz/fastj/systems/game/DrawableManager.java → src/main/java/io/github/lucasstarsz/fastj/systems/control/DrawableManager.java
src/main/java/io/github/lucasstarsz/fastj/systems/game/LogicManager.java → src/main/java/io/github/lucasstarsz/fastj/systems/control/LogicManager.java
src/main/java/io/github/lucasstarsz/fastj/systems/game/Scene.java → src/main/java/io/github/lucasstarsz/fastj/systems/control/Scene.java
src/main/java/io/github/lucasstarsz/fastj/io/keyboard/Keyboard.java → src/main/java/io/github/lucasstarsz/fastj/systems/input/keyboard/Keyboard.java
src/main/java/io/github/lucasstarsz/fastj/io/keyboard/KeyboardActionListener.java → src/main/java/io/github/lucasstarsz/fastj/systems/input/keyboard/KeyboardActionListener.java
src/main/java/io/github/lucasstarsz/fastj/io/keyboard/Keys.java → src/main/java/io/github/lucasstarsz/fastj/systems/input/keyboard/Keys.java
src/main/java/io/github/lucasstarsz/fastj/io/mouse/Mouse.java → src/main/java/io/github/lucasstarsz/fastj/systems/input/mouse/Mouse.java
src/main/java/io/github/lucasstarsz/fastj/io/mouse/MouseAction.java → src/main/java/io/github/lucasstarsz/fastj/systems/input/mouse/MouseAction.java
src/main/java/io/github/lucasstarsz/fastj/io/mouse/MouseActionListener.java → src/main/java/io/github/lucasstarsz/fastj/systems/input/mouse/MouseActionListener.java
src/main/java/io/github/lucasstarsz/fastj/io/mouse/MouseButtons.java → src/main/java/io/github/lucasstarsz/fastj/systems/input/mouse/MouseButtons.java
src/main/java/io/github/lucasstarsz/fastj/render/Camera.java → src/main/java/io/github/lucasstarsz/fastj/graphics/Camera.java
src/main/java/io/github/lucasstarsz/fastj/render/Display.java → src/main/java/io/github/lucasstarsz/fastj/graphics/Display.java
A new version arises! And this one's coming in with the fact that I've begun to write unit tests for FastJ! Generally speaking, this decision came about because Slope-ECS has been on hold until Gradle 7.0 releases (more on that later).
In the meantime, I've been working on getting all of FastJ unit tested! The project will use JUnit 5 for unit testing rather than JUnit 4, specifically because I need ordered test support. Sorry to anyone who's used to JUnit 4 😅
Currently, the project has all of the following unit tested:
fastj.math
fastj.graphics.DrawUtil
fastj.graphics.shapes.Polygon2D
As the project progresses, more unit tests will be added.
DrawUtil.java
writeToPSDF()
where newlines were not being added after show (s)
or after Pointf (p)
.writeToPSDF()
and parseModelFile()
where models were being written with fill (f)
and show (s)
values as boolean values. As of now, all models will be written and read as boolean values.createCollisionOutline()
method -- a proper outline is now generated and sorted to be displayed clockwise.
Pointf[]
matches the original orientation of the Polygon2Ds.lengthOfPath()
where path close (which connects the last point to the beginning, effectively another line in the path) did not count towards the line path count. Now, that extra line is accounted for.Polygon2D.java
Polygon2D(Pointf[] pts, Pointf setLocation, float setRotation, Pointf setScale, Color color, boolean fill, boolean show)
where scale and rotation were not being set to the correct values.Drawable.java
setShouldRender()
DrawUtil.java
createBox(float, float, Pointf)
method to round out the box creation methodsGameObject.java
setTranslation()
, setRotation()
, setScale()
Model2D.java
Object#equals()
, Object#hashCode()
Point.java
Object#equals()
, Object#hashCode()
equalsPointf()
for comparing against a Pointf
objectorigin
constantPointf.java
Object#equals()
, Object#hashCode()
equalsPoint()
for comparing against a Point
objectorigin
constantPolygon2D.java
Object#equals()
, Object#hashCode()
DrawUtil.java
lengthOfPath()
to accept all Path2D
objectsPolygon2D#createPath()
publicly available as DrawUtil#createPath()