diff --git a/deps/ox/src/ox/std/conv.hpp b/deps/ox/src/ox/std/conv.hpp index 4329f861..f17e69f2 100644 --- a/deps/ox/src/ox/std/conv.hpp +++ b/deps/ox/src/ox/std/conv.hpp @@ -14,32 +14,20 @@ namespace ox { -constexpr Vec2::operator Point() const noexcept { - return { - static_cast(x), - static_cast(y), - }; -} +constexpr Point::Point(Vec2 const&pt) noexcept: + x(static_cast(pt.x)), + y(static_cast(pt.y)) {} -constexpr Vec2::operator Size() const noexcept { - return { - static_cast(x), - static_cast(y), - }; -} +constexpr Size::Size(Vec2 const&pt) noexcept: + width(static_cast(pt.x)), + height(static_cast(pt.y)) {} -constexpr Point::operator Vec2() const noexcept { - return { - static_cast(x), - static_cast(y), - }; -} +constexpr Vec2::Vec2(Point const&pt) noexcept: + x(static_cast(pt.x)), + y(static_cast(pt.y)) {} -constexpr Size::operator Vec2() const noexcept { - return { - static_cast(width), - static_cast(height), - }; -} +constexpr Vec2::Vec2(Size const&pt) noexcept: + x(static_cast(pt.width)), + y(static_cast(pt.height)) {} } \ No newline at end of file diff --git a/deps/ox/src/ox/std/point.hpp b/deps/ox/src/ox/std/point.hpp index 94062e1b..57737f8f 100644 --- a/deps/ox/src/ox/std/point.hpp +++ b/deps/ox/src/ox/std/point.hpp @@ -24,6 +24,8 @@ class Point { constexpr Point(int x, int y) noexcept; + explicit constexpr Point(class Vec2 const&pt) noexcept; + constexpr Point operator+(const Point &p) const noexcept; constexpr Point operator-(const Point &p) const noexcept; diff --git a/deps/ox/src/ox/std/size.hpp b/deps/ox/src/ox/std/size.hpp index 66840089..b2980ed9 100644 --- a/deps/ox/src/ox/std/size.hpp +++ b/deps/ox/src/ox/std/size.hpp @@ -24,6 +24,8 @@ class Size { constexpr Size(int width, int height) noexcept; + explicit constexpr Size(class Vec2 const&pt) noexcept; + constexpr Size operator+(Size p) const noexcept; constexpr Size operator-(Size p) const noexcept; diff --git a/deps/ox/src/ox/std/vec.hpp b/deps/ox/src/ox/std/vec.hpp index 22a78ada..3c443d4f 100644 --- a/deps/ox/src/ox/std/vec.hpp +++ b/deps/ox/src/ox/std/vec.hpp @@ -142,6 +142,10 @@ class Vec2 { constexpr Vec2() noexcept = default; + explicit constexpr Vec2(class Point const&pt) noexcept; + + explicit constexpr Vec2(class Size const&pt) noexcept; + template constexpr Vec2(float pX, float pY) noexcept: x(pX), y(pY) { }