From 5e4d6e17b2debe4ff347d57f0cb28d731e804088 Mon Sep 17 00:00:00 2001 From: cmanlh Date: Sun, 27 Oct 2024 10:51:40 +0800 Subject: [PATCH] add method to support only adding x or y to vector2 --- src/raymath.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/raymath.h b/src/raymath.h index d1b5ab01..a6125085 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -264,6 +264,22 @@ RMAPI Vector2 Vector2AddValue(Vector2 v, float add) return result; } +// Add vector and x float value +RMAPI Vector2 Vector2AddX(Vector2 v, float x) +{ + Vector2 result = { v.x + x, v.y }; + + return result; +} + +// Add vector and y float value +RMAPI Vector2 Vector2AddY(Vector2 v, float y) +{ + Vector2 result = { v.x, v.y + y }; + + return result; +} + // Subtract two vectors (v1 - v2) RMAPI Vector2 Vector2Subtract(Vector2 v1, Vector2 v2) {