Skip to content

Commit

Permalink
(#10, #32) Add outline rendering to Polygon2D
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
lucasstarsz committed Jul 4, 2021
1 parent 99569e2 commit a0793f3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
.<GameObject>addTag(Tags.Bullet, gameScene);

Expand Down

0 comments on commit a0793f3

Please sign in to comment.