载入中...
搜索中...
未找到
DrawJagged.hpp
浏览该文件的文档.
1/*#######################################################################################
2 Copyright (c) 2017-2019 Kasugaccho
3 Copyright (c) 2018-2019 As Project
4 https://github.com/Kasugaccho/DungeonTemplateLibrary
5 wanotaitei@gmail.com
6
7 Distributed under the Boost Software License, Version 1.0. (See accompanying
8 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9#######################################################################################*/
10#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_UTILITY_DRAW_JAGGED_HPP
11#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_UTILITY_DRAW_JAGGED_HPP
12
14
15#include <DTL/Macros/constexpr.hpp>
16#include <DTL/Type/Forward.hpp>
17#include <DTL/Type/SizeT.hpp>
18#include <DTL/Utility/MatrixWrapper.hpp>
19
20/*#######################################################################################
21 [概要] "dtl名前空間"とは"DungeonTemplateLibrary"の全ての機能が含まれる名前空間である。
22 [Summary] The "dtl" is a namespace that contains all the functions of "DungeonTemplateLibrary".
23#######################################################################################*/
24namespace dtl {
25 inline namespace utility { //"dtl::utility"名前空間に属する
26
27 template<typename Derived, typename Matrix_Var_, typename Return_Var_ = bool>
28 class DrawJagged {
29 private:
30
32
33 using Index_Size = ::dtl::type::size;
34
35
36 public:
37
39
40/*#######################################################################################
41 [概要] Matrixに描画する。
42 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
43 [Summary] Draw on Matrix.
44 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
45#######################################################################################*/
46 template<typename Matrix_, typename... Args>
47 constexpr Return_Var_ draw(Matrix_& matrix_, Args&& ... args) const noexcept {
48 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...));
49 }
50
51/*#######################################################################################
52 [概要] Matrixに描画する。
53 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
54 [Summary] Draw on Matrix.
55 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
56#######################################################################################*/
57 template<typename Matrix_, typename... Args>
58 constexpr Return_Var_ redraw(const Matrix_Var_& init_value_, Matrix_ & matrix_, Args&& ... args) const noexcept {
59 return static_cast<const Derived*>(this)->redrawNormal(init_value_, ::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...));
60 }
61
62/*#######################################################################################
63 [概要] Matrixに描画する。
64 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
65 [Summary] Draw on Matrix.
66 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
67#######################################################################################*/
68 template<typename Matrix_, typename... Args>
69 constexpr Return_Var_ drawAdd(Matrix_& matrix_, Args&& ... args) const noexcept {
70 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...), 0, 0, 0, 0);
71 }
72
73/*#######################################################################################
74 [概要] Matrixに描画する。
75 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
76 [Summary] Draw on Matrix.
77 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
78 #######################################################################################*/
79 template<typename Matrix_, typename Matrix2_, typename... Args>
80 constexpr Return_Var_ drawOther(Matrix_& matrix_, Matrix2_& matrix2_, Args&& ... args) const noexcept {
81 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...), ::dtl::utility::makeWrapper<Matrix_Var_>(matrix2_, DTL_TYPE_FORWARD<Args>(args)...)
82 , Matrix_Var_{}, 0, 0, 0, 0); //10*4 Copy
83 }
84
85/*#######################################################################################
86 [概要] Matrixに描画する。
87 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
88 [Summary] Draw on Matrix.
89 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
90 #######################################################################################*/
91 template<typename Matrix_Var2_, typename Matrix_, typename Matrix2_, typename... Args>
92 constexpr Return_Var_ drawOther(Matrix_& matrix_, Matrix2_& matrix2_, Args&& ... args) const noexcept {
93 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...), ::dtl::utility::makeWrapper<Matrix_Var2_>(matrix2_, DTL_TYPE_FORWARD<Args>(args)...)
94 , Matrix_Var2_{}, 0, 0, 0, 0); //10*4 Copy
95 }
96
97/*#######################################################################################
98 [概要] Matrixに描画する。
99 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
100 [Summary] Draw on Matrix.
101 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
102#######################################################################################*/
103 template<typename Matrix_, typename Function_, typename... Args>
104 constexpr Return_Var_ drawOperator(Matrix_ & matrix_, Function_ && function_, Args&& ... args) const noexcept {
105 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...), function_);
106 }
107
108 // Upstream DTL calls drawOperatorArray from createOperatorArray but never defines it.
109 // Apple Clang diagnoses the missing member while parsing CRTP bases; provide the
110 // array-bounds overload to match drawArray / Binarization-style APIs.
111 template<typename Matrix_, typename Function_>
112 constexpr Return_Var_ drawOperatorArray(Matrix_& matrix_, const Index_Size max_x_,
113 const Index_Size max_y_, Function_&& function_) const noexcept {
114 return static_cast<const Derived*>(this)->drawNormal(
115 ::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, max_x_, max_y_), function_);
116 }
117
118/*#######################################################################################
119 [概要] Matrixに描画する。
120 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
121 [Summary] Draw on Matrix.
122 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
123 #######################################################################################*/
124 template<typename Matrix_, typename Function_, typename... Args>
125 constexpr Return_Var_ drawFunction(Matrix_& matrix_, Function_&& function_, Args&& ... args) const noexcept {
126 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...), function_, 0, 0, 0, 0);
127 }
128
129/*#######################################################################################
130 [概要] Matrixに描画する。
131 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
132 [Summary] Draw on Matrix.
133 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
134 #######################################################################################*/
135 template<typename Matrix_, typename Function_, typename... Args>
136 constexpr Return_Var_ drawAddOperator(Matrix_& matrix_, Function_&& function_, Args&& ... args) const noexcept {
137 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, DTL_TYPE_FORWARD<Args>(args)...), function_, 0, 0, 0);
138 }
139
140/*#######################################################################################
141 [概要] Matrixに描画する。
142 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
143 [Summary] Draw on Matrix.
144 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
145#######################################################################################*/
146 template<typename Matrix_>
147 constexpr Return_Var_ drawArray(Matrix_ & matrix_, const Index_Size max_x_, const Index_Size max_y_) const noexcept {
148 return static_cast<const Derived*>(this)->drawNormal(::dtl::utility::makeWrapper<Matrix_Var_>(matrix_, max_x_, max_y_));
149 }
150
152
153/*#######################################################################################
154 [概要] Matrixに描画する。
155 [戻り値] 戻り値の型は bool である。[ true : 描画に成功したことを示す / false : 描画に失敗したことを示す ]
156 [Summary] Draw on Matrix.
157 [Return value] The return type is bool. [ true: Drawing was successful. / false: Drawing failed. ]
158#######################################################################################*/
159 template<typename Matrix_, typename ...Args_>
160 constexpr Return_Var_ operator()(Matrix_& matrix_, Args_&& ... args_) const noexcept {
161 return this->draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
162 }
163
164
166
167/*#######################################################################################
168 [概要] Matrixに描画する。
169 [戻り値] 戻り値の型は 引数として渡されたMatrixの型(Matrix_型) である。
170 [Summary] Draw on Matrix.
171 [Return value] The return type is Matrix type of argument.
172#######################################################################################*/
173 template<typename Matrix_, typename ...Args_>
174 DTL_VERSIONING_CPP14_CONSTEXPR
175 Matrix_&& create(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
176 this->draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
177 return DTL_TYPE_FORWARD<Matrix_>(matrix_);
178 }
179
180/*#######################################################################################
181 [概要] Matrixに描画する。
182 [戻り値] 戻り値の型は 引数として渡されたMatrixの型(Matrix_型) である。
183 [Summary] Draw on Matrix.
184 [Return value] The return type is Matrix type of argument.
185#######################################################################################*/
186 template<typename Matrix_, typename ...Args_>
187 DTL_VERSIONING_CPP14_CONSTEXPR
188 Matrix_&& createArray(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
189 this->drawArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
190 return DTL_TYPE_FORWARD<Matrix_>(matrix_);
191 }
192
193/*#######################################################################################
194 [概要] Matrixに描画する。
195 [戻り値] 戻り値の型は 引数として渡されたMatrixの型(Matrix_型) である。
196 [Summary] Draw on Matrix.
197 [Return value] The return type is Matrix type of argument.
198#######################################################################################*/
199 template<typename Matrix_, typename ...Args_>
200 DTL_VERSIONING_CPP14_CONSTEXPR
201 Matrix_&& createOperator(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
202 this->drawOperator(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
203 return DTL_TYPE_FORWARD<Matrix_>(matrix_);
204 }
205
206/*#######################################################################################
207 [概要] Matrixに描画する。
208 [戻り値] 戻り値の型は 引数として渡されたMatrixの型(Matrix_型) である。
209 [Summary] Draw on Matrix.
210 [Return value] The return type is Matrix type of argument.
211#######################################################################################*/
212 template<typename Matrix_, typename ...Args_>
213 DTL_VERSIONING_CPP14_CONSTEXPR
214 Matrix_&& createOperatorArray(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
215 this->drawOperatorArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
216 return DTL_TYPE_FORWARD<Matrix_>(matrix_);
217 }
218 };
219 }
220}
221
222#endif //Included Dungeon Template Library
constexpr Return_Var_ drawOperatorArray(Matrix_ &matrix_, const Index_Size max_x_, const Index_Size max_y_, Function_ &&function_) const noexcept
constexpr Return_Var_ drawOther(Matrix_ &matrix_, Matrix2_ &matrix2_, Args &&... args) const noexcept
constexpr Return_Var_ drawOther(Matrix_ &matrix_, Matrix2_ &matrix2_, Args &&... args) const noexcept
DTL_VERSIONING_CPP14_CONSTEXPR Matrix_ && create(Matrix_ &&matrix_, Args_ &&... args_) const noexcept
constexpr Return_Var_ drawArray(Matrix_ &matrix_, const Index_Size max_x_, const Index_Size max_y_) const noexcept
constexpr Return_Var_ operator()(Matrix_ &matrix_, Args_ &&... args_) const noexcept
constexpr Return_Var_ drawFunction(Matrix_ &matrix_, Function_ &&function_, Args &&... args) const noexcept
constexpr Return_Var_ drawAdd(Matrix_ &matrix_, Args &&... args) const noexcept
DTL_VERSIONING_CPP14_CONSTEXPR Matrix_ && createOperator(Matrix_ &&matrix_, Args_ &&... args_) const noexcept
constexpr Return_Var_ draw(Matrix_ &matrix_, Args &&... args) const noexcept
DTL_VERSIONING_CPP14_CONSTEXPR Matrix_ && createOperatorArray(Matrix_ &&matrix_, Args_ &&... args_) const noexcept
constexpr Return_Var_ drawAddOperator(Matrix_ &matrix_, Function_ &&function_, Args &&... args) const noexcept
DTL_VERSIONING_CPP14_CONSTEXPR Matrix_ && createArray(Matrix_ &&matrix_, Args_ &&... args_) const noexcept
constexpr Return_Var_ redraw(const Matrix_Var_ &init_value_, Matrix_ &matrix_, Args &&... args) const noexcept
constexpr Return_Var_ drawOperator(Matrix_ &matrix_, Function_ &&function_, Args &&... args) const noexcept