Skip to content

Commit

Permalink
(#10) Add Polygon2D static method to construct polygons with just the…
Browse files Browse the repository at this point in the history
… points
  • Loading branch information
lucasstarsz committed Jul 4, 2021
1 parent 1b061c2 commit 487c4b6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/tech/fastj/graphics/game/Polygon2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ public static Polygon2DBuilder create(Pointf[] points, RenderStyle renderStyle,
return new Polygon2DBuilder(points, renderStyle, shouldRender);
}

/**
* Creates a {@code Polygon2D} from the specified points.
*
* @param points {@code Pointf} array that defines the points for the {@code Polygon2D}.
* @return The resulting {@code Polygon2D}.
*/
public static Polygon2D fromPoints(Pointf[] points) {
return new Polygon2DBuilder(points, DefaultRenderStyle, Drawable.DefaultShouldRender).build();
}

/**
* Gets the original points that were set for this polygon.
*
Expand Down

0 comments on commit 487c4b6

Please sign in to comment.