diff --git a/src/shape.c b/src/shape.c index d030bb3..9dd1c4b 100644 --- a/src/shape.c +++ b/src/shape.c @@ -83,6 +83,15 @@ Shape* shape_new(const Vector* points, size_t points_len) { return self; } +Shape* shape_new_square(Vector size) { + return shape_new((Vector[4]){ + ZeroVector, + (Vector){0.f, size.y}, + size, + (Vector){size.x, 0.f} + }, 4); +} + Shape* shape_clone(const Shape* source) { Shape* self = malloc(sizeof(Shape)); ASSERT_RETURN(self != NULL, NULL, "Failed to allocate space for shape object."); diff --git a/src/shape.h b/src/shape.h index a20a53c..62be26e 100644 --- a/src/shape.h +++ b/src/shape.h @@ -7,6 +7,7 @@ typedef struct Shape Shape; extern Shape* shape_new(const Vector* points, size_t points_len); +extern Shape* shape_new_square(Vector size); extern Shape* shape_clone(const Shape* source); extern void shape_destroy(Shape* self);