diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-17 15:53:45 +0100 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-17 16:19:10 +0100 |
| commit | cf51ab71a25cbb60ebcf13edd4b7413c23264128 (patch) | |
| tree | 18b649470346c8815a156b5599ee7be1c4135a79 /src/helpers | |
| parent | 52090853dafb75dd99969a0cecdd291c109210f8 (diff) | |
input basics
Diffstat (limited to 'src/helpers')
| -rw-r--r-- | src/helpers/Vector2D.cpp | 4 | ||||
| -rw-r--r-- | src/helpers/Vector2D.hpp | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/helpers/Vector2D.cpp b/src/helpers/Vector2D.cpp index 33b12e7c..acaace13 100644 --- a/src/helpers/Vector2D.cpp +++ b/src/helpers/Vector2D.cpp @@ -16,4 +16,8 @@ double Vector2D::normalize() { y /= max; return max; +} + +Vector2D Vector2D::floor() { + return Vector2D((int)x, (int)y); }
\ No newline at end of file diff --git a/src/helpers/Vector2D.hpp b/src/helpers/Vector2D.hpp index 9bc427e8..20bc032e 100644 --- a/src/helpers/Vector2D.hpp +++ b/src/helpers/Vector2D.hpp @@ -26,4 +26,15 @@ class Vector2D { Vector2D operator/(float a) { return Vector2D(this->x / a, this->y / a); } + + bool operator==(Vector2D& a) { + return a.x == x && a.y == y; + } + + bool operator!=(Vector2D& a) { + return a.x != x || a.y != y; + } + + + Vector2D floor(); };
\ No newline at end of file |
