From 383ed3675bf1d726d23c5897ddafb8009c26ad9f Mon Sep 17 00:00:00 2001 From: lucasstarsz Date: Fri, 2 Jul 2021 17:49:22 -0400 Subject: [PATCH] (#10) Add Polygon2D static method to construct polygons with just the points --- src/main/java/tech/fastj/graphics/game/Polygon2D.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/tech/fastj/graphics/game/Polygon2D.java b/src/main/java/tech/fastj/graphics/game/Polygon2D.java index 154474b0..62e14aab 100644 --- a/src/main/java/tech/fastj/graphics/game/Polygon2D.java +++ b/src/main/java/tech/fastj/graphics/game/Polygon2D.java @@ -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. *