Work resumed
This commit is contained in:
@ -32,6 +32,9 @@ struct Color Color::fromString(std::string str) {
|
||||
|
||||
} else if(stringIncludes(lower, "blue")) {
|
||||
return COLOR_BLUE;
|
||||
|
||||
} else if(stringIncludes(lower, "transparent")) {
|
||||
return COLOR_TRANSPARENT;
|
||||
}
|
||||
|
||||
// Hex code?
|
||||
|
@ -86,5 +86,5 @@ namespace Dawn {
|
||||
#define COLOR_CORNFLOWER_BLUE COLOR_DEF(0.4f, 0.6f, 0.9f, 1.0f)
|
||||
#define COLOR_WHITE_TRANSPARENT COLOR_DEF(1.0f, 1.0f, 1.0f, 0.0f)
|
||||
#define COLOR_BLACK_TRANSPARENT COLOR_DEF(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
#define COLOR_TRANSPARENT COLOR_BLACK_TRANSPARENT
|
||||
#define COLOR_TRANSPARENT COLOR_WHITE_TRANSPARENT
|
||||
}
|
@ -110,7 +110,7 @@ namespace Dawn {
|
||||
// Split string by comma into two strings that we pass into float
|
||||
auto split = stringSplit(v, ",");
|
||||
if(split.size() != 4) {
|
||||
*error = "Invalid vec4 value: " + v;
|
||||
*error = "Invalid vec4 value: " + v + " (incorrect split len " + std::to_string(split.size()) + ")";
|
||||
return std::string("");
|
||||
}
|
||||
return std::string(
|
||||
@ -125,6 +125,28 @@ namespace Dawn {
|
||||
|
||||
static inline std::string colorParser(std::string v, std::string *error) {
|
||||
return "Color::fromString(" + stringParser(v, error) + ")";
|
||||
};
|
||||
|
||||
static inline std::string uiComponentAlignParser(std::string v, std::string *error) {
|
||||
v = stringToLowercase(v);
|
||||
if(v.find("left") != std::string::npos) return "UI_COMPONENT_ALIGN_START";
|
||||
if(v.find("center") != std::string::npos) return "UI_COMPONENT_ALIGN_MIDDLE";
|
||||
if(v.find("right") != std::string::npos) return "UI_COMPONENT_ALIGN_END";
|
||||
if(v.find("top") != std::string::npos) return "UI_COMPONENT_ALIGN_START";
|
||||
if(v.find("bottom") != std::string::npos) return "UI_COMPONENT_ALIGN_END";
|
||||
if(v.find("stretch") != std::string::npos) return "UI_COMPONENT_ALIGN_STRETCH";
|
||||
if(v.find("start") != std::string::npos) return "UI_COMPONENT_ALIGN_START";
|
||||
if(v.find("middle") != std::string::npos) return "UI_COMPONENT_ALIGN_MIDDLE";
|
||||
if(v.find("end") != std::string::npos) return "UI_COMPONENT_ALIGN_END";
|
||||
*error = "Invalid UIComponentAlign value: " + v;
|
||||
}
|
||||
|
||||
static inline std::string uiComponentAlignUnitParser(std::string v, std::string *error) {
|
||||
v = stringToLowercase(v);
|
||||
if(v.find("scale") != std::string::npos) return "UI_COMPONENT_ALIGN_UNIT_SCALE";
|
||||
if(v.find("percent") != std::string::npos) return "UI_COMPONENT_ALIGN_UNIT_PERCENT";
|
||||
if(v.find("ratio") != std::string::npos) return "UI_COMPONENT_ALIGN_UNIT_RATIO";
|
||||
*error = "Invalid UIComponentAlignUnit value: " + v;
|
||||
}
|
||||
|
||||
static inline std::function<std::string(std::string, std::string*)> parserFromTypeName(std::string type) {
|
||||
@ -149,7 +171,14 @@ namespace Dawn {
|
||||
} else if(type == "flag_t") {
|
||||
parser = rawParser;
|
||||
} else if(type.starts_with("enum")) {
|
||||
parser = rawParser;
|
||||
// Handle Enum Cases
|
||||
if(type.ends_with("UIComponentAlign")) {
|
||||
parser = uiComponentAlignParser;
|
||||
} else if(type.ends_with("UIComponentAlignUnit")) {
|
||||
parser = uiComponentAlignUnitParser;
|
||||
} else {
|
||||
parser = rawParser;
|
||||
}
|
||||
} else if(type.find("*") == (type.size() - 1)) {
|
||||
type = type.substr(0, type.size() - 1);
|
||||
parser = rawParser;
|
||||
|
Reference in New Issue
Block a user