aboutsummaryrefslogtreecommitdiff
path: root/src/math.odin
diff options
context:
space:
mode:
authoriamcheeseman <[hidden email]>2026-01-16 14:02:01 -0500
committeriamcheeseman <[hidden email]>2026-01-16 14:02:01 -0500
commit64e3dc9c109f4f76d5d1f65a9082340213985361 (patch)
tree37c2652ea82e18b4bf65cb142c9b81d5ae53ec4a /src/math.odin
parentf5a8333aaf0104d3aba4f096c9180cd8287ac1ff (diff)
Add recoil to the gun
Diffstat (limited to 'src/math.odin')
-rw-r--r--src/math.odin21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/math.odin b/src/math.odin
new file mode 100644
index 0000000..0cd2a27
--- /dev/null
+++ b/src/math.odin
@@ -0,0 +1,21 @@
+package demonchime
+
+import "core:math"
+import "core:math/linalg"
+
+import rl "vendor:raylib"
+
+dt_lerp :: proc {
+ dt_lerp_f32,
+ dt_lerp_arr,
+}
+
+dt_lerp_f32 :: proc(a: f32, b: f32, t: f32) -> f32 {
+ dt := rl.GetFrameTime()
+ return math.lerp(b, a, math.pow(0.5, dt * t))
+}
+
+dt_lerp_arr :: proc(a: [$N]$T, b: [N]T, t: T) -> [N]T {
+ dt := rl.GetFrameTime()
+ return linalg.lerp(b, a, math.pow(0.5, dt * t))
+}