From a0793f33af3a2758616eac89e85ed1a03960e735 Mon Sep 17 00:00:00 2001 From: lucasstarsz Date: Wed, 30 Jun 2021 11:10:23 -0400 Subject: [PATCH] (#10, #32) Add outline rendering to Polygon2D With the addition of outline rendering, the boolean determining fill or outline was no longer satisfactory. As such, the `RenderStyle` class was created, defining the different options for rendering (Only `Polygon2D` has this so far, but it will be rolled out to other classes as needed.) Additions - `Polygon2D#renderStyle` - the replacement to the aforementioned boolean which determines if objects should be filled, outlined, or both. Corresponding default is `Polygon2D#DefaultRenderStyle`. - `Polygon2D#outlineStroke` - the `java.awt.BasicStroke` representing the style of the outline. Corresponding default is `Polygon2D#DefaultStroke`. - `Polygon2D#outlineColor` - the `java.awt.Color` representing the color of the outline. Corresponding default is `Polygon2D#DefaultOutlineColor`. Breaking Changes - Removed all but one `Polygon2D` constructor and made it package private - Included are `create` methods that call on a `Polygon2DBuilder` class which will be added in the next commit. This will replace the excessive amounts of constructors that would have eventually arisen. - Removed `Polygon2D#DefaultFill` and `Polygon2D#shouldFill`, in accordance with the information at the beginning of the commit message. - Renamed `Polygon2D#get/setPaint` to `get/setFill` Removals - Removed transform information from `Polygon2D#toString` - Removed `Polygon2D#DefaultShow` --- .../tech/fastj/example/bullethell/scripts/PlayerCannon.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/example/java/tech/fastj/example/bullethell/scripts/PlayerCannon.java b/src/example/java/tech/fastj/example/bullethell/scripts/PlayerCannon.java index 43b419db..96338613 100644 --- a/src/example/java/tech/fastj/example/bullethell/scripts/PlayerCannon.java +++ b/src/example/java/tech/fastj/example/bullethell/scripts/PlayerCannon.java @@ -51,8 +51,9 @@ private void createBullet(GameObject player) { Pointf cannonFront = Pointf.rotate(startingPoint, rotationAngle, rotationPoint); Pointf[] bulletMesh = DrawUtil.createBox(cannonFront, BulletSize); - Polygon2D bullet = (Polygon2D) Polygon2D.fromPoints(bulletMesh) - .setFill(Color.red) + Polygon2D bullet = (Polygon2D) Polygon2D.create(bulletMesh) + .withFill(Color.red) + .build() .addBehavior(bulletMovementScript, gameScene) .addTag(Tags.Bullet, gameScene);