Skip to content

Commit

Permalink
[共通] fix #1184
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Jan 15, 2024
1 parent b508b66 commit 99e3a4a
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 24 deletions.
63 changes: 54 additions & 9 deletions Siv3D/include/Siv3D/RectF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,13 @@ namespace s3d
/// @param _center
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::center_<position_type> _center, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::center_<position_type> _center, W _w, H _h) noexcept;

/// @brief
/// @param _center
Expand All @@ -220,8 +225,13 @@ namespace s3d
/// @param topLeft
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::topLeft_<position_type> topLeft, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::topLeft_<position_type> topLeft, W _w, H _h) noexcept;

/// @brief
/// @param topLeft
Expand All @@ -239,8 +249,13 @@ namespace s3d
/// @param topCenter
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::topCenter_<position_type> topCenter, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::topCenter_<position_type> topCenter, W _w, H _h) noexcept;

/// @brief
/// @param topCenter
Expand All @@ -258,8 +273,13 @@ namespace s3d
/// @param topRight
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::topRight_<position_type> topRight, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::topRight_<position_type> topRight, W _w, H _h) noexcept;

/// @brief
/// @param topRight
Expand All @@ -277,8 +297,13 @@ namespace s3d
/// @param rightCenter
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::rightCenter_<position_type> rightCenter, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::rightCenter_<position_type> rightCenter, W _w, H _h) noexcept;

/// @brief
/// @param rightCenter
Expand All @@ -296,8 +321,13 @@ namespace s3d
/// @param bottomRight
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::bottomRight_<position_type> bottomRight, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::bottomRight_<position_type> bottomRight, W _w, H _h) noexcept;

/// @brief
/// @param bottomRight
Expand All @@ -315,8 +345,13 @@ namespace s3d
/// @param bottomCenter
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::bottomCenter_<position_type> bottomCenter, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::bottomCenter_<position_type> bottomCenter, W _w, H _h) noexcept;

/// @brief
/// @param bottomCenter
Expand All @@ -334,8 +369,13 @@ namespace s3d
/// @param bottomLeft 長方形の左下の座標
/// @param _w 長方形の幅
/// @param _h 長方形の高さ
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::bottomLeft_<position_type> bottomLeft, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::bottomLeft_<position_type> bottomLeft, W _w, H _h) noexcept;

/// @brief
/// @param bottomLeft
Expand All @@ -353,8 +393,13 @@ namespace s3d
/// @param leftCenter
/// @param _w
/// @param _h
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>* = nullptr>
# endif
SIV3D_NODISCARD_CXX20
constexpr RectF(Arg::leftCenter_<position_type> leftCenter, value_type _w, value_type _h) noexcept;
constexpr RectF(Arg::leftCenter_<position_type> leftCenter, W _w, H _h) noexcept;

/// @brief
/// @param leftCenter
Expand Down
75 changes: 60 additions & 15 deletions Siv3D/include/Siv3D/detail/RectF.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ namespace s3d
: pos{ (_center->x - _size / 2), (_center->y - _size / 2) }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::center_<position_type> _center, const value_type _w, const value_type _h) noexcept
: pos{ (_center->x - _w / 2), (_center->y - _h / 2) }
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::center_<position_type> _center, const W _w, const H _h) noexcept
: pos{ (_center->x - _w / 2.0), (_center->y - _h / 2.0) }
, size{ _w, _h } {}

inline constexpr RectF::RectF(const Arg::center_<position_type> _center, const size_type _size) noexcept
Expand All @@ -123,8 +128,13 @@ namespace s3d
inline constexpr RectF::RectF(const Arg::topLeft_<position_type> topLeft, const value_type _size) noexcept
: pos{ topLeft->x, topLeft->y }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::topLeft_<position_type> topLeft, const value_type _w, const value_type _h) noexcept

# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::topLeft_<position_type> topLeft, const W _w, const H _h) noexcept
: pos{ topLeft->x, topLeft->y }
, size{ _w, _h } {}

Expand All @@ -136,8 +146,13 @@ namespace s3d
: pos{ (topCenter->x - _size / 2), topCenter->y }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::topCenter_<position_type> topCenter, const value_type _w, const value_type _h) noexcept
: pos{ (topCenter->x - _w / 2), topCenter->y }
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::topCenter_<position_type> topCenter, const W _w, const H _h) noexcept
: pos{ (topCenter->x - _w / 2.0), topCenter->y }
, size{ _w, _h } {}

inline constexpr RectF::RectF(const Arg::topCenter_<position_type> topCenter, const size_type _size) noexcept
Expand All @@ -148,7 +163,12 @@ namespace s3d
: pos{ (topRight->x - _size), topRight->y }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::topRight_<position_type> topRight, const value_type _w, const value_type _h) noexcept
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::topRight_<position_type> topRight, const W _w, const H _h) noexcept
: pos{ (topRight->x - _w), topRight->y }
, size{ _w, _h } {}

Expand All @@ -160,8 +180,13 @@ namespace s3d
: pos{ (rightCenter->x - _size), (rightCenter->y - _size / 2) }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::rightCenter_<position_type> rightCenter, const value_type _w, const value_type _h) noexcept
: pos{ (rightCenter->x - _w), (rightCenter->y - _h / 2) }
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::rightCenter_<position_type> rightCenter, const W _w, const H _h) noexcept
: pos{ (rightCenter->x - _w), (rightCenter->y - _h / 2.0) }
, size{ _w, _h } {}

inline constexpr RectF::RectF(const Arg::rightCenter_<position_type> rightCenter, const size_type _size) noexcept
Expand All @@ -172,7 +197,12 @@ namespace s3d
: pos{ (bottomRight->x - _size), (bottomRight->y - _size) }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::bottomRight_<position_type> bottomRight, const value_type _w, const value_type _h) noexcept
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::bottomRight_<position_type> bottomRight, const W _w, const H _h) noexcept
: pos{ (bottomRight->x - _w), (bottomRight->y - _h) }
, size{ _w, _h } {}

Expand All @@ -184,8 +214,13 @@ namespace s3d
: pos{ (bottomCenter->x - _size / 2), (bottomCenter->y - _size) }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::bottomCenter_<position_type> bottomCenter, const value_type _w, const value_type _h) noexcept
: pos{ (bottomCenter->x - _w / 2), (bottomCenter->y - _h) }
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::bottomCenter_<position_type> bottomCenter, const W _w, const H _h) noexcept
: pos{ (bottomCenter->x - _w / 2.0), (bottomCenter->y - _h) }
, size{ _w, _h } {}

inline constexpr RectF::RectF(const Arg::bottomCenter_<position_type> bottomCenter, const size_type _size) noexcept
Expand All @@ -196,7 +231,12 @@ namespace s3d
: pos{ bottomLeft->x, (bottomLeft->y - _size) }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::bottomLeft_<position_type> bottomLeft, const value_type _w, const value_type _h) noexcept
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::bottomLeft_<position_type> bottomLeft, const W _w, const H _h) noexcept
: pos{ bottomLeft->x, (bottomLeft->y - _h) }
, size{ _w, _h } {}

Expand All @@ -208,8 +248,13 @@ namespace s3d
: pos{ leftCenter->x, (leftCenter->y - _size / 2) }
, size{ _size, _size } {}

inline constexpr RectF::RectF(const Arg::leftCenter_<position_type> leftCenter, const value_type _w, const value_type _h) noexcept
: pos{ leftCenter->x, (leftCenter->y - _h / 2) }
# if __cpp_lib_concepts
template <Concept::Arithmetic W, Concept::Arithmetic H>
# else
template <class W, class H, std::enable_if_t<std::conjunction_v<std::is_arithmetic<W>, std::is_arithmetic<H>>>*>
# endif
inline constexpr RectF::RectF(const Arg::leftCenter_<position_type> leftCenter, const W _w, const H _h) noexcept
: pos{ leftCenter->x, (leftCenter->y - _h / 2.0) }
, size{ _w, _h } {}

inline constexpr RectF::RectF(const Arg::leftCenter_<position_type> leftCenter, const size_type _size) noexcept
Expand Down

0 comments on commit 99e3a4a

Please sign in to comment.