mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 15:37:53 -05:00
fix mac build pt 2
This commit is contained in:
parent
bd79f275cc
commit
407ea1ba01
2 changed files with 25 additions and 18 deletions
|
@ -214,16 +214,8 @@ namespace geode {
|
||||||
ValueType getValue() const {
|
ValueType getValue() const {
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
void setValue(ValueType const& value) {
|
GEODE_DLL void setValue(ValueType const& value);
|
||||||
m_value = this->toValid(value).first;
|
GEODE_DLL Result<> validate(ValueType const& value) const;
|
||||||
}
|
|
||||||
Result<> validate(ValueType const& value) const {
|
|
||||||
auto reason = this->toValid(value).second;
|
|
||||||
if (reason.has_value()) {
|
|
||||||
return Err(static_cast<std::string>(reason.value()));
|
|
||||||
}
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using BoolSettingValue = GeodeSettingValue<BoolSetting>;
|
using BoolSettingValue = GeodeSettingValue<BoolSetting>;
|
||||||
|
|
|
@ -223,6 +223,21 @@ std::string SettingValue::getKey() const {
|
||||||
return type_##SettingNode::create(this, width); \
|
return type_##SettingNode::create(this, width); \
|
||||||
} \
|
} \
|
||||||
template<> \
|
template<> \
|
||||||
|
void GeodeSettingValue< \
|
||||||
|
type_##Setting \
|
||||||
|
>::setValue(ValueType const& value) { \
|
||||||
|
m_value = this->toValid(value).first; \
|
||||||
|
} \
|
||||||
|
Result<> GeodeSettingValue< \
|
||||||
|
type_##Setting \
|
||||||
|
>::validate(ValueType const& value) const { \
|
||||||
|
auto reason = this->toValid(value).second; \
|
||||||
|
if (reason.has_value()) { \
|
||||||
|
return Err(static_cast<std::string>(reason.value())); \
|
||||||
|
} \
|
||||||
|
return Ok(); \
|
||||||
|
} \
|
||||||
|
template<> \
|
||||||
typename type_##Setting::ValueType SettingValueSetter< \
|
typename type_##Setting::ValueType SettingValueSetter< \
|
||||||
typename type_##Setting::ValueType \
|
typename type_##Setting::ValueType \
|
||||||
>::get(SettingValue* setting) { \
|
>::get(SettingValue* setting) { \
|
||||||
|
@ -274,14 +289,6 @@ namespace geode {
|
||||||
template class GeodeSettingValue<ColorAlphaSetting>;
|
template class GeodeSettingValue<ColorAlphaSetting>;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_NODE_AND_SETTERS(Bool);
|
|
||||||
IMPL_NODE_AND_SETTERS(Int);
|
|
||||||
IMPL_NODE_AND_SETTERS(Float);
|
|
||||||
IMPL_NODE_AND_SETTERS(String);
|
|
||||||
IMPL_NODE_AND_SETTERS(File);
|
|
||||||
IMPL_NODE_AND_SETTERS(Color);
|
|
||||||
IMPL_NODE_AND_SETTERS(ColorAlpha);
|
|
||||||
|
|
||||||
IMPL_TO_VALID(Bool) {
|
IMPL_TO_VALID(Bool) {
|
||||||
return { value, std::nullopt };
|
return { value, std::nullopt };
|
||||||
}
|
}
|
||||||
|
@ -346,6 +353,14 @@ IMPL_TO_VALID(ColorAlpha) {
|
||||||
return { value, std::nullopt };
|
return { value, std::nullopt };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IMPL_NODE_AND_SETTERS(Bool);
|
||||||
|
IMPL_NODE_AND_SETTERS(Int);
|
||||||
|
IMPL_NODE_AND_SETTERS(Float);
|
||||||
|
IMPL_NODE_AND_SETTERS(String);
|
||||||
|
IMPL_NODE_AND_SETTERS(File);
|
||||||
|
IMPL_NODE_AND_SETTERS(Color);
|
||||||
|
IMPL_NODE_AND_SETTERS(ColorAlpha);
|
||||||
|
|
||||||
// SettingChangedEvent
|
// SettingChangedEvent
|
||||||
|
|
||||||
SettingChangedEvent::SettingChangedEvent(Mod* mod, SettingValue* value)
|
SettingChangedEvent::SettingChangedEvent(Mod* mod, SettingValue* value)
|
||||||
|
|
Loading…
Reference in a new issue