diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-27 15:24:07 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:53 +0200 |
commit | 2bcf699b9e11ccf848393882257fc3986bd28e45 (patch) | |
tree | a7ea1033984a857812297b0b41bd322c57a3b23f /src/interfaces/vector2.hpp | |
parent | 5864e5abc43b201c3801fa39a2fcaf9e3a9e8914 (diff) |
add game & vector2
Diffstat (limited to 'src/interfaces/vector2.hpp')
-rw-r--r-- | src/interfaces/vector2.hpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/interfaces/vector2.hpp b/src/interfaces/vector2.hpp new file mode 100644 index 0000000..a58686f --- /dev/null +++ b/src/interfaces/vector2.hpp @@ -0,0 +1,44 @@ +#pragma once + +#include <functional> +#include <memory> + +class IVector2 +{ +public: + /** + * Returns the X coordinate. + */ + [[nodiscard]] virtual unsigned int x() const = 0; + + /** + * Sets the X coordinate. + * + * @param x A new X coordinate + */ + virtual void x(unsigned int x) = 0; + + /** + * Returns the Y coordinate. + */ + [[nodiscard]] virtual unsigned int y() const = 0; + + /** + * Sets the Y coordinate. + * + * @param Y A new Y coordinate + */ + virtual void y(unsigned int y) = 0; + + virtual const IVector2 &operator+=(const IVector2 &vector2) = 0; + virtual const IVector2 &operator-=(const IVector2 &vector2) = 0; +}; + +struct IVector2Options +{ + unsigned int x; + unsigned int y; +}; + +using IVector2Factory = + std::function<std::shared_ptr<IVector2>(const IVector2Options &options)>; |