MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_draw_option_2d.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_DRAW_OPTION_2D_H_1606841963
12#define INCGUARD_MGL_DRAW_OPTION_2D_H_1606841963
13
18
19namespace MGL::Render
20{
23{
24public:
25 /* ------------------------------------------------------------------------- */
29 /* ------------------------------------------------------------------------- */
30 constexpr DrawOption2D() noexcept = default;
31
32 /* ------------------------------------------------------------------------- */
36 /* ------------------------------------------------------------------------- */
37 constexpr void Reset() noexcept
38 {
39 *this = {};
40 }
41
42 /* ------------------------------------------------------------------------- */
47 /* ------------------------------------------------------------------------- */
48 constexpr void SetAlignment(const Alignment &alignment) noexcept { _alignment = alignment; }
49
50 /* ------------------------------------------------------------------------- */
55 /* ------------------------------------------------------------------------- */
56 [[nodiscard]] constexpr const Alignment &GetAlignment() const noexcept { return _alignment; }
57
58 /* ------------------------------------------------------------------------- */
63 /* ------------------------------------------------------------------------- */
64 constexpr void SetOffset(const Vector2 &offset) noexcept { _offset = offset; }
65
66 /* ------------------------------------------------------------------------- */
71 /* ------------------------------------------------------------------------- */
72 [[nodiscard]] constexpr const Vector2 &GetOffset() const noexcept { return _offset; }
73
74 /* ------------------------------------------------------------------------- */
79 /* ------------------------------------------------------------------------- */
80 constexpr void SetScale(const Vector2 &scale) noexcept { _scale = scale; }
81
82 /* ------------------------------------------------------------------------- */
87 /* ------------------------------------------------------------------------- */
88 [[nodiscard]] constexpr const Vector2 &GetScale() const noexcept { return _scale; }
89
90 /* ------------------------------------------------------------------------- */
95 /* ------------------------------------------------------------------------- */
96 constexpr void SetRotate(float degreeRotate) noexcept { _degreeRotate = degreeRotate; }
97
98 /* ------------------------------------------------------------------------- */
103 /* ------------------------------------------------------------------------- */
104 [[nodiscard]] constexpr float GetRotate() const noexcept { return _degreeRotate; }
105
106 /* ------------------------------------------------------------------------- */
112 /* ------------------------------------------------------------------------- */
113 constexpr void SetFlip(bool isHorizontalFlip, bool isVerticalFlip) noexcept
114 {
115 _isVerticalFlip = isVerticalFlip;
116 _isHorizontalFlip = isHorizontalFlip;
117 }
118
119 /* ------------------------------------------------------------------------- */
124 /* ------------------------------------------------------------------------- */
125 [[nodiscard]] constexpr bool IsVerticalFlip() const noexcept { return _isVerticalFlip; }
126
127 /* ------------------------------------------------------------------------- */
132 /* ------------------------------------------------------------------------- */
133 [[nodiscard]] constexpr bool IsHorizontalFlip() const noexcept { return _isHorizontalFlip; }
134
135 /* ------------------------------------------------------------------------- */
140 /* ------------------------------------------------------------------------- */
141 constexpr void SetPivot(const MGL::Vector2 &pivot) noexcept { _pivot = pivot; }
142
143 /* ------------------------------------------------------------------------- */
148 /* ------------------------------------------------------------------------- */
149 [[nodiscard]] constexpr const MGL::Vector2 &GetPivot() const noexcept { return _pivot; }
150
151 /* ------------------------------------------------------------------------- */
156 /* ------------------------------------------------------------------------- */
157 constexpr void SetMaskColor(const Color &color) noexcept { _maskColor = color; }
158
159 /* ------------------------------------------------------------------------- */
164 /* ------------------------------------------------------------------------- */
165 [[nodiscard]] constexpr const Color &GetMaskColor() const noexcept { return _maskColor; }
166
167 /* ------------------------------------------------------------------------- */
172 /* ------------------------------------------------------------------------- */
173 constexpr void SetTransparency(float transparency) noexcept { _maskColor.alpha = transparency; }
174
175 /* ------------------------------------------------------------------------- */
180 /* ------------------------------------------------------------------------- */
181 [[nodiscard]] constexpr float GetTransparency() const noexcept { return _maskColor.alpha; }
182
183 /* ------------------------------------------------------------------------- */
188 /* ------------------------------------------------------------------------- */
189 constexpr void SetSamplerType(SamplerType sampler) noexcept { _samplerType = sampler; }
190
191 /* ------------------------------------------------------------------------- */
196 /* ------------------------------------------------------------------------- */
197 [[nodiscard]] constexpr SamplerType GetSamplerType() const noexcept { return _samplerType; }
198
199 /* ------------------------------------------------------------------------- */
204 /* ------------------------------------------------------------------------- */
205 constexpr void SetBlendMode(BlendMode blendMode) noexcept { _blendMode = blendMode; }
206
207 /* ------------------------------------------------------------------------- */
212 /* ------------------------------------------------------------------------- */
213 [[nodiscard]] constexpr BlendMode GetBlendMode() const noexcept { return _blendMode; }
214
215private:
216 Alignment _alignment{kAlignmentTopLeft};
217 Vector2 _offset{0.0f, 0.0f};
218 Vector2 _scale{1.0f, 1.0f};
219 float _degreeRotate{0.0f};
220 bool _isVerticalFlip{false};
221 bool _isHorizontalFlip{false};
222 MGL::Vector2 _pivot{0.5f, 0.5f};
223 Color _maskColor{1.0f, 1.0f, 1.0f, 1.0f};
224 SamplerType _samplerType{SamplerType::Nearest};
225 BlendMode _blendMode{BlendMode::Alpha};
226};
227} // namespace MGL::Render
228
229#endif // INCGUARD_MGL_DRAW_OPTION_2D_H_1606841963
230
231// vim: et ts=4 sw=4 sts=4
2D描画オプション
Definition mgl_draw_option_2d.h:23
constexpr bool IsVerticalFlip() const noexcept
垂直方向のフリップ設定の取得
Definition mgl_draw_option_2d.h:125
constexpr DrawOption2D() noexcept=default
コンストラクタ
constexpr const Vector2 & GetOffset() const noexcept
オフセットの取得
Definition mgl_draw_option_2d.h:72
constexpr bool IsHorizontalFlip() const noexcept
水平方向のフリップ設定の取得
Definition mgl_draw_option_2d.h:133
constexpr void SetTransparency(float transparency) noexcept
透過値の設定
Definition mgl_draw_option_2d.h:173
constexpr BlendMode GetBlendMode() const noexcept
ブレンドーモードの取得
Definition mgl_draw_option_2d.h:213
constexpr void SetBlendMode(BlendMode blendMode) noexcept
ブレンドーモードの設定
Definition mgl_draw_option_2d.h:205
constexpr const Color & GetMaskColor() const noexcept
マスクカラーの取得
Definition mgl_draw_option_2d.h:165
constexpr float GetTransparency() const noexcept
透過値の取得
Definition mgl_draw_option_2d.h:181
constexpr const Alignment & GetAlignment() const noexcept
配置情報を取得
Definition mgl_draw_option_2d.h:56
constexpr void SetFlip(bool isHorizontalFlip, bool isVerticalFlip) noexcept
フリップの設定
Definition mgl_draw_option_2d.h:113
constexpr float GetRotate() const noexcept
回転角度の取得
Definition mgl_draw_option_2d.h:104
constexpr void SetOffset(const Vector2 &offset) noexcept
オフセットの設定
Definition mgl_draw_option_2d.h:64
constexpr void SetPivot(const MGL::Vector2 &pivot) noexcept
回転ピボットの設定
Definition mgl_draw_option_2d.h:141
constexpr void SetScale(const Vector2 &scale) noexcept
スケール値の設定
Definition mgl_draw_option_2d.h:80
constexpr SamplerType GetSamplerType() const noexcept
サンプラーの取得
Definition mgl_draw_option_2d.h:197
constexpr void SetSamplerType(SamplerType sampler) noexcept
サンプラーの設定
Definition mgl_draw_option_2d.h:189
constexpr const MGL::Vector2 & GetPivot() const noexcept
回転ピボットの取得
Definition mgl_draw_option_2d.h:149
constexpr void SetMaskColor(const Color &color) noexcept
マスクカラーの設定
Definition mgl_draw_option_2d.h:157
constexpr const Vector2 & GetScale() const noexcept
スケール値の取得
Definition mgl_draw_option_2d.h:88
constexpr void Reset() noexcept
初期化
Definition mgl_draw_option_2d.h:37
constexpr void SetRotate(float degreeRotate) noexcept
回転角度の設定
Definition mgl_draw_option_2d.h:96
constexpr void SetAlignment(const Alignment &alignment) noexcept
配置情報を設定
Definition mgl_draw_option_2d.h:48
MGL 配置情報
constexpr auto kAlignmentTopLeft
左上
Definition mgl_alignment.h:164
MGL 色情報
MGL 描画関連の定義
BlendMode
ブレンドモード
Definition mgl_render_types.h:67
SamplerType
サンプラー
Definition mgl_render_types.h:59
MGL 2Dベクトル
配置情報
Definition mgl_alignment.h:21
色情報
Definition mgl_color.h:22
float alpha
アルファ値
Definition mgl_color.h:26
2Dベクトル
Definition mgl_vector2.h:23