From 3595391cf045436fad704accc7e3b1919fc510c3 Mon Sep 17 00:00:00 2001 From: GameJarne <69422663+GameJarne@users.noreply.github.com> Date: Thu, 29 Jun 2023 20:46:53 +0200 Subject: [PATCH] Added constructors to Vector2, Vector3 and Vector4. ex. Vector2 position = Vector2(0, 1); --- src/raylib.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/raylib.h b/src/raylib.h index cceaa2101..f89da6bf4 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -204,6 +204,13 @@ typedef struct Vector2 { float x; // Vector x component float y; // Vector y component + + Vector2() {} + Vector2(float x, float y) + { + this->x = x; + this->y = y; + } } Vector2; // Vector3, 3 components @@ -211,6 +218,14 @@ typedef struct Vector3 { float x; // Vector x component float y; // Vector y component float z; // Vector z component + + Vector3() {} + Vector3(float x, float y, float z) + { + this->x = x; + this->y = y; + this->z = z; + } } Vector3; // Vector4, 4 components @@ -219,6 +234,15 @@ typedef struct Vector4 { float y; // Vector y component float z; // Vector z component float w; // Vector w component + + Vector4() {} + Vector4(float x, float y, float z, float w) + { + this->x = x; + this->y = y; + this->z = z; + this->w = w; + } } Vector4; // Quaternion, 4 components (Vector4 alias)