FastJ 1.2.0
The "Unit Test" Update
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).
Highlights
Unit Testing with JUnit 5
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
- Constructors of
fastj.graphics.shapes.Polygon2D
As the project progresses, more unit tests will be added.
Bug Fixes
DrawUtil.java
- Fixed issue in
writeToPSDF()
where newlines were not being added aftershow (s)
or afterPointf (p)
. - Fixed inconsistency between
writeToPSDF()
andparseModelFile()
where models were being written withfill (f)
andshow (s)
values as boolean values. As of now, all models will be written and read as boolean values. - Nearly complete re-write of the
createCollisionOutline()
method -- a proper outline is now generated and sorted to be displayed clockwise.- Uses intersection counting to weed out points on the inner sections of the array of Polygon2Ds.
- Shifts results counter-clockwise to ensure the resulting
Pointf[]
matches the original orientation of the Polygon2Ds.
- Fixed issue in
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
- Fixed issue in constructor
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.
Additions
Drawable.java
- Added method chaining to
setShouldRender()
DrawUtil.java
- Added
createBox(float, float, Pointf)
method to round out the box creation methods
GameObject.java
- Added default translation constant
- Added default scale constant
- Added default rotation constant
- Added method chaining to
setTranslation()
,setRotation()
,setScale()
Model2D.java
- Added
Object#equals()
,Object#hashCode()
Point.java
- Added
Object#equals()
,Object#hashCode()
- Added
equalsPointf()
for comparing against aPointf
object - Added
origin
constant
Pointf.java
- Added
Object#equals()
,Object#hashCode()
- Added
equalsPoint()
for comparing against aPoint
object - Added
origin
constant
Polygon2D.java
- Added
Object#equals()
,Object#hashCode()
- Added default color constant
- Added default "should fill" constant
- Added default "should show" constant
General Changes
DrawUtil.java
- changed
lengthOfPath()
to accept allPath2D
objects - made
Polygon2D#createPath()
publicly available asDrawUtil#createPath()