-
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathRandomRect.hpp
More file actions
542 lines (481 loc) · 26.3 KB
/
RandomRect.hpp
File metadata and controls
542 lines (481 loc) · 26.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
/*#######################################################################################
Copyright (c) 2017-2019 Kasugaccho
Copyright (c) 2018-2019 As Project
https://github.com/Kasugaccho/DungeonTemplateLibrary
wanotaitei@gmail.com
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#######################################################################################*/
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_SHAPE_RANDOM_RECT_HPP
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_SHAPE_RANDOM_RECT_HPP
/*#######################################################################################
日本語リファレンス (Reference-JP)
https://github.com/Kasugaccho/DungeonTemplateLibrary/wiki/dtl::shape::RandomRect-(形状クラス)/
#######################################################################################*/
#include <DTL/Base/Struct.hpp>
#include <DTL/Macros/constexpr.hpp>
#include <DTL/Macros/nodiscard.hpp>
#include <DTL/Random/RandomEngine.hpp>
#include <DTL/Type/Forward.hpp>
#include <DTL/Type/SizeT.hpp>
/*#######################################################################################
[概要] "dtl名前空間"とは"DungeonTemplateLibrary"の全ての機能が含まれる名前空間である。
[Summary] The "dtl" is a namespace that contains all the functions of "DungeonTemplateLibrary".
#######################################################################################*/
namespace dtl {
inline namespace shape { //"dtl::shape"名前空間に属する
//マスを指定した数値で埋める
template<typename Matrix_Var_>
class RandomRect {
private:
///// エイリアス (Alias) /////
using Index_Size = ::dtl::type::size;
///// メンバ変数 (Member Variable) /////
Index_Size start_x{};
Index_Size start_y{};
Index_Size width{};
Index_Size height{};
Matrix_Var_ draw_value{};
double probability_value{ 0.5 };
///// 代入処理 /////
template<typename Matrix_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignSTL(Matrix_&& matrix_, const Index_Size end_x_, const Index_Size end_y_) const noexcept {
if (DTL_RANDOM_ENGINE.probability(probability_value)) matrix_[end_y_][end_x_] = this->draw_value;
}
template<typename Matrix_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignArray(Matrix_&& matrix_, const Index_Size end_x_, const Index_Size end_y_, const Index_Size max_x_) const noexcept {
if (DTL_RANDOM_ENGINE.probability(probability_value)) matrix_[end_y_ * max_x_ + end_x_] = this->draw_value;
}
template<typename Matrix_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignLayer(Matrix_&& matrix_, const Index_Size layer_, const Index_Size end_x_, const Index_Size end_y_) const noexcept {
if (DTL_RANDOM_ENGINE.probability(probability_value)) matrix_[end_y_][end_x_][layer_] = this->draw_value;
}
template<typename Matrix_Value_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignList(Matrix_Value_&& matrix_) const noexcept {
if (DTL_RANDOM_ENGINE.probability(probability_value)) matrix_ = this->draw_value;
}
template<typename Matrix_, typename Function_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignSTL(Matrix_&& matrix_, const Index_Size end_x_, const Index_Size end_y_, Function_&& function_) const noexcept {
if (function_(matrix_[end_y_][end_x_]) && DTL_RANDOM_ENGINE.probability(probability_value)) matrix_[end_y_][end_x_] = this->draw_value;
}
template<typename Matrix_, typename Function_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignArray(Matrix_&& matrix_, const Index_Size end_x_, const Index_Size end_y_, const Index_Size max_x_, Function_&& function_) const noexcept {
if (function_(matrix_[end_y_ * max_x_ + end_x_]) && DTL_RANDOM_ENGINE.probability(probability_value)) matrix_[end_y_ * max_x_ + end_x_] = this->draw_value;
}
template<typename Matrix_, typename Function_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignLayer(Matrix_ && matrix_, const Index_Size layer_, const Index_Size end_x_, const Index_Size end_y_, Function_ && function_) const noexcept {
if (function_(matrix_[end_y_][end_x_][layer_]) && DTL_RANDOM_ENGINE.probability(probability_value)) matrix_[end_y_][end_x_][layer_] = this->draw_value;
}
template<typename Matrix_Value_, typename Function_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void assignList(Matrix_Value_&& matrix_, Function_&& function_) const noexcept {
if (function_(matrix_) && DTL_RANDOM_ENGINE.probability(probability_value)) matrix_ = this->draw_value;
}
///// 基本処理 /////
//STL
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawSTL(Matrix_ && matrix_, const Index_Size end_y_, Args_ && ... args_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row)
for (Index_Size col{ this->start_x }; col < matrix_[row].size(); ++col)
this->assignSTL(matrix_, col, row, args_...);
return true;
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawWidthSTL(Matrix_ && matrix_, const Index_Size end_x_, const Index_Size end_y_, Args_ && ... args_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row)
for (Index_Size col{ this->start_x }; col < matrix_[row].size() && col < end_x_; ++col)
this->assignSTL(matrix_, col, row, args_...);
return true;
}
//LayerSTL
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawLayerSTL(Matrix_ && matrix_, const Index_Size layer_, const Index_Size end_y_, Args_ && ... args_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row)
for (Index_Size col{ this->start_x }; col < matrix_[row].size(); ++col)
this->assignLayer(matrix_, layer_, col, row, args_...);
return true;
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawLayerWidthSTL(Matrix_ && matrix_, const Index_Size layer_, const Index_Size end_x_, const Index_Size end_y_, Args_ && ... args_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row)
for (Index_Size col{ this->start_x }; col < matrix_[row].size() && col < end_x_; ++col)
this->assignLayer(matrix_, layer_, col, row, args_...);
return true;
}
//Normal
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawNormal(Matrix_ && matrix_, const Index_Size end_x_, const Index_Size end_y_, Args_ && ... args_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row)
for (Index_Size col{ this->start_x }; col < end_x_; ++col)
this->assignSTL(matrix_, col, row, args_...);
return true;
}
//LayerNormal
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawLayerNormal(Matrix_ && matrix_, const Index_Size layer_, const Index_Size end_x_, const Index_Size end_y_, Args_ && ... args_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row)
for (Index_Size col{ this->start_x }; col < end_x_; ++col)
this->assignLayer(matrix_, layer_, col, row, args_...);
return true;
}
//Array
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawArray(Matrix_ && matrix_, const Index_Size end_x_, const Index_Size end_y_, const Index_Size max_x_, Args_ && ... args_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row)
for (Index_Size col{ this->start_x }; col < end_x_; ++col)
this->assignArray(matrix_, col, row, max_x_, args_...);
return true;
}
//List
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawList(Matrix_&& matrix_, const Index_Size end_x_, const Index_Size end_y_, Args_&& ... args_) const noexcept {
::dtl::type::size row_count{}, col_count{};
for (auto&& row : matrix_) {
++row_count;
if (row_count <= this->start_y) continue;
if (end_y_ != 1 && row_count >= end_y_) break;
col_count = 0;
for (auto&& col : row) {
++col_count;
if (col_count <= this->start_x) continue;
if (end_x_ != 1 && col_count >= end_x_) break;
this->assignList(col, args_...);
}
}
return true;
}
public:
///// メンバ変数の値を取得 (Get Value) /////
/*#######################################################################################
[概要] 描画始点座標Xを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing start point coordinate X.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getPointX() const noexcept {
return this->start_x;
}
/*#######################################################################################
[概要] 描画始点座標Yを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing start point coordinate Y.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getPointY() const noexcept {
return this->start_y;
}
/*#######################################################################################
[概要] 描画横幅Wを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing width.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getWidth() const noexcept {
return this->width;
}
/*#######################################################################################
[概要] 描画縦幅Hを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing height.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getHeight() const noexcept {
return this->height;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getValue() const noexcept {
return this->draw_value;
}
///// 生成呼び出し (Drawing Function Call) /////
//STL
template<typename Matrix_>
constexpr bool draw(Matrix_ && matrix_) const noexcept {
return (this->width == 0) ? this->drawSTL(DTL_TYPE_FORWARD<Matrix_>(matrix_), (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height) : this->drawWidthSTL(matrix_, this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height);
}
template<typename Matrix_, typename Function_>
constexpr bool drawOperator(Matrix_ && matrix_, Function_ && function_) const noexcept {
return (this->width == 0) ? this->drawSTL(DTL_TYPE_FORWARD<Matrix_>(matrix_), (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, function_) : this->drawWidthSTL(matrix_, this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, function_);
}
//LayerSTL
template<typename Matrix_>
constexpr bool draw(Matrix_ && matrix_, const Index_Size layer_) const noexcept {
return (this->width == 0) ? this->drawLayerSTL(DTL_TYPE_FORWARD<Matrix_>(matrix_), layer_, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height) : this->drawLayerWidthSTL(matrix_, layer_, this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height);
}
template<typename Matrix_, typename Function_>
constexpr bool drawOperator(Matrix_ && matrix_, const Index_Size layer_, Function_ && function_) const noexcept {
return (this->width == 0) ? this->drawLayerSTL(DTL_TYPE_FORWARD<Matrix_>(matrix_), layer_, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, function_) : this->drawLayerWidthSTL(matrix_, layer_, this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, function_);
}
//Normal
template<typename Matrix_>
constexpr bool draw(Matrix_ && matrix_, const Index_Size max_x_, const Index_Size max_y_) const noexcept {
return this->drawNormal(DTL_TYPE_FORWARD<Matrix_>(matrix_), (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height);
}
template<typename Matrix_, typename Function_>
constexpr bool drawOperator(Matrix_ && matrix_, const Index_Size max_x_, const Index_Size max_y_, Function_ && function_) const noexcept {
return this->drawNormal(DTL_TYPE_FORWARD<Matrix_>(matrix_), (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height, function_);
}
//LayerNormal
template<typename Matrix_>
constexpr bool draw(Matrix_ && matrix_, const Index_Size layer_, const Index_Size max_x_, const Index_Size max_y_) const noexcept {
return this->drawLayerNormal(DTL_TYPE_FORWARD<Matrix_>(matrix_), layer_, (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height);
}
template<typename Matrix_, typename Function_>
constexpr bool drawOperator(Matrix_ && matrix_, const Index_Size layer_, const Index_Size max_x_, const Index_Size max_y_, Function_ && function_) const noexcept {
return this->drawLayerNormal(DTL_TYPE_FORWARD<Matrix_>(matrix_), layer_, (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height, function_);
}
//Array
template<typename Matrix_>
constexpr bool drawArray(Matrix_ && matrix_, const Index_Size max_x_, const Index_Size max_y_) const noexcept {
return this->drawArray(DTL_TYPE_FORWARD<Matrix_>(matrix_), (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height, max_x_);
}
template<typename Matrix_, typename Function_>
constexpr bool drawOperatorArray(Matrix_ && matrix_, const Index_Size max_x_, const Index_Size max_y_, Function_ && function_) const noexcept {
return this->drawArray(DTL_TYPE_FORWARD<Matrix_>(matrix_), (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height, max_x_, function_);
}
//List
template<typename Matrix_>
constexpr bool drawList(Matrix_&& matrix_) const noexcept {
return this->drawList(DTL_TYPE_FORWARD<Matrix_>(matrix_), this->start_x + this->width + 1, this->start_y + this->height + 1);
}
template<typename Matrix_, typename Function_>
constexpr bool drawOperatorList(Matrix_ && matrix_, Function_ && function_) const noexcept {
return this->drawList(DTL_TYPE_FORWARD<Matrix_>(matrix_), this->start_x + this->width + 1, this->start_y + this->height + 1, function_);
}
///// 生成呼び出しファンクタ (Drawing Functor) /////
template<typename Matrix_, typename ...Args_>
constexpr bool operator()(Matrix_&& matrix_, Args_&& ... args_) const noexcept {
return this->draw(DTL_TYPE_FORWARD<Matrix_>(matrix_), DTL_TYPE_FORWARD<Args_>(args_)...);
}
///// ダンジョン行列生成 (Create Dungeon Matrix) /////
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& create(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
this->draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& createArray(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
this->drawArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& createOperator(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
this->drawOperator(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& createOperatorArray(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
this->drawOperatorArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
///// 消去 (Clear) /////
/*#######################################################################################
[概要] 描画始点座標Xを初期値に戻す(描画始点座標Xを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate X to the initial value (deletes the drawing start coordinate X).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clearPointX() noexcept {
this->start_x = 0;
return *this;
}
/*#######################################################################################
[概要] 描画始点座標Yを初期値に戻す(描画始点座標Yを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate Y to the initial value (deletes the drawing start coordinate Y).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clearPointY() noexcept {
this->start_y = 0;
return *this;
}
/*#######################################################################################
[概要] 範囲の大きさ(X軸方向)を初期値に戻す(描画横幅Wを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the width of the range (X axis direction) to the initial value (deletes the drawing width).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clearWidth() noexcept {
this->width = 0;
return *this;
}
/*#######################################################################################
[概要] 範囲の大きさ(Y軸方向)を初期値に戻す(描画縦幅Hを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the height of the range (Y axis direction) to the initial value (deletes the drawing height).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clearHeight() noexcept {
this->height = 0;
return *this;
}
/*#######################################################################################
[概要] 塗り値を初期値に戻す(描画値を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing value to the initial value (deletes the drawing value).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clearValue() noexcept {
const Matrix_Var_ new_draw_value{};
this->draw_value = new_draw_value;
return *this;
}
/*#######################################################################################
[概要] 描画始点座標(X,Y)を初期値に戻す(描画始点座標(X,Y)を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate (X, Y) to the initial value (deletes the drawing start coordinate (X, Y)).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clearPoint() noexcept {
this->clearPointX();
this->clearPointY();
return *this;
}
/*#######################################################################################
[概要] 描画範囲を初期値に戻す(描画範囲(X,Y,W,H)を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing range to the initial value (deletes the drawing range (X, Y, W, H)).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clearRange() noexcept {
this->clearPointX();
this->clearPointY();
this->clearWidth();
this->clearHeight();
return *this;
}
/*#######################################################################################
[概要] 全ての値を初期値に戻す。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Reset all values to their initial values.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& clear() noexcept {
this->clearRange();
this->clearValue();
return *this;
}
///// 代入 /////
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setPointX(const Index_Size end_x_) noexcept {
this->start_x = end_x_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setPointY(const Index_Size end_y_) noexcept {
this->start_y = end_y_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setWidth(const Index_Size width_) noexcept {
this->width = width_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setHeight(const Index_Size height_) noexcept {
this->height = height_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setValue(const Matrix_Var_& draw_value_) noexcept {
this->draw_value = draw_value_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setPoint(const Index_Size point_) noexcept {
this->start_x = point_;
this->start_y = point_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setPoint(const Index_Size end_x_, const Index_Size end_y_) noexcept {
this->start_x = end_x_;
this->start_y = end_y_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setRange(const Index_Size end_x_, const Index_Size end_y_, const Index_Size length_) noexcept {
this->start_x = end_x_;
this->start_y = end_y_;
this->width = length_;
this->height = length_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setRange(const Index_Size end_x_, const Index_Size end_y_, const Index_Size width_, const Index_Size height_) noexcept {
this->start_x = end_x_;
this->start_y = end_y_;
this->width = width_;
this->height = height_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
RandomRect& setRange(const ::dtl::base::MatrixRange& matrix_range_) noexcept {
this->start_x = matrix_range_.x;
this->start_y = matrix_range_.y;
this->width = matrix_range_.w;
this->height = matrix_range_.h;
return *this;
}
///// コンストラクタ (Constructor) /////
RandomRect() = default;
constexpr explicit RandomRect(const Matrix_Var_ & draw_value_) noexcept
:draw_value(draw_value_) {}
constexpr RandomRect(const Matrix_Var_ & draw_value_, const double probability_) noexcept
:draw_value(draw_value_), probability_value(probability_) {}
constexpr explicit RandomRect(const ::dtl::base::MatrixRange & matrix_range_) noexcept
:start_x(matrix_range_.x), start_y(matrix_range_.y),
width(matrix_range_.w), height(matrix_range_.h) {}
constexpr RandomRect(const ::dtl::base::MatrixRange & matrix_range_, const Matrix_Var_ & draw_value_) noexcept
:start_x(matrix_range_.x), start_y(matrix_range_.y),
width(matrix_range_.w), height(matrix_range_.h),
draw_value(draw_value_) {}
constexpr RandomRect(const ::dtl::base::MatrixRange & matrix_range_, const Matrix_Var_ & draw_value_, const double probability_) noexcept
:start_x(matrix_range_.x), start_y(matrix_range_.y),
width(matrix_range_.w), height(matrix_range_.h),
draw_value(draw_value_), probability_value(probability_) {}
constexpr RandomRect(const Index_Size end_x_, const Index_Size end_y_, const Index_Size width_, const Index_Size height_) noexcept
:start_x(end_x_), start_y(end_y_),
width(width_), height(height_) {}
constexpr RandomRect(const Index_Size end_x_, const Index_Size end_y_, const Index_Size width_, const Index_Size height_, const Matrix_Var_ & draw_value_) noexcept
:start_x(end_x_), start_y(end_y_),
width(width_), height(height_),
draw_value(draw_value_) {}
constexpr RandomRect(const Index_Size end_x_, const Index_Size end_y_, const Index_Size width_, const Index_Size height_, const Matrix_Var_ & draw_value_, const double probability_) noexcept
:start_x(end_x_), start_y(end_y_),
width(width_), height(height_),
draw_value(draw_value_), probability_value(probability_) {}
};
}
}
#endif //Included Dungeon Template Library