From dc10e6d1f023d344a743447c68cec7c7d3c2a166 Mon Sep 17 00:00:00 2001 From: Ryo Suzuki Date: Sat, 18 Nov 2023 23:58:58 +0900 Subject: [PATCH] =?UTF-8?q?[=E5=85=B1=E9=80=9A]=20T::withElem(e)=20#1143?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Siv3D/include/Siv3D/Circular.hpp | 12 +++++++++ Siv3D/include/Siv3D/Color.hpp | 25 +++++++++++++++++++ Siv3D/include/Siv3D/ColorF.hpp | 25 +++++++++++++++++++ Siv3D/include/Siv3D/HSV.hpp | 25 +++++++++++++++++++ Siv3D/include/Siv3D/OffsetCircular.hpp | 25 +++++++++++++++++++ Siv3D/include/Siv3D/Point.hpp | 18 ++++++++++--- Siv3D/include/Siv3D/Vector2D.hpp | 12 +++++++++ Siv3D/include/Siv3D/Vector3D.hpp | 18 +++++++++++++ Siv3D/include/Siv3D/Vector4D.hpp | 24 ++++++++++++++++++ Siv3D/include/Siv3D/detail/Circular.ipp | 12 +++++++++ Siv3D/include/Siv3D/detail/Color.ipp | 20 +++++++++++++++ Siv3D/include/Siv3D/detail/ColorF.ipp | 20 +++++++++++++++ Siv3D/include/Siv3D/detail/HSV.ipp | 20 +++++++++++++++ Siv3D/include/Siv3D/detail/OffsetCircular.ipp | 24 ++++++++++++++++++ Siv3D/include/Siv3D/detail/Point.ipp | 16 +++++++++--- Siv3D/include/Siv3D/detail/Vector2D.ipp | 12 +++++++++ Siv3D/include/Siv3D/detail/Vector3D.ipp | 18 +++++++++++++ Siv3D/include/Siv3D/detail/Vector4D.ipp | 24 ++++++++++++++++++ .../src/Siv3D/Script/Bind/ScriptCircular.cpp | 7 ++++++ Siv3D/src/Siv3D/Script/Bind/ScriptColor.cpp | 9 ++++++- Siv3D/src/Siv3D/Script/Bind/ScriptColorF.cpp | 9 ++++++- Siv3D/src/Siv3D/Script/Bind/ScriptFloat2.cpp | 6 +++++ Siv3D/src/Siv3D/Script/Bind/ScriptFloat3.cpp | 7 ++++++ Siv3D/src/Siv3D/Script/Bind/ScriptFloat4.cpp | 8 ++++++ Siv3D/src/Siv3D/Script/Bind/ScriptHSV.cpp | 9 ++++++- .../Script/Bind/ScriptOffsetCircular.cpp | 8 ++++++ Siv3D/src/Siv3D/Script/Bind/ScriptPoint.cpp | 6 +++++ Siv3D/src/Siv3D/Script/Bind/ScriptVec2.cpp | 6 +++++ Siv3D/src/Siv3D/Script/Bind/ScriptVec3.cpp | 7 ++++++ Siv3D/src/Siv3D/Script/Bind/ScriptVec4.cpp | 8 ++++++ 30 files changed, 431 insertions(+), 9 deletions(-) diff --git a/Siv3D/include/Siv3D/Circular.hpp b/Siv3D/include/Siv3D/Circular.hpp index fa278654f..eb1b53ac4 100644 --- a/Siv3D/include/Siv3D/Circular.hpp +++ b/Siv3D/include/Siv3D/Circular.hpp @@ -58,6 +58,18 @@ namespace s3d [[nodiscard]] position_type operator -(position_type v) const noexcept; + /// @brief r 成分のみを変更した自身のコピーを返します。 + /// @param _r r 成分 + /// @return r 成分を変更したコピー + [[nodiscard]] + constexpr CircularBase withR(value_type _r) const noexcept; + + /// @brief theta 成分のみを変更した自身のコピーを返します。 + /// @param _theta theta 成分 + /// @return theta 成分を変更したコピー + [[nodiscard]] + constexpr CircularBase withTheta(value_type _theta) const noexcept; + [[nodiscard]] constexpr CircularBase rotated(value_type angle) const noexcept; diff --git a/Siv3D/include/Siv3D/Color.hpp b/Siv3D/include/Siv3D/Color.hpp index 88d19ac85..b55dbb4dc 100644 --- a/Siv3D/include/Siv3D/Color.hpp +++ b/Siv3D/include/Siv3D/Color.hpp @@ -109,6 +109,30 @@ namespace s3d # endif } + /// @brief r 成分のみを変更した自身のコピーを返します。 + /// @param _r r 成分 + /// @return r 成分を変更したコピー + [[nodiscard]] + constexpr Color withR(uint32 _r) const noexcept; + + /// @brief g 成分のみを変更した自身のコピーを返します。 + /// @param _g g 成分 + /// @return g 成分を変更したコピー + [[nodiscard]] + constexpr Color withG(uint32 _g) const noexcept; + + /// @brief b 成分のみを変更した自身のコピーを返します。 + /// @param _b b 成分 + /// @return b 成分を変更したコピー + [[nodiscard]] + constexpr Color withB(uint32 _b) const noexcept; + + /// @brief a 成分のみを変更した自身のコピーを返します。 + /// @param _a a 成分 + /// @return a 成分を変更したコピー + [[nodiscard]] + constexpr Color withA(uint32 _a) const noexcept; + constexpr Color& setR(uint32 _r) noexcept; constexpr Color& setG(uint32 _g) noexcept; @@ -127,6 +151,7 @@ namespace s3d constexpr Color& set(Color color) noexcept; + [[deprecated("use withA()")]] constexpr Color withAlpha(uint32 _a) const noexcept; [[nodiscard]] diff --git a/Siv3D/include/Siv3D/ColorF.hpp b/Siv3D/include/Siv3D/ColorF.hpp index d86b2989f..06d7d9aa5 100644 --- a/Siv3D/include/Siv3D/ColorF.hpp +++ b/Siv3D/include/Siv3D/ColorF.hpp @@ -127,6 +127,30 @@ namespace s3d || (lhs.a != rhs.a); } + /// @brief r 成分のみを変更した自身のコピーを返します。 + /// @param _r r 成分 + /// @return r 成分を変更したコピー + [[nodiscard]] + constexpr ColorF withR(double _r) const noexcept; + + /// @brief g 成分のみを変更した自身のコピーを返します。 + /// @param _g g 成分 + /// @return g 成分を変更したコピー + [[nodiscard]] + constexpr ColorF withG(double _g) const noexcept; + + /// @brief b 成分のみを変更した自身のコピーを返します。 + /// @param _b b 成分 + /// @return b 成分を変更したコピー + [[nodiscard]] + constexpr ColorF withB(double _b) const noexcept; + + /// @brief a 成分のみを変更した自身のコピーを返します。 + /// @param _a a 成分 + /// @return a 成分を変更したコピー + [[nodiscard]] + constexpr ColorF withA(double _a) const noexcept; + constexpr ColorF& setR(double _r) noexcept; constexpr ColorF& setG(double _g) noexcept; @@ -145,6 +169,7 @@ namespace s3d constexpr ColorF& set(const ColorF& ColorF) noexcept; + [[deprecated("use withA()")]] constexpr ColorF withAlpha(double _a) const noexcept; [[nodiscard]] diff --git a/Siv3D/include/Siv3D/HSV.hpp b/Siv3D/include/Siv3D/HSV.hpp index b0bee8dbe..4777e735c 100644 --- a/Siv3D/include/Siv3D/HSV.hpp +++ b/Siv3D/include/Siv3D/HSV.hpp @@ -105,6 +105,30 @@ namespace s3d || (lhs.a != rhs.a); } + /// @brief h 成分のみを変更した自身のコピーを返します。 + /// @param _h h 成分 + /// @return h 成分を変更したコピー + [[nodiscard]] + constexpr HSV withH(double _h) const noexcept; + + /// @brief s 成分のみを変更した自身のコピーを返します。 + /// @param _s s 成分 + /// @return s 成分を変更したコピー + [[nodiscard]] + constexpr HSV withS(double _s) const noexcept; + + /// @brief v 成分のみを変更した自身のコピーを返します。 + /// @param _v v 成分 + /// @return v 成分を変更したコピー + [[nodiscard]] + constexpr HSV withV(double _v) const noexcept; + + /// @brief a 成分のみを変更した自身のコピーを返します。 + /// @param _a a 成分 + /// @return a 成分を変更したコピー + [[nodiscard]] + constexpr HSV withA(double _a) const noexcept; + constexpr HSV& setH(double _h) noexcept; constexpr HSV& setS(double _s) noexcept; @@ -119,6 +143,7 @@ namespace s3d constexpr HSV& set(const HSV& hsva) noexcept; + [[deprecated("use withA()")]] constexpr HSV withAlpha(double _a) const noexcept; [[nodiscard]] diff --git a/Siv3D/include/Siv3D/OffsetCircular.hpp b/Siv3D/include/Siv3D/OffsetCircular.hpp index 93b1d8733..2de25ad21 100644 --- a/Siv3D/include/Siv3D/OffsetCircular.hpp +++ b/Siv3D/include/Siv3D/OffsetCircular.hpp @@ -57,6 +57,31 @@ namespace s3d constexpr OffsetCircularBase& operator -=(position_type v) noexcept; + /// @brief 中心座標のみを変更した自身のコピーを返します。 + /// @param x 中心の X 座標 + /// @param y 中心の Y 座標 + /// @return 中心座標を変更したコピー + [[nodiscard]] + constexpr OffsetCircularBase withCenter(value_type x, value_type y) const noexcept; + + /// @brief 中心座標のみを変更した自身のコピーを返します。 + /// @param _center 中心座標 + /// @return 中心座標を変更したコピー + [[nodiscard]] + constexpr OffsetCircularBase withCenter(position_type _center) const noexcept; + + /// @brief r 成分のみを変更した自身のコピーを返します。 + /// @param _r r 成分 + /// @return r 成分を変更したコピー + [[nodiscard]] + constexpr OffsetCircularBase withR(value_type _r) const noexcept; + + /// @brief theta 成分のみを変更した自身のコピーを返します。 + /// @param _theta theta 成分 + /// @return theta 成分を変更したコピー + [[nodiscard]] + constexpr OffsetCircularBase withTheta(value_type _theta) const noexcept; + [[nodiscard]] constexpr OffsetCircularBase movedBy(value_type x, value_type y) const noexcept; diff --git a/Siv3D/include/Siv3D/Point.hpp b/Siv3D/include/Siv3D/Point.hpp index ed35a0c70..71f357fe3 100644 --- a/Siv3D/include/Siv3D/Point.hpp +++ b/Siv3D/include/Siv3D/Point.hpp @@ -184,12 +184,24 @@ namespace s3d constexpr void clear() noexcept; - constexpr Point& set(int32 _x, int32 _y) noexcept; + /// @brief x 成分のみを変更した自身のコピーを返します。 + /// @param _x x 成分 + /// @return x 成分を変更したコピー + [[nodiscard]] + constexpr Point withX(value_type _x) const noexcept; + + /// @brief y 成分のみを変更した自身のコピーを返します。 + /// @param _y y 成分 + /// @return y 成分を変更したコピー + [[nodiscard]] + constexpr Point withY(value_type _y) const noexcept; + + constexpr Point& set(value_type _x, value_type _y) noexcept; constexpr Point& set(Point p) noexcept; [[nodiscard]] - constexpr Point movedBy(int32 _x, int32 _y) const noexcept; + constexpr Point movedBy(value_type _x, value_type _y) const noexcept; [[nodiscard]] constexpr Point movedBy(Point p) const noexcept; @@ -198,7 +210,7 @@ namespace s3d [[nodiscard]] constexpr Vector2D movedBy(Vector2D v) const noexcept; - constexpr Point& moveBy(int32 _x, int32 _y) noexcept; + constexpr Point& moveBy(value_type _x, value_type _y) noexcept; constexpr Point& moveBy(Point p) noexcept; diff --git a/Siv3D/include/Siv3D/Vector2D.hpp b/Siv3D/include/Siv3D/Vector2D.hpp index 848e32b72..73f54bfab 100644 --- a/Siv3D/include/Siv3D/Vector2D.hpp +++ b/Siv3D/include/Siv3D/Vector2D.hpp @@ -167,6 +167,18 @@ namespace s3d /// @brief 各成分を 0 にセットします。 constexpr void clear() noexcept; + /// @brief x 成分のみを変更した自身のコピーを返します。 + /// @param _x x 成分 + /// @return x 成分を変更したコピー + [[nodiscard]] + constexpr Vector2D withX(value_type _x) const noexcept; + + /// @brief y 成分のみを変更した自身のコピーを返します。 + /// @param _y y 成分 + /// @return y 成分を変更したコピー + [[nodiscard]] + constexpr Vector2D withY(value_type _y) const noexcept; + /// @brief 各成分を変更します。 /// @param _x 新しい X 成分 /// @param _y 新しい Y 成分 diff --git a/Siv3D/include/Siv3D/Vector3D.hpp b/Siv3D/include/Siv3D/Vector3D.hpp index 820596aed..862145edc 100644 --- a/Siv3D/include/Siv3D/Vector3D.hpp +++ b/Siv3D/include/Siv3D/Vector3D.hpp @@ -168,6 +168,24 @@ namespace s3d /// @brief 各成分を 0 にセットします。 constexpr void clear() noexcept; + /// @brief x 成分のみを変更した自身のコピーを返します。 + /// @param _x x 成分 + /// @return x 成分を変更したコピー + [[nodiscard]] + constexpr Vector3D withX(value_type _x) const noexcept; + + /// @brief y 成分のみを変更した自身のコピーを返します。 + /// @param _y y 成分 + /// @return y 成分を変更したコピー + [[nodiscard]] + constexpr Vector3D withY(value_type _y) const noexcept; + + /// @brief z 成分のみを変更した自身のコピーを返します。 + /// @param _z z 成分 + /// @return z 成分を変更したコピー + [[nodiscard]] + constexpr Vector3D withZ(value_type _z) const noexcept; + /// @brief 各成分を変更します。 /// @param _x 新しい X 成分 /// @param _y 新しい Y 成分 diff --git a/Siv3D/include/Siv3D/Vector4D.hpp b/Siv3D/include/Siv3D/Vector4D.hpp index b2db39786..b7e5faa8a 100644 --- a/Siv3D/include/Siv3D/Vector4D.hpp +++ b/Siv3D/include/Siv3D/Vector4D.hpp @@ -163,6 +163,30 @@ namespace s3d constexpr void clear() noexcept; + /// @brief x 成分のみを変更した自身のコピーを返します。 + /// @param _x x 成分 + /// @return x 成分を変更したコピー + [[nodiscard]] + constexpr Vector4D withX(value_type _x) const noexcept; + + /// @brief y 成分のみを変更した自身のコピーを返します。 + /// @param _y y 成分 + /// @return y 成分を変更したコピー + [[nodiscard]] + constexpr Vector4D withY(value_type _y) const noexcept; + + /// @brief z 成分のみを変更した自身のコピーを返します。 + /// @param _z z 成分 + /// @return z 成分を変更したコピー + [[nodiscard]] + constexpr Vector4D withZ(value_type _z) const noexcept; + + /// @brief w 成分のみを変更した自身のコピーを返します。 + /// @param _w w 成分 + /// @return w 成分を変更したコピー + [[nodiscard]] + constexpr Vector4D withW(value_type _w) const noexcept; + constexpr Vector4D& set(const Vector2D& xy, const Vector2D& zw) noexcept; constexpr Vector4D& set(const Vector2D& xy, value_type _z, value_type _w) noexcept; diff --git a/Siv3D/include/Siv3D/detail/Circular.ipp b/Siv3D/include/Siv3D/detail/Circular.ipp index 1a61e03f3..0b95f528d 100644 --- a/Siv3D/include/Siv3D/detail/Circular.ipp +++ b/Siv3D/include/Siv3D/detail/Circular.ipp @@ -57,6 +57,18 @@ namespace s3d return (toPosition() - v); } + template + inline constexpr CircularBase CircularBase::withR(const value_type _r) const noexcept + { + return{ _r, theta }; + } + + template + inline constexpr CircularBase CircularBase::withTheta(const value_type _theta) const noexcept + { + return{ r, _theta }; + } + template inline constexpr CircularBase CircularBase::rotated(const value_type angle) const noexcept { diff --git a/Siv3D/include/Siv3D/detail/Color.ipp b/Siv3D/include/Siv3D/detail/Color.ipp index 8065c5a7c..2b7a74b5d 100644 --- a/Siv3D/include/Siv3D/detail/Color.ipp +++ b/Siv3D/include/Siv3D/detail/Color.ipp @@ -101,6 +101,26 @@ namespace s3d a }; } + inline constexpr Color Color::withR(const uint32 _r) const noexcept + { + return{ static_cast(_r), g, b, a }; + } + + inline constexpr Color Color::withG(const uint32 _g) const noexcept + { + return{ r, static_cast(_g), b, a }; + } + + inline constexpr Color Color::withB(const uint32 _b) const noexcept + { + return{ r, g, static_cast(_b), a }; + } + + inline constexpr Color Color::withA(const uint32 _a) const noexcept + { + return{ r, g, b, static_cast(_a) }; + } + inline constexpr Color& Color::setR(const uint32 _r) noexcept { r = static_cast(_r); diff --git a/Siv3D/include/Siv3D/detail/ColorF.ipp b/Siv3D/include/Siv3D/detail/ColorF.ipp index 1bdc3e4ef..fcd5b8eaf 100644 --- a/Siv3D/include/Siv3D/detail/ColorF.ipp +++ b/Siv3D/include/Siv3D/detail/ColorF.ipp @@ -169,6 +169,26 @@ namespace s3d return *this; } + inline constexpr ColorF ColorF::withR(const double _r) const noexcept + { + return{ _r, g, b, a }; + } + + inline constexpr ColorF ColorF::withG(const double _g) const noexcept + { + return{ r, _g, b, a }; + } + + inline constexpr ColorF ColorF::withB(const double _b) const noexcept + { + return{ r, g, _b, a }; + } + + inline constexpr ColorF ColorF::withA(const double _a) const noexcept + { + return{ r, g, b, _a }; + } + inline constexpr ColorF& ColorF::setR(const double _r) noexcept { r = _r; diff --git a/Siv3D/include/Siv3D/detail/HSV.ipp b/Siv3D/include/Siv3D/detail/HSV.ipp index fc0ef2709..862716aea 100644 --- a/Siv3D/include/Siv3D/detail/HSV.ipp +++ b/Siv3D/include/Siv3D/detail/HSV.ipp @@ -89,6 +89,26 @@ namespace s3d return{ h - hsv.h, Clamp(s - hsv.s, 0.0, 1.0), Clamp(v - hsv.v, 0.0, 1.0), a }; } + inline constexpr HSV HSV::withH(const double _h) const noexcept + { + return{ _h, s, v, a }; + } + + inline constexpr HSV HSV::withS(const double _s) const noexcept + { + return{ h, _s, v, a }; + } + + inline constexpr HSV HSV::withV(const double _v) const noexcept + { + return{ h, s, _v, a }; + } + + inline constexpr HSV HSV::withA(const double _a) const noexcept + { + return{ h, s, v, _a }; + } + inline constexpr HSV& HSV::setH(const double _h) noexcept { h = _h; diff --git a/Siv3D/include/Siv3D/detail/OffsetCircular.ipp b/Siv3D/include/Siv3D/detail/OffsetCircular.ipp index 8a76c3fec..a883eefdb 100644 --- a/Siv3D/include/Siv3D/detail/OffsetCircular.ipp +++ b/Siv3D/include/Siv3D/detail/OffsetCircular.ipp @@ -62,6 +62,30 @@ namespace s3d return moveBy(-v); } + template + inline constexpr OffsetCircularBase OffsetCircularBase::withCenter(const value_type x, const value_type y) const noexcept + { + return{ Vec2{ x, y }, r, theta }; + } + + template + inline constexpr OffsetCircularBase OffsetCircularBase::withCenter(const position_type _center) const noexcept + { + return{ _center, r, theta }; + } + + template + inline constexpr OffsetCircularBase OffsetCircularBase::withR(const value_type _r) const noexcept + { + return{ center, _r, theta }; + } + + template + inline constexpr OffsetCircularBase OffsetCircularBase::withTheta(const value_type _theta) const noexcept + { + return{ center, r, _theta }; + } + template inline constexpr OffsetCircularBase OffsetCircularBase::movedBy(const value_type x, const value_type y) const noexcept { diff --git a/Siv3D/include/Siv3D/detail/Point.ipp b/Siv3D/include/Siv3D/detail/Point.ipp index 1a36ff7b0..be268b782 100644 --- a/Siv3D/include/Siv3D/detail/Point.ipp +++ b/Siv3D/include/Siv3D/detail/Point.ipp @@ -246,7 +246,17 @@ namespace s3d x = 0; y = 0; } - inline constexpr Point& Point::set(const int32 _x, const int32 _y) noexcept + inline constexpr Point Point::withX(const value_type _x) const noexcept + { + return{ _x, y }; + } + + inline constexpr Point Point::withY(const value_type _y) const noexcept + { + return{ x, _y }; + } + + inline constexpr Point& Point::set(const value_type _x, const value_type _y) noexcept { x = _x; y = _y; return *this; @@ -257,7 +267,7 @@ namespace s3d return (*this = p); } - inline constexpr Point Point::movedBy(const int32 _x, const int32 _y) const noexcept + inline constexpr Point Point::movedBy(const value_type _x, const value_type _y) const noexcept { return{ (x + _x), (y + _y) }; } @@ -273,7 +283,7 @@ namespace s3d return{ (x + v.x), (y + v.y) }; } - inline constexpr Point& Point::moveBy(const int32 _x, const int32 _y) noexcept + inline constexpr Point& Point::moveBy(const value_type _x, const value_type _y) noexcept { x += _x; y += _y; return *this; diff --git a/Siv3D/include/Siv3D/detail/Vector2D.ipp b/Siv3D/include/Siv3D/detail/Vector2D.ipp index aa192cab4..0ee3c5123 100644 --- a/Siv3D/include/Siv3D/detail/Vector2D.ipp +++ b/Siv3D/include/Siv3D/detail/Vector2D.ipp @@ -247,6 +247,18 @@ namespace s3d x = 0; y = 0; } + template + inline constexpr Vector2D Vector2D::withX(const value_type _x) const noexcept + { + return{ _x, y }; + } + + template + inline constexpr Vector2D Vector2D::withY(const value_type _y) const noexcept + { + return{ x, _y }; + } + template inline constexpr Vector2D& Vector2D::set(const value_type _x, const value_type _y) noexcept { diff --git a/Siv3D/include/Siv3D/detail/Vector3D.ipp b/Siv3D/include/Siv3D/detail/Vector3D.ipp index dd66a811b..ab66fdfcd 100644 --- a/Siv3D/include/Siv3D/detail/Vector3D.ipp +++ b/Siv3D/include/Siv3D/detail/Vector3D.ipp @@ -229,6 +229,24 @@ namespace s3d x = 0; y = 0; z = 0; } + template + inline constexpr Vector3D Vector3D::withX(const value_type _x) const noexcept + { + return{ _x, y, z }; + } + + template + inline constexpr Vector3D Vector3D::withY(const value_type _y) const noexcept + { + return{ x, _y, z }; + } + + template + inline constexpr Vector3D Vector3D::withZ(const value_type _z) const noexcept + { + return{ x, y, _z }; + } + template inline constexpr Vector3D& Vector3D::set(const value_type _x, const value_type _y, const value_type _z) noexcept { diff --git a/Siv3D/include/Siv3D/detail/Vector4D.ipp b/Siv3D/include/Siv3D/detail/Vector4D.ipp index 00df7f7e2..cb84ef4a3 100644 --- a/Siv3D/include/Siv3D/detail/Vector4D.ipp +++ b/Siv3D/include/Siv3D/detail/Vector4D.ipp @@ -267,6 +267,30 @@ namespace s3d x = 0; y = 0; z = 0; w = 0; } + template + inline constexpr Vector4D Vector4D::withX(const value_type _x) const noexcept + { + return{ _x, y, z, w }; + } + + template + inline constexpr Vector4D Vector4D::withY(const value_type _y) const noexcept + { + return{ x, _y, z, w }; + } + + template + inline constexpr Vector4D Vector4D::withZ(const value_type _z) const noexcept + { + return{ x, y, _z, w }; + } + + template + inline constexpr Vector4D Vector4D::withW(const value_type _w) const noexcept + { + return{ x, y, z, _w }; + } + template inline constexpr Vector4D& Vector4D::set(const Vector2D& xy, const Vector2D& zw) noexcept { diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptCircular.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptCircular.cpp index 1aa39feb9..780f8b109 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptCircular.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptCircular.cpp @@ -48,6 +48,13 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "Vec2 opNeg() const", asMETHODPR(Circular, operator-, () const noexcept, Circular), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 opAdd(Vec2) const", asMETHODPR(Circular, operator+, (Vec2) const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 opSub(Vec2) const", asMETHODPR(Circular, operator-, (Vec2) const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); + + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Circular withR(double) const", asMETHODPR(ShapeType, withR, (double) const noexcept, Circular), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Circular withTheta(double) const", asMETHODPR(ShapeType, withTheta, (double) const noexcept, Circular), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Circular rotated(double) const", asMETHODPR(ShapeType, rotated, (double) const noexcept, Circular), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Circular& rotate(double)", asMETHODPR(ShapeType, rotate, (double) noexcept, Circular&), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptColor.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptColor.cpp index 5fc05f1be..590f7465b 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptColor.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptColor.cpp @@ -113,6 +113,14 @@ namespace s3d // r = engine->RegisterObjectMethod(TypeName, "bool opEquals(const Color& in) const", asFUNCTION(EqualsColor), asCALL_CDECL_OBJLAST); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Color withR(uint32 r)", asMETHODPR(Color, withR, (uint32) const noexcept, Color), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Color withG(uint32 g)", asMETHODPR(Color, withG, (uint32) const noexcept, Color), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Color withB(uint32 b)", asMETHODPR(Color, withB, (uint32) const noexcept, Color), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Color withA(uint32 a)", asMETHODPR(Color, withA, (uint32) const noexcept, Color), asCALL_THISCALL); assert(r >= 0); + // // set // @@ -125,7 +133,6 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "Color& set(uint32 rgb, uint32 a = 255)", asMETHODPR(Color, set, (uint32, uint32) noexcept, Color&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Color& set(uint32 r, uint32 g, uint32 b, uint32 a = 255)", asMETHODPR(Color, set, (uint32, uint32, uint32, uint32) noexcept, Color&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Color& set(Color)", asMETHODPR(Color, set, (Color) noexcept, Color&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "Color withAlpha(uint32 a)", asMETHODPR(Color, withAlpha, (uint32) const noexcept, Color), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "uint8 grayscale0_255() const", asMETHODPR(Color, grayscale0_255, () const noexcept, uint8), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "double grayscale() const", asMETHODPR(Color, grayscale, () const noexcept, double), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptColorF.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptColorF.cpp index 0662cf31f..97ffeb322 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptColorF.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptColorF.cpp @@ -142,6 +142,14 @@ namespace s3d // r = engine->RegisterObjectMethod(TypeName, "bool opEquals(const ColorF& in) const", asFUNCTION(EqualsColorF), asCALL_CDECL_OBJLAST); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "ColorF withR(double) const", asMETHODPR(ColorF, withR, (double) const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "ColorF withG(double) const", asMETHODPR(ColorF, withG, (double) const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "ColorF withB(double) const", asMETHODPR(ColorF, withB, (double) const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "ColorF withA(double) const", asMETHODPR(ColorF, withA, (double) const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0); + // // set // @@ -154,7 +162,6 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "ColorF& set(double rgb, double a = 1.0)", asMETHODPR(ColorF, set, (double, double), ColorF&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "ColorF& set(double r, double g, double b, double a = 1.0)", asMETHODPR(ColorF, set, (double, double, double, double), ColorF&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "ColorF& set(const ColorF& in)", asMETHODPR(ColorF, set, (const ColorF&), ColorF&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "ColorF withAlpha(double a)", asMETHODPR(ColorF, withAlpha, (double) const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "double grayscale() const", asMETHODPR(ColorF, grayscale, () const noexcept, double), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "double minRGBComponent() const", asMETHODPR(ColorF, minRGBComponent, () const noexcept, double), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptFloat2.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptFloat2.cpp index 4c47d492e..8ca3fab19 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptFloat2.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptFloat2.cpp @@ -115,6 +115,12 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "float maxComponent() const", asMETHODPR(Float2, maxComponent, () const noexcept, float), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "void clear()", asMETHODPR(Float2, clear, () noexcept, void), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Float2 withX(float) const", asMETHODPR(Float2, withX, (float) const noexcept, Float2), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Float2 withY(float) const", asMETHODPR(Float2, withY, (float) const noexcept, Float2), asCALL_THISCALL); assert(r >= 0); + // // set // diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptFloat3.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptFloat3.cpp index 696dd6e59..40dace513 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptFloat3.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptFloat3.cpp @@ -115,6 +115,13 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "float maxComponent() const", asMETHODPR(Float3, maxComponent, () const noexcept, float), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "void clear()", asMETHODPR(Float3, clear, () noexcept, void), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Float3 withX(float) const", asMETHODPR(Float3, withX, (float) const noexcept, Float3), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Float3 withY(float) const", asMETHODPR(Float3, withY, (float) const noexcept, Float3), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Float3 withZ(float) const", asMETHODPR(Float3, withZ, (float) const noexcept, Float3), asCALL_THISCALL); assert(r >= 0); + // // set // diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptFloat4.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptFloat4.cpp index 7eb93399e..a29db8b73 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptFloat4.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptFloat4.cpp @@ -140,6 +140,14 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "float maxComponent() const", asMETHODPR(Float4, maxComponent, () const noexcept, float), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "void clear()", asMETHODPR(Float4, clear, () noexcept, void), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Float4 withX(float) const", asMETHODPR(Float4, withX, (float) const noexcept, Float4), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Float4 withY(float) const", asMETHODPR(Float4, withY, (float) const noexcept, Float4), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Float4 withZ(float) const", asMETHODPR(Float4, withZ, (float) const noexcept, Float4), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Float4 withW(float) const", asMETHODPR(Float4, withW, (float) const noexcept, Float4), asCALL_THISCALL); assert(r >= 0); + // // set // diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptHSV.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptHSV.cpp index 2dee16a61..79ef9f1ae 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptHSV.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptHSV.cpp @@ -105,6 +105,14 @@ namespace s3d // r = engine->RegisterObjectMethod(TypeName, "bool opEquals(const ColorF& in) const", asFUNCTION(EqualsHSV), asCALL_CDECL_OBJLAST); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "HSV withH(double h) const", asMETHODPR(HSV, withH, (double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "HSV withS(double s) const", asMETHODPR(HSV, withS, (double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "HSV withV(double v) const", asMETHODPR(HSV, withV, (double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "HSV withA(double a) const", asMETHODPR(HSV, withA, (double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0); + // // set // @@ -115,7 +123,6 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "HSV& setHSV(double h, double s, double v)", asMETHODPR(HSV, setHSV, (double, double, double) noexcept, HSV&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "HSV& set(double h, double s, double v, double a = 1.0)", asMETHODPR(HSV, set, (double, double, double, double), HSV&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "HSV& set(const HSV& in)", asMETHODPR(HSV, set, (const HSV&), HSV&), asCALL_THISCALL); assert(r >= 0); - r = engine->RegisterObjectMethod(TypeName, "HSV withAlpha(double a) const", asMETHODPR(HSV, withAlpha, (double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "HSV lerp(const HSV& in, double) const", asMETHODPR(HSV, lerp, (const HSV&, double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "size_t hash() const", asMETHODPR(HSV, hash, () const noexcept, size_t), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptOffsetCircular.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptOffsetCircular.cpp index 8312d189d..51e17520f 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptOffsetCircular.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptOffsetCircular.cpp @@ -51,6 +51,14 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "OffsetCircular& opAddAssign(Vec2)", asMETHODPR(ShapeType, operator+=, (Vec2) noexcept, OffsetCircular&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "OffsetCircular& opSubAssign(Vec2)", asMETHODPR(ShapeType, operator-=, (Vec2) noexcept, OffsetCircular&), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "OffsetCircular withCenter(double, double) const", asMETHODPR(ShapeType, withCenter, (double, double) const noexcept, OffsetCircular), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "OffsetCircular withCenter(Vec2) const", asMETHODPR(ShapeType, withCenter, (Vec2) const noexcept, OffsetCircular), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "OffsetCircular withR(double) const", asMETHODPR(ShapeType, withR, (double) const noexcept, OffsetCircular), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "OffsetCircular withTheta(double) const", asMETHODPR(ShapeType, withTheta, (double) const noexcept, OffsetCircular), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "OffsetCircular movedBy(double, double) const", asMETHODPR(ShapeType, movedBy, (double, double) const, ShapeType), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "OffsetCircular movedBy(Vec2) const", asMETHODPR(ShapeType, movedBy, (Vec2) const, ShapeType), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "OffsetCircular& moveBy(double, double)", asMETHODPR(ShapeType, moveBy, (double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0); diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptPoint.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptPoint.cpp index 98f22bcbc..63407141a 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptPoint.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptPoint.cpp @@ -137,6 +137,12 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "int32 maxComponent() const", asMETHODPR(Point, maxComponent, () const noexcept, int32), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "void clear()", asMETHODPR(Point, clear, () noexcept, void), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Point withX(int32) const", asMETHODPR(Point, withX, (int32) const noexcept, Point), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Point withY(int32) const", asMETHODPR(Point, withY, (int32) const noexcept, Point), asCALL_THISCALL); assert(r >= 0); + // // set // diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptVec2.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptVec2.cpp index 7f5229c85..35513a7b9 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptVec2.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptVec2.cpp @@ -116,6 +116,12 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "double maxComponent() const", asMETHODPR(Vec2, maxComponent, () const noexcept, double), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "void clear()", asMETHODPR(Vec2, clear, () noexcept, void), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Vec2 withX(double) const", asMETHODPR(Vec2, withX, (double) const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Vec2 withY(double) const", asMETHODPR(Vec2, withY, (double) const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); + // // set // diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptVec3.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptVec3.cpp index c34dbfed8..59dffaba6 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptVec3.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptVec3.cpp @@ -116,6 +116,13 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "double maxComponent() const", asMETHODPR(Vec3, maxComponent, () const noexcept, double), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "void clear()", asMETHODPR(Vec3, clear, () noexcept, void), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Vec3 withX(double) const", asMETHODPR(Vec3, withX, (double) const noexcept, Vec3), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Vec3 withY(double) const", asMETHODPR(Vec3, withY, (double) const noexcept, Vec3), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Vec3 withZ(double) const", asMETHODPR(Vec3, withZ, (double) const noexcept, Vec3), asCALL_THISCALL); assert(r >= 0); + // // set // diff --git a/Siv3D/src/Siv3D/Script/Bind/ScriptVec4.cpp b/Siv3D/src/Siv3D/Script/Bind/ScriptVec4.cpp index ed9be9068..d31d807c4 100644 --- a/Siv3D/src/Siv3D/Script/Bind/ScriptVec4.cpp +++ b/Siv3D/src/Siv3D/Script/Bind/ScriptVec4.cpp @@ -141,6 +141,14 @@ namespace s3d r = engine->RegisterObjectMethod(TypeName, "double maxComponent() const", asMETHODPR(Vec4, maxComponent, () const noexcept, double), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "void clear()", asMETHODPR(Vec4, clear, () noexcept, void), asCALL_THISCALL); assert(r >= 0); + // + // with + // + r = engine->RegisterObjectMethod(TypeName, "Vec4 withX(double) const", asMETHODPR(Vec4, withX, (double) const noexcept, Vec4), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Vec4 withY(double) const", asMETHODPR(Vec4, withY, (double) const noexcept, Vec4), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Vec4 withZ(double) const", asMETHODPR(Vec4, withZ, (double) const noexcept, Vec4), asCALL_THISCALL); assert(r >= 0); + r = engine->RegisterObjectMethod(TypeName, "Vec4 withW(double) const", asMETHODPR(Vec4, withW, (double) const noexcept, Vec4), asCALL_THISCALL); assert(r >= 0); + // // set //