MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_achievement_defs.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_ACHIEVEMENT_DEFS_H_1631073255
12#define INCGUARD_MGL_ACHIEVEMENT_DEFS_H_1631073255
13
14#include <mgl/mgl_environment.h>
15
16#include <cstdint>
17
18// MSVCではどこかでmaxという名前のマクロを定義してしまうらしい
19#if defined(MGL_TARGET_WIN32) && defined(max)
20#undef max
21#endif
22
23namespace MGL::Achievement
24{
26using Identifier = uint32_t;
27
29constexpr Identifier kInvalidIdentifier = 0xFFFFFFFF;
30
32enum class ValueType : uint8_t
33{
34 Boolean,
35 Integer,
37};
38
41{
43 uint32_t max;
44 uint32_t intValue{0};
45 float progressRate{0.0f};
46 bool isAchieved{false};
47 bool isUpdated{false};
48
49 /* ------------------------------------------------------------------------- */
55 /* ------------------------------------------------------------------------- */
56 constexpr AchievementData(ValueType type_, uint32_t max_ = 0) noexcept
57 : type(type_)
58 , max(max_)
59 {
60 }
61};
62
63
66{
69 uint32_t intValue;
72
73 /* ------------------------------------------------------------------------- */
79 /* ------------------------------------------------------------------------- */
80 constexpr TemporaryData(Identifier identifier_, bool isAchieved_) noexcept
81 : identifier(identifier_)
82 , type(ValueType::Boolean)
83 , intValue(0)
84 , isAchieved(isAchieved_)
85 , progressRate(0.0f)
86 {
87 }
88
89 /* ------------------------------------------------------------------------- */
95 /* ------------------------------------------------------------------------- */
96 constexpr TemporaryData(Identifier identifier_, uint32_t value_) noexcept
97 : identifier(identifier_)
98 , type(ValueType::Boolean)
99 , intValue(value_)
100 , isAchieved(false)
101 , progressRate(0.0f)
102 {
103 }
104
105 /* ------------------------------------------------------------------------- */
111 /* ------------------------------------------------------------------------- */
112 constexpr TemporaryData(Identifier identifier_, float progressRate_) noexcept
113 : identifier(identifier_)
114 , type(ValueType::Boolean)
115 , intValue(0)
116 , isAchieved(false)
117 , progressRate(progressRate_)
118 {
119 }
120};
121
122} // namespace MGL::Achievement
123
124#endif // INCGUARD_MGL_ACHIEVEMENT_DEFS_H_1631073255
125
126// vim: et ts=4 sw=4 sts=4
ValueType
値のタイプ
Definition mgl_achievement_defs.h:33
@ Boolean
論理値(解除 or 未解除)
@ ProgressRate
進行率(0.0f から 100.0f)
uint32_t Identifier
実績用の識別子の型
Definition mgl_achievement_defs.h:26
constexpr Identifier kInvalidIdentifier
無効な識別子
Definition mgl_achievement_defs.h:29
MGL 環境定義
実績データ
Definition mgl_achievement_defs.h:41
bool isUpdated
値の更新フラグ
Definition mgl_achievement_defs.h:47
uint32_t intValue
タイプが整数値の場合の現在値
Definition mgl_achievement_defs.h:44
ValueType type
値のタイプ
Definition mgl_achievement_defs.h:42
float progressRate
進行率
Definition mgl_achievement_defs.h:45
constexpr AchievementData(ValueType type_, uint32_t max_=0) noexcept
コンストラクタ
Definition mgl_achievement_defs.h:56
uint32_t max
タイプが整数値の場合の最大値
Definition mgl_achievement_defs.h:43
bool isAchieved
達成済みフラグ
Definition mgl_achievement_defs.h:46
実績用のテンポラリデータ
Definition mgl_achievement_defs.h:66
float progressRate
進行率
Definition mgl_achievement_defs.h:71
ValueType type
値のタイプ
Definition mgl_achievement_defs.h:68
constexpr TemporaryData(Identifier identifier_, bool isAchieved_) noexcept
論理値用コンストラクタ
Definition mgl_achievement_defs.h:80
bool isAchieved
達成済みフラグ
Definition mgl_achievement_defs.h:70
constexpr TemporaryData(Identifier identifier_, uint32_t value_) noexcept
整数値用コンストラクタ
Definition mgl_achievement_defs.h:96
constexpr TemporaryData(Identifier identifier_, float progressRate_) noexcept
達成率用コンストラクタ
Definition mgl_achievement_defs.h:112
uint32_t intValue
現在値(整数値の場合)
Definition mgl_achievement_defs.h:69
Identifier identifier
識別子
Definition mgl_achievement_defs.h:67