feat: Player controller
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
#include <math.h>
|
||||
V2f V2F(F32 x, F32 y) {
|
||||
V2f result = { x, y };
|
||||
return result;
|
||||
}
|
||||
|
||||
function V2f V2f_Scale(V2f x, F32 scale) {
|
||||
return V2F(x.x * scale, x.y * scale);
|
||||
}
|
||||
|
||||
V2f NormaliseV2F(V2f x) {
|
||||
F32 magnitude = sqrtf((x.x * x.x) + (x.y +x.y));
|
||||
if(magnitude > 0.0){
|
||||
F32 inverse = 1.0f/magnitude;
|
||||
return V2F(x.x*inverse, x.y*inverse);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
V3f V3F(F32 x, F32 y, F32 z) {
|
||||
V3f result = { x, y, z };
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user