Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions include/Vector2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,29 @@ class Vector2 : public ::Vector2 {
return *this;
}

/**
* Add vector and float value
*/
Vector2 Add(float value) const {
return Vector2AddValue(*this, value);
}

/**
* Add vector and float value
*/
Vector2 operator+(float value) const {
return Vector2AddValue(*this, value);
}

/**
* Add vector and float value
*/
Vector2& operator+=(float value) {
set(Vector2AddValue(*this, value));

return *this;
}

/**
* Subtract two vectors (v1 - v2)
*/
Expand All @@ -87,6 +110,29 @@ class Vector2 : public ::Vector2 {
return *this;
}

/**
* Subtract vector by float value
*/
[[nodiscard]] Vector2 Subtract(float value) const {
return Vector2SubtractValue(*this, value);
}

/**
* Subtract vector by float value
*/
Vector2 operator-(float value) const {
return Vector2SubtractValue(*this, value);
}

/**
* Subtract vector by float value
*/
Vector2& operator-=(float value) {
set(Vector2SubtractValue(*this, value));

return *this;
}

/**
* Negate vector
*/
Expand Down
40 changes: 40 additions & 0 deletions include/Vector3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ class Vector3 : public ::Vector3 {
return *this;
}

/**
* Add vector and float value
*/
[[nodiscard]] Vector3 Add(float value) const {
return Vector3AddValue(*this, value);
}

/**
* Add vector and float value
*/
Vector3 operator+(float value) const {
return Vector3AddValue(*this, value);
}

Vector3& operator+=(float value) {
set(Vector3AddValue(*this, value));

return *this;
}

/**
* Subtract two vectors.
*/
Expand All @@ -76,6 +96,26 @@ class Vector3 : public ::Vector3 {
return *this;
}

/**
* Subtract vector by float value
*/
[[nodiscard]] Vector3 Subtract(float value) const {
return Vector3SubtractValue(*this, value);
}

/**
* Subtract vector by float value
*/
Vector3 operator-(float value) const {
return Vector3SubtractValue(*this, value);
}

Vector3& operator-=(float value) {
set(Vector3SubtractValue(*this, value));

return *this;
}

/**
* Negate provided vector (invert direction)
*/
Expand Down