From 86dbf468586575e8938b1afc66d88c2adef87716 Mon Sep 17 00:00:00 2001 From: Ryo Suzuki Date: Sun, 10 Dec 2023 19:12:57 +0900 Subject: [PATCH] =?UTF-8?q?[=E5=85=B1=E9=80=9A]=20PutText=20=E3=82=AA?= =?UTF-8?q?=E3=83=BC=E3=83=90=E3=83=BC=E3=83=AD=E3=83=BC=E3=83=89=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=20#1159?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Siv3D/include/Siv3D/PutText.hpp | 122 +++++++++++++++++++++++++ Siv3D/src/Siv3D/PutText/SivPutText.cpp | 120 ++++++++++++++++++++++++ 2 files changed, 242 insertions(+) diff --git a/Siv3D/include/Siv3D/PutText.hpp b/Siv3D/include/Siv3D/PutText.hpp index 748471d47..e9ecf7d28 100644 --- a/Siv3D/include/Siv3D/PutText.hpp +++ b/Siv3D/include/Siv3D/PutText.hpp @@ -17,57 +17,179 @@ namespace s3d { + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param x 描画する中心の X 座標 + /// @param y 描画する中心の Y 座標 + void PutText(const char32* s, double x, double y); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param x 描画する中心の X 座標 + /// @param y 描画する中心の Y 座標 + void PutText(StringView s, double x, double y); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param x 描画する中心の X 座標 /// @param y 描画する中心の Y 座標 void PutText(String s, double x, double y); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param center 描画する中心座標 + void PutText(const char32* s, Vec2 center); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param center 描画する中心座標 + void PutText(StringView s, Vec2 center); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param center 描画する中心座標 void PutText(String s, Vec2 center); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param topLeft 描画する左上の座標 + void PutText(const char32* s, Arg::topLeft_ topLeft); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param topLeft 描画する左上の座標 + void PutText(StringView s, Arg::topLeft_ topLeft); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param topLeft 描画する左上の座標 void PutText(String s, Arg::topLeft_ topLeft); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param topCenter 描画する上辺中心の座標 + void PutText(const char32* s, Arg::topCenter_ topCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param topCenter 描画する上辺中心の座標 + void PutText(StringView s, Arg::topCenter_ topCenter); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param topCenter 描画する上辺中心の座標 void PutText(String s, Arg::topCenter_ topCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param topRight 描画する右上の座標 + void PutText(const char32* s, Arg::topRight_ topRight); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param topRight 描画する右上の座標 + void PutText(StringView s, Arg::topRight_ topRight); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param topRight 描画する右上の座標 void PutText(String s, Arg::topRight_ topRight); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param rightCenter 描画する右辺中心の座標 + void PutText(const char32* s, Arg::rightCenter_ rightCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param rightCenter 描画する右辺中心の座標 + void PutText(StringView s, Arg::rightCenter_ rightCenter); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param rightCenter 描画する右辺中心の座標 void PutText(String s, Arg::rightCenter_ rightCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param bottomRight 描画する右下の座標 + void PutText(const char32* s, Arg::bottomRight_ bottomRight); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param bottomRight 描画する右下の座標 + void PutText(StringView s, Arg::bottomRight_ bottomRight); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param bottomRight 描画する右下の座標 void PutText(String s, Arg::bottomRight_ bottomRight); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param bottomCenter 描画する下辺中心の座標 + void PutText(const char32* s, Arg::bottomCenter_ bottomCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param bottomCenter 描画する下辺中心の座標 + void PutText(StringView s, Arg::bottomCenter_ bottomCenter); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param bottomCenter 描画する下辺中心の座標 void PutText(String s, Arg::bottomCenter_ bottomCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param bottomLeft 描画する左下の座標 + void PutText(const char32* s, Arg::bottomLeft_ bottomLeft); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param bottomLeft 描画する左下の座標 + void PutText(StringView s, Arg::bottomLeft_ bottomLeft); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param bottomLeft 描画する左下の座標 void PutText(String s, Arg::bottomLeft_ bottomLeft); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param leftCenter 描画する左辺中心の座標 + void PutText(const char32* s, Arg::leftCenter_ leftCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param leftCenter 描画する左辺中心の座標 + void PutText(StringView s, Arg::leftCenter_ leftCenter); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param leftCenter 描画する左辺中心の座標 void PutText(String s, Arg::leftCenter_ leftCenter); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param center 描画する中心座標 + void PutText(const char32* s, Arg::center_ center); + + /// @brief 指定した位置にテキストを描画します。 + /// @param s テキスト + /// @param center 描画する中心座標 + void PutText(StringView s, Arg::center_ center); + /// @brief 指定した位置にテキストを描画します。 /// @param s テキスト /// @param center 描画する中心座標 diff --git a/Siv3D/src/Siv3D/PutText/SivPutText.cpp b/Siv3D/src/Siv3D/PutText/SivPutText.cpp index 72a6affca..8ecbbe9bf 100644 --- a/Siv3D/src/Siv3D/PutText/SivPutText.cpp +++ b/Siv3D/src/Siv3D/PutText/SivPutText.cpp @@ -15,56 +15,176 @@ namespace s3d { + void PutText(const char32* s, const double x, const double y) + { + SIV3D_ENGINE(Print)->put(String{ s }, Vec2{ x, y }, 0); + } + + void PutText(const StringView s, const double x, const double y) + { + SIV3D_ENGINE(Print)->put(String{ s }, Vec2{ x, y }, 0); + } + void PutText(String s, const double x, const double y) { SIV3D_ENGINE(Print)->put(std::move(s), Vec2{ x, y }, 0); } + + void PutText(const char32* s, const Vec2 center) + { + SIV3D_ENGINE(Print)->put(String{ s }, center, 0); + } + + void PutText(const StringView s, const Vec2 center) + { + SIV3D_ENGINE(Print)->put(String{ s }, center, 0); + } + void PutText(String s, const Vec2 center) { SIV3D_ENGINE(Print)->put(std::move(s), center, 0); } + + void PutText(const char32* s, const Arg::topLeft_ topLeft) + { + SIV3D_ENGINE(Print)->put(String{ s }, *topLeft, 1); + } + + void PutText(const StringView s, const Arg::topLeft_ topLeft) + { + SIV3D_ENGINE(Print)->put(String{ s }, *topLeft, 1); + } + void PutText(String s, const Arg::topLeft_ topLeft) { SIV3D_ENGINE(Print)->put(std::move(s), *topLeft, 1); } + + void PutText(const char32* s, const Arg::topCenter_ topCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *topCenter, 2); + } + + void PutText(const StringView s, const Arg::topCenter_ topCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *topCenter, 2); + } + void PutText(String s, const Arg::topCenter_ topCenter) { SIV3D_ENGINE(Print)->put(std::move(s), *topCenter, 2); } + + void PutText(const char32* s, const Arg::topRight_ topRight) + { + SIV3D_ENGINE(Print)->put(String{ s }, *topRight, 3); + } + + void PutText(const StringView s, const Arg::topRight_ topRight) + { + SIV3D_ENGINE(Print)->put(String{ s }, *topRight, 3); + } + void PutText(String s, const Arg::topRight_ topRight) { SIV3D_ENGINE(Print)->put(std::move(s), *topRight, 3); } + + void PutText(const char32* s, const Arg::rightCenter_ rightCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *rightCenter, 4); + } + + void PutText(const StringView s, const Arg::rightCenter_ rightCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *rightCenter, 4); + } + void PutText(String s, const Arg::rightCenter_ rightCenter) { SIV3D_ENGINE(Print)->put(std::move(s), *rightCenter, 4); } + + void PutText(const char32* s, const Arg::bottomRight_ bottomRight) + { + SIV3D_ENGINE(Print)->put(String{ s }, *bottomRight, 5); + } + + void PutText(const StringView s, const Arg::bottomRight_ bottomRight) + { + SIV3D_ENGINE(Print)->put(String{ s }, *bottomRight, 5); + } + void PutText(String s, const Arg::bottomRight_ bottomRight) { SIV3D_ENGINE(Print)->put(std::move(s), *bottomRight, 5); } + + void PutText(const char32* s, const Arg::bottomCenter_ bottomCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *bottomCenter, 6); + } + + void PutText(const StringView s, const Arg::bottomCenter_ bottomCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *bottomCenter, 6); + } + void PutText(String s, const Arg::bottomCenter_ bottomCenter) { SIV3D_ENGINE(Print)->put(std::move(s), *bottomCenter, 6); } + + void PutText(const char32* s, const Arg::bottomLeft_ bottomLeft) + { + SIV3D_ENGINE(Print)->put(String{ s }, *bottomLeft, 7); + } + + void PutText(const StringView s, const Arg::bottomLeft_ bottomLeft) + { + SIV3D_ENGINE(Print)->put(String{ s }, *bottomLeft, 7); + } + void PutText(String s, const Arg::bottomLeft_ bottomLeft) { SIV3D_ENGINE(Print)->put(std::move(s), *bottomLeft, 7); } + + void PutText(const char32* s, const Arg::leftCenter_ leftCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *leftCenter, 8); + } + + void PutText(const StringView s, const Arg::leftCenter_ leftCenter) + { + SIV3D_ENGINE(Print)->put(String{ s }, *leftCenter, 8); + } + void PutText(String s, const Arg::leftCenter_ leftCenter) { SIV3D_ENGINE(Print)->put(std::move(s), *leftCenter, 8); } + + void PutText(const char32* s, const Arg::center_ center) + { + SIV3D_ENGINE(Print)->put(String{ s }, *center, 0); + } + + void PutText(const StringView s, const Arg::center_ center) + { + SIV3D_ENGINE(Print)->put(String{ s }, *center, 0); + } + void PutText(String s, const Arg::center_ center) { SIV3D_ENGINE(Print)->put(std::move(s), *center, 0);