[ox/std] Hopefully fix MSVC build
All checks were successful
Build / build (push) Successful in 2m41s

This commit is contained in:
Gary Talent 2024-06-15 15:25:20 -05:00
parent e34df255e0
commit 6cf7bf9628
4 changed files with 20 additions and 24 deletions

View File

@ -14,32 +14,20 @@
namespace ox {
constexpr Vec2::operator Point() const noexcept {
return {
static_cast<int32_t>(x),
static_cast<int32_t>(y),
};
}
constexpr Point::Point(Vec2 const&pt) noexcept:
x(static_cast<int32_t>(pt.x)),
y(static_cast<int32_t>(pt.y)) {}
constexpr Vec2::operator Size() const noexcept {
return {
static_cast<int32_t>(x),
static_cast<int32_t>(y),
};
}
constexpr Size::Size(Vec2 const&pt) noexcept:
width(static_cast<int32_t>(pt.x)),
height(static_cast<int32_t>(pt.y)) {}
constexpr Point::operator Vec2() const noexcept {
return {
static_cast<float>(x),
static_cast<float>(y),
};
}
constexpr Vec2::Vec2(Point const&pt) noexcept:
x(static_cast<float>(pt.x)),
y(static_cast<float>(pt.y)) {}
constexpr Size::operator Vec2() const noexcept {
return {
static_cast<float>(width),
static_cast<float>(height),
};
}
constexpr Vec2::Vec2(Size const&pt) noexcept:
x(static_cast<float>(pt.width)),
y(static_cast<float>(pt.height)) {}
}

View File

@ -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;

View File

@ -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;

View File

@ -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<typename ...Args>
constexpr Vec2(float pX, float pY) noexcept: x(pX), y(pY) {
}