aboutsummaryrefslogtreecommitdiff
path: root/src/engine/data/bounds.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-06 13:16:05 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:54 +0200
commit0e40bc7ce8c3b3be083002f88c3317d65f6570ad (patch)
tree2fcc470a0f1ce1d51ff26c53c8a9a890b3f31b3b /src/engine/data/bounds.hpp
parentf4d812a5b9131e65bb55db7211dc68fc453792df (diff)
refactor: make vector2 & bounds data classes
Diffstat (limited to 'src/engine/data/bounds.hpp')
-rw-r--r--src/engine/data/bounds.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/engine/data/bounds.hpp b/src/engine/data/bounds.hpp
new file mode 100644
index 0000000..1875bf4
--- /dev/null
+++ b/src/engine/data/bounds.hpp
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "engine/data/vector2.hpp"
+
+#include <cstdint>
+
+enum CoordsValidation
+{
+ VALID,
+ X_HIGH,
+ Y_HIGH
+};
+
+struct BoundsOptions
+{
+ uint32_t width;
+ uint32_t height;
+};
+
+class Bounds
+{
+public:
+ explicit Bounds(const BoundsOptions &options);
+
+ [[nodiscard]] uint32_t width() const noexcept;
+
+ void width(uint32_t width) noexcept;
+
+ [[nodiscard]] uint32_t height() const noexcept;
+
+ void height(uint32_t height) noexcept;
+
+ [[nodiscard]] CoordsValidation validate_coords(const Vector2 &coords) const noexcept;
+
+ const Bounds &operator*=(const Bounds &bounds) noexcept;
+ const Bounds &operator+=(const Bounds &bounds) noexcept;
+ const Bounds &operator-=(const Bounds &bounds) noexcept;
+
+private:
+ uint32_t _width = 0U;
+ uint32_t _height = 0U;
+};