aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/bounds.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/bounds.hpp')
-rw-r--r--src/interfaces/bounds.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/interfaces/bounds.hpp b/src/interfaces/bounds.hpp
new file mode 100644
index 0000000..9cec97e
--- /dev/null
+++ b/src/interfaces/bounds.hpp
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "interfaces/vector2.hpp"
+
+#include <functional>
+#include <memory>
+
+enum CoordsValidation
+{
+ VALID,
+ X_HIGH,
+ Y_HIGH
+};
+
+class IBounds
+{
+public:
+ [[nodiscard]] virtual unsigned int width() const = 0;
+
+ virtual void width(unsigned int width) = 0;
+
+ [[nodiscard]] virtual unsigned int height() const = 0;
+
+ virtual void height(unsigned int height) = 0;
+
+ [[nodiscard]] virtual CoordsValidation
+ validate_coords(const IVector2 &coords) const = 0;
+
+ virtual const IBounds &operator*=(const IBounds &bounds) = 0;
+ virtual const IBounds &operator+=(const IBounds &bounds) = 0;
+ virtual const IBounds &operator-=(const IBounds &bounds) = 0;
+};
+
+struct IBoundsOptions
+{
+ unsigned int width;
+ unsigned int height;
+};
+
+using IBoundsFactory =
+ std::function<std::shared_ptr<IBounds>(const IBoundsOptions &options)>;