-
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathRectBaseWithValueXYRA.hpp
More file actions
249 lines (205 loc) · 11.6 KB
/
RectBaseWithValueXYRA.hpp
File metadata and controls
249 lines (205 loc) · 11.6 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
/*#######################################################################################
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_RANGE_RECT_BASE_WITH_VALUE_XYRA_HPP
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_RANGE_RECT_BASE_WITH_VALUE_XYRA_HPP
#include <DTL/Base/Struct.hpp>
#include <DTL/Macros/constexpr.hpp>
#include <DTL/Macros/nodiscard.hpp>
#include <DTL/Type/SizeT.hpp>
#include <DTL/Range/BasicRect.hpp>
/*#######################################################################################
[概要] "dtl名前空間"とは"DungeonTemplateLibrary"の全ての機能が含まれる名前空間である。
[Summary] The "dtl" is a namespace that contains all the functions of "DungeonTemplateLibrary".
#######################################################################################*/
namespace dtl {
inline namespace range { //"dtl::range"名前空間に属する
//四角形クラス
template<typename Derived_, typename Matrix_Var_, Matrix_Var_ matrix_value_ = Matrix_Var_{}
, ::dtl::type::size default_max_value_ = 0, ::dtl::type::size default_min_value_ = 0 >
class RectBaseWithValueXYRA : public ::dtl::range::BasicRect<Derived_> {
private:
///// エイリアス (Alias) /////
using Index_Size = ::dtl::type::size;
using RectBase_t = ::dtl::range::BasicRect<Derived_>;
protected:
///// メンバ変数 (Member Variable) /////
Matrix_Var_ draw_value{ matrix_value_ };
Index_Size position_x{ default_max_value_ };
Index_Size position_y{ default_min_value_ };
Index_Size position_r{};
double angle{};
public:
///// メンバ変数の値を取得 (Get Value) /////
/*#######################################################################################
[概要] 描画値を取得する。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[参考ページ] https://github.com/Kasugaccho/DungeonTemplateLibrary/wiki/dtl::XX::YY::getValue-(形状描画)/
[Summary] Gets the drawing value.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
template<typename Matrix_Int1_>
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& getValue(Matrix_Int1_& value_) noexcept {
value_ = static_cast<Matrix_Int1_>(this->draw_value);
return static_cast<Derived_&>(*this);
}
template<typename Matrix_Int1_>
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& getDrawValue(Matrix_Int1_& value_) noexcept {
value_ = static_cast<Matrix_Int1_>(this->draw_value);
return static_cast<Derived_&>(*this);
}
template<typename Matrix_Int1_>
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& getMaxValue(Matrix_Int1_& value_) noexcept {
value_ = static_cast<Matrix_Int1_>(this->position_x);
return static_cast<Derived_&>(*this);
}
template<typename Matrix_Int1_>
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& getMinValue(Matrix_Int1_& value_) noexcept {
value_ = static_cast<Matrix_Int1_>(this->position_y);
return static_cast<Derived_&>(*this);
}
/*#######################################################################################
[概要] 描画値を取得する。
[戻り値] 戻り値の型は Matrix_Var_ である。
[参考ページ] https://github.com/Kasugaccho/DungeonTemplateLibrary/wiki/dtl::XX::YY::getValue-(形状描画)/
[Summary] Gets the drawing value.
[Return value] The return type is Matrix_Var_.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getValue() const noexcept {
return this->draw_value;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getDrawValue() const noexcept {
return this->draw_value;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getMaxValue() const noexcept {
return this->position_x;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getMinValue() const noexcept {
return this->position_y;
}
///// 消去 (Clear) /////
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearDrawValue() noexcept {
const Matrix_Var_ new_draw_value{};
this->draw_value = new_draw_value;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearMaxValue() noexcept {
const Matrix_Var_ new_draw_value{};
this->position_x = new_draw_value;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearMinValue() noexcept {
const Matrix_Var_ new_draw_value{};
this->position_y = new_draw_value;
return static_cast<Derived_&>(*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
Derived_& clearValue() noexcept {
this->clearDrawValue();
this->clearMaxValue();
this->clearMinValue();
return static_cast<Derived_&>(*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
Derived_& clear() noexcept {
this->clearRange();
this->clearValue();
return static_cast<Derived_&>(*this);
}
///// 代入 /////
/*#######################################################################################
[概要] 描画値を設定する。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Set the drawing value.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setValue(const Matrix_Var_& draw_value_) noexcept {
this->draw_value = draw_value_;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setDrawValue(const Matrix_Var_& draw_value_) noexcept {
this->draw_value = draw_value_;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setMaxValue(const Matrix_Var_& position_x_) noexcept {
this->position_x = position_x_;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setMinValue(const Matrix_Var_& position_y_) noexcept {
this->position_y = position_y_;
return static_cast<Derived_&>(*this);
}
///// コンストラクタ (Constructor) /////
RectBaseWithValueXYRA() = default;
constexpr explicit RectBaseWithValueXYRA(const ::dtl::base::MatrixRange& matrix_range_) noexcept
:RectBase_t(matrix_range_) {}
constexpr explicit RectBaseWithValueXYRA(const Matrix_Var_& draw_value_) noexcept
:draw_value(draw_value_) {}
constexpr RectBaseWithValueXYRA(const ::dtl::base::MatrixRange& matrix_range_, const Matrix_Var_& draw_value_) noexcept
:RectBase_t(matrix_range_),
draw_value(draw_value_) {}
constexpr explicit RectBaseWithValueXYRA(const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_) noexcept
:draw_value(draw_value_), position_x(position_x_) {}
constexpr RectBaseWithValueXYRA(const ::dtl::base::MatrixRange& matrix_range_, const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_) noexcept
:RectBase_t(matrix_range_),
draw_value(draw_value_), position_x(position_x_) {}
constexpr explicit RectBaseWithValueXYRA(const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_) noexcept
:draw_value(draw_value_), position_x(position_x_), position_y(position_y_) {}
constexpr RectBaseWithValueXYRA(const ::dtl::base::MatrixRange& matrix_range_, const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_) noexcept
:RectBase_t(matrix_range_),
draw_value(draw_value_), position_x(position_x_), position_y(position_y_) {}
constexpr RectBaseWithValueXYRA(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
draw_value(draw_value_), position_x(position_x_), position_y(position_y_) {}
constexpr explicit RectBaseWithValueXYRA(const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_, const Index_Size position_r_) noexcept
:draw_value(draw_value_), position_x(position_x_), position_y(position_y_), position_r(position_r_) {}
constexpr RectBaseWithValueXYRA(const ::dtl::base::MatrixRange& matrix_range_, const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_, const Index_Size position_r_) noexcept
:RectBase_t(matrix_range_),
draw_value(draw_value_), position_x(position_x_), position_y(position_y_), position_r(position_r_) {}
constexpr RectBaseWithValueXYRA(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_, const Index_Size position_r_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
draw_value(draw_value_), position_x(position_x_), position_y(position_y_), position_r(position_r_) {}
constexpr explicit RectBaseWithValueXYRA(const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_, const Index_Size position_r_, const double angle_) noexcept
:draw_value(draw_value_), position_x(position_x_), position_y(position_y_), position_r(position_r_), angle(angle_) {}
constexpr RectBaseWithValueXYRA(const ::dtl::base::MatrixRange& matrix_range_, const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_, const Index_Size position_r_, const double angle_) noexcept
:RectBase_t(matrix_range_),
draw_value(draw_value_), position_x(position_x_), position_y(position_y_), position_r(position_r_), angle(angle_) {}
constexpr RectBaseWithValueXYRA(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const Matrix_Var_& draw_value_, const Matrix_Var_& position_x_, const Matrix_Var_& position_y_, const Index_Size position_r_, const double angle_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
draw_value(draw_value_), position_x(position_x_), position_y(position_y_), position_r(position_r_), angle(angle_) {}
};
}
}
#endif //Included Dungeon Template Library