diff --git a/src/basics.c b/src/basics.c index 7b42d8a..7398165 100644 --- a/src/basics.c +++ b/src/basics.c @@ -92,3 +92,23 @@ vector_normalize(Vector3 v) float inverse_length = 1 / sqrt(length2); return vector_init(v.x * inverse_length, v.y * inverse_length, v.z * inverse_length); } + +/* + * Rects + */ + +/* + * rect_init -- + * + * Create a new Rect given x, y coordinates, height, and width. + */ +Rect +rect_init(float x, float y, float w, float h) +{ + Rect r; + r.x = x; + r.y = y; + r.h = h; + r.w = w; + return r; +} diff --git a/src/basics.h b/src/basics.h index ddf5a35..9f67924 100644 --- a/src/basics.h +++ b/src/basics.h @@ -26,4 +26,12 @@ float vector_length(Vector3 v); Vector3 vector_normalize(Vector3 v); +typedef struct { + float x, y; + float w, h; +} Rect; + +Rect rect_init(float x, float y, float h, float w); + + #endif