mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-29 10:55:47 -05:00
add platform-specific settings + update changelog and bump version
This commit is contained in:
parent
bf43946daf
commit
b241c1ccda
5 changed files with 39 additions and 21 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,5 +1,15 @@
|
|||
# Geode Changelog
|
||||
|
||||
## v2.0.0-beta.17
|
||||
* Add `$override` macro for syntactic sugar (e7a1913)
|
||||
* Add support for platform-specific setting default values as well as platform-specific settings (9c8fcf1)
|
||||
* Change `cc3bFromHexString` and `cc4bFromHexString` to be more strict with parsing by default (9c8fcf1)
|
||||
* `JsonMaybeValue::is` is now a lot more reasonable (9c8fcf1)
|
||||
* Make `LayoutOptions` also `CCObject` (3b7621c)
|
||||
* Fix RobTop's socials in MenuLayer (cee8c74)
|
||||
* Fix issues in CMake (d574248, 4ddd92d)
|
||||
* Fix input nodes being clickable when invisible (bf32946)
|
||||
|
||||
## v2.0.0-beta.16
|
||||
* Bump minimum CMake version to 3.25
|
||||
* Add support for platform-specific dependencies (30c7d3f)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.0.0-beta.16
|
||||
2.0.0-beta.17
|
|
@ -817,7 +817,7 @@ namespace geode::cocos {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse a ccColor3B from a hexadecimal string. The string may not contain
|
||||
* Parse a ccColor3B from a hexadecimal string. The string may contain
|
||||
* a leading '#'
|
||||
* @param hexValue The string to parse into a color
|
||||
* @param permissive If true, strings like "f" are considered valid
|
||||
|
@ -828,7 +828,7 @@ namespace geode::cocos {
|
|||
*/
|
||||
GEODE_DLL Result<cocos2d::ccColor3B> cc3bFromHexString(std::string const& hexValue, bool permissive = false);
|
||||
/**
|
||||
* Parse a ccColor4B from a hexadecimal string. The string may not contain
|
||||
* Parse a ccColor4B from a hexadecimal string. The string may contain
|
||||
* a leading '#'
|
||||
* @param hexValue The string to parse into a color
|
||||
* @param requireAlpha Require the alpha component to be passed. If false,
|
||||
|
|
|
@ -172,6 +172,20 @@ Result<ModMetadata> ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs
|
|||
}
|
||||
|
||||
for (auto& [key, value] : root.has("settings").items()) {
|
||||
// Skip settings not on this platform
|
||||
if (value.template is<matjson::Object>()) {
|
||||
auto obj = value.obj();
|
||||
bool onThisPlatform = !obj.has("platforms");
|
||||
for (auto& plat : obj.has("platforms").iterate()) {
|
||||
if (PlatformID::from(plat.get<std::string>()) == GEODE_PLATFORM_TARGET) {
|
||||
onThisPlatform = true;
|
||||
}
|
||||
}
|
||||
if (!onThisPlatform) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
GEODE_UNWRAP_INTO(auto sett, Setting::parse(key, impl->m_id, value));
|
||||
impl->m_settings.emplace_back(key, sett);
|
||||
}
|
||||
|
|
|
@ -38,14 +38,7 @@ ccColor3B matjson::Serialize<ccColor3B>::from_json(matjson::Value const& json) {
|
|||
}
|
||||
// hex string
|
||||
else if (json.is_string()) {
|
||||
std::string str = json.as_string();
|
||||
if (str[0] == '#') {
|
||||
str.erase(str.begin());
|
||||
}
|
||||
if (str.size() > 6) {
|
||||
throw matjson::JsonException("Hex string for color too long");
|
||||
}
|
||||
auto c = cc3bFromHexString(str);
|
||||
auto c = cc3bFromHexString(json.as_string());
|
||||
if (!c) {
|
||||
throw matjson::JsonException("Invalid color hex string");
|
||||
}
|
||||
|
@ -94,14 +87,7 @@ ccColor4B matjson::Serialize<ccColor4B>::from_json(matjson::Value const& json) {
|
|||
}
|
||||
// hex string
|
||||
else if (json.is_string()) {
|
||||
std::string str = json.as_string();
|
||||
if (str[0] == '#') {
|
||||
str.erase(str.begin());
|
||||
}
|
||||
if (str.size() > 8) {
|
||||
throw matjson::JsonException("Hex string for color too long");
|
||||
}
|
||||
auto c = cc4bFromHexString(str);
|
||||
auto c = cc4bFromHexString(json.as_string());
|
||||
if (!c) {
|
||||
throw matjson::JsonException("Invalid color hex string: " + c.unwrapErr());
|
||||
}
|
||||
|
@ -114,7 +100,11 @@ ccColor4B matjson::Serialize<ccColor4B>::from_json(matjson::Value const& json) {
|
|||
return color;
|
||||
}
|
||||
|
||||
Result<ccColor3B> geode::cocos::cc3bFromHexString(std::string const& hexValue, bool permissive) {
|
||||
Result<ccColor3B> geode::cocos::cc3bFromHexString(std::string const& rawHexValue, bool permissive) {
|
||||
auto hexValue = rawHexValue;
|
||||
if (hexValue[0] == '#') {
|
||||
hexValue.erase(hexValue.begin());
|
||||
}
|
||||
if (permissive && hexValue.empty()) {
|
||||
return Ok(ccc3(255, 255, 255));
|
||||
}
|
||||
|
@ -168,7 +158,11 @@ Result<ccColor3B> geode::cocos::cc3bFromHexString(std::string const& hexValue, b
|
|||
}
|
||||
}
|
||||
|
||||
Result<ccColor4B> geode::cocos::cc4bFromHexString(std::string const& hexValue, bool requireAlpha, bool permissive) {
|
||||
Result<ccColor4B> geode::cocos::cc4bFromHexString(std::string const& rawHexValue, bool requireAlpha, bool permissive) {
|
||||
auto hexValue = rawHexValue;
|
||||
if (hexValue[0] == '#') {
|
||||
hexValue.erase(hexValue.begin());
|
||||
}
|
||||
if (permissive && hexValue.empty()) {
|
||||
return Ok(ccc4(255, 255, 255, 255));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue