#pragma once // ============================================================================= // Vector Types typedef union Vector2f Vector2f; union Vector2f { struct { float32 x; float32 y; }; float32 v[2]; }; typedef union Vector2i Vector2i; union Vector2i { struct { int32 x; int32 y; }; int32 v[2]; }; // ============================================================================= // Rect Types typedef union Rect2f Rect2f; union Rect2f { struct { Vector2f min; Vector2f max; }; struct { Vector2f p0; Vector2f p1; }; struct { float32 x0; float32 y0; float32 x1; float32 y1; }; Vector2f v[2]; }; // ============================================================================= // Functions // ============================================================================= // Vectors #define vector2f(x, y) vector_2f((x), (y)) internal Vector2f vector_2f(float32 x, float32 y); // ============================================================================= // Rectangles #define rect2f(min, max) rect_2f((min), (max)) #define rect2fp(x, y, z, w) rect2f(vector2f((x), (y)), vector2f((z), (w))) internal Rect2f rect_2f(Vector2f min, Vector2f max); internal bool32 contains_2f(Rect2f rect, Vector2f x); internal Vector2f dimension_2f(Rect2f rect);