From 2bcf699b9e11ccf848393882257fc3986bd28e45 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 27 Feb 2022 15:24:07 +0100 Subject: add game & vector2 --- src/engine/graphics/vector2.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/engine/graphics/vector2.cpp (limited to 'src/engine/graphics/vector2.cpp') diff --git a/src/engine/graphics/vector2.cpp b/src/engine/graphics/vector2.cpp new file mode 100644 index 0000000..dfdf4bd --- /dev/null +++ b/src/engine/graphics/vector2.cpp @@ -0,0 +1,39 @@ +#include "vector2.hpp" + +Vector2::Vector2(const IVector2Options &options) : _x(options.x), _y(options.y) {} + +unsigned int Vector2::x() const +{ + return _x; +} + +void Vector2::x(unsigned int x) +{ + _x = x; +} + +unsigned int Vector2::y() const +{ + return _y; +} + +void Vector2::y(unsigned int y) +{ + _y = y; +} + +const IVector2 &Vector2::operator+=(const IVector2 &vector2) +{ + _x += vector2.x(); + _y += vector2.y(); + + return *this; +} + +const IVector2 &Vector2::operator-=(const IVector2 &vector2) +{ + _x -= vector2.x(); + _y -= vector2.y(); + + return *this; +} -- cgit v1.2.3-18-g5258