summaryrefslogtreecommitdiff
path: root/source/math.h
diff options
context:
space:
mode:
authortalha <sarcxd@gmail.com>2025-02-09 20:50:59 +0500
committertalha <sarcxd@gmail.com>2025-02-09 20:50:59 +0500
commit328e5d1bfd1b30ed3ded1737c80dd6ad139cbebc (patch)
tree7547a7d294a4b88ba2f55a44b4033f1d9df4b125 /source/math.h
parent464ddade729d8a847b09445464fc63e1b39b2fa2 (diff)
Added camera_panning, vec2 divide overload, Fixed MIN
Diffstat (limited to 'source/math.h')
-rwxr-xr-xsource/math.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/math.h b/source/math.h
index 950593d..ff76c0e 100755
--- a/source/math.h
+++ b/source/math.h
@@ -8,7 +8,7 @@
#define TO_RAD(x) ((x) * PI / 180.0f)
#define TO_DEG(x) ((x) * 180.0f / PI)
#define ABS(x) ((x) < 0 ? (-(x)) : (x))
-#define MIN(x,y) ((x) < (y) ? (y) : (x))
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
// @todo:
// - make everything simd
@@ -176,6 +176,15 @@ union Vec2 {
return res;
}
+
+ Vec2 operator/(Vec2 v) {
+ SDL_assert(v.x != 0 && v.y != 0);
+ Vec2 res;
+ res.x = this->x / v.x;
+ res.y = this->y / v.y;
+
+ return res;
+ }
};
union Vec3 {