Fixed stupid shit
This commit is contained in:
2 files changed
+10
-54
No files matched your search
+4
-3
@@ -1,11 +1,9 @@
|
||||
#ifndef VEC_UTIL_H_
|
||||
#define VEC_UTIL_H_
|
||||
#include <raylib.h>
|
||||
#include <math.h>
|
||||
#include <raylib.h>
|
||||
static const Vector2 NULL_VEC2 = {0, 0};
|
||||
|
||||
|
||||
|
||||
Vector2 transform_to_center(Vector2 v) {
|
||||
int width = GetRenderWidth();
|
||||
int height = GetRenderHeight();
|
||||
@@ -26,6 +24,9 @@ float vec2_len(Vector2 v) { return sqrtf(v.x * v.x + v.y * v.y); }
|
||||
|
||||
Vector2 vec2_normalize(const Vector2 v) {
|
||||
float len = vec2_len(v);
|
||||
if (len == 0) {
|
||||
return NULL_VEC2;
|
||||
}
|
||||
Vector2 result = {v.x / len, v.y / len};
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user