diff options
Diffstat (limited to 'in_practice/breakout/my_math.h')
-rw-r--r-- | in_practice/breakout/my_math.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/in_practice/breakout/my_math.h b/in_practice/breakout/my_math.h index 29efb45..4c69e23 100644 --- a/in_practice/breakout/my_math.h +++ b/in_practice/breakout/my_math.h @@ -8,6 +8,8 @@ typedef struct {f32 x, y, z;} v3; typedef struct {f32 x, y, z, w;} v4; typedef struct {v4 c0, c1, c2, c3;} mat; +typedef enum {direction_right, direction_up, direction_left, direction_down} direction_enum; + #define mat_identity { \ {1.0f, 0.0f, 0.0f, 0.0f}, \ {0.0f, 1.0f, 0.0f, 0.0f}, \ @@ -18,10 +20,17 @@ typedef struct {v4 c0, c1, c2, c3;} mat; #define deg2rad(a) (a) * f32pi / 180.0f #define rad2deg(a) (a) * 180.0f / f32pi -extern v2 scale_v2(v2 v, f32 x); -extern v2 add_v2(v2 a, v2 b); extern v2 v2a(f32 x); extern v3 v3a(f32 x); +extern v2 scale_v2(v2 v, f32 x); +extern v2 add_v2(v2 a, v2 b); +extern v2 addf_v2(v2 a, f32 b); +extern v2 sub_v2(v2 a, v2 b); +extern v2 clamp_v2(v2 v, v2 min, v2 max); +extern f32 length_v2(v2 v); +extern f32 dot_v2(v2 a, v2 b); +extern v2 norm_v2(v2 a); +extern direction_enum direction_v2(v2 v); extern mat mul_mat(mat l, mat r); extern mat make_scale_mat(v3 v); extern mat make_rotate_mat(v3 x, v3 y, v3 z); |