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/interfaces/game.hpp | 7 +++++++ src/interfaces/vector2.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/interfaces/game.hpp create mode 100644 src/interfaces/vector2.hpp (limited to 'src/interfaces') diff --git a/src/interfaces/game.hpp b/src/interfaces/game.hpp new file mode 100644 index 0000000..f9d851b --- /dev/null +++ b/src/interfaces/game.hpp @@ -0,0 +1,7 @@ +#pragma once + +class IGame +{ +public: + virtual void run() = 0; +}; 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 +#include + +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(const IVector2Options &options)>; -- cgit v1.2.3-18-g5258