aboutsummaryrefslogtreecommitdiffstats
path: root/include/vec2.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/vec2.hpp')
-rw-r--r--include/vec2.hpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/vec2.hpp b/include/vec2.hpp
index 6b3c30a..b0f559f 100644
--- a/include/vec2.hpp
+++ b/include/vec2.hpp
@@ -1,8 +1,18 @@
#ifndef VEC2_HPP
#define VEC2_HPP
+#include <tuple>
+
struct Vec2 {
- float x, y;
+ float x = 0.f, y = 0.f;
+
+ constexpr Vec2() = default;
+
+ constexpr Vec2(float x_, float y_):
+ x(x_), y(y_) {}
+
+ Vec2(std::tuple<float, float> tup):
+ x(std::get<0>(tup)), y(std::get<1>(tup)) {}
auto operator+(const Vec2& o) const noexcept {
return Vec2 {x + o.x, y + o.y};