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.hpp | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/engine/graphics/vector2.hpp (limited to 'src/engine/graphics/vector2.hpp') diff --git a/src/engine/graphics/vector2.hpp b/src/engine/graphics/vector2.hpp new file mode 100644 index 0000000..c8c6349 --- /dev/null +++ b/src/engine/graphics/vector2.hpp @@ -0,0 +1,48 @@ +#pragma once + +#include "interfaces/vector2.hpp" + +#include + +/** + * A 2D Vector. + */ +class Vector2 : public IVector2 +{ +public: + /** + * Creates a 2D vector. + */ + explicit Vector2(const IVector2Options &options); + + /** + * Returns the X coordinate. + */ + [[nodiscard]] unsigned int x() const override; + + /** + * Sets the X coordinate. + * + * @param x A new X coordinate + */ + void x(unsigned int x) override; + + /** + * Returns the Y coordinate. + */ + [[nodiscard]] unsigned int y() const override; + + /** + * Sets the Y coordinate. + * + * @param Y A new Y coordinate + */ + void y(unsigned int y) override; + + const IVector2 &operator+=(const IVector2 &vector2) override; + const IVector2 &operator-=(const IVector2 &vector2) override; + +private: + unsigned int _x; + unsigned int _y; +}; -- cgit v1.2.3-18-g5258