mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-19 11:44:48 +00:00
parsecolortable
This commit is contained in:
parent
54443e365d
commit
3ca75bec8e
@ -770,9 +770,7 @@ EX shared_ptr<custom_parameter> param_colortable(colortable& val, const paramete
|
||||
u->custom_value = [] () { return -1; };
|
||||
u->custom_affect = [&val] (void *v) { return &val == v; };
|
||||
u->custom_load = [&val] (const string& s) {
|
||||
auto seq = split_string(s, ',');
|
||||
val.resize(isize(seq));
|
||||
for(int i=0; i<isize(seq); i++) sscanf(seq[i].c_str(), "%x", &(val[i]));
|
||||
val = parsecolortable(s);
|
||||
};
|
||||
u->custom_save = [&val] {
|
||||
bool first = true;
|
||||
|
11
util.cpp
11
util.cpp
@ -615,6 +615,17 @@ EX color_t parsecolor(const string& s, bool has_alpha) {
|
||||
return col;
|
||||
}
|
||||
|
||||
EX colortable parsecolortable(const string& s) {
|
||||
colortable tab;
|
||||
tab.clear();
|
||||
exp_parser ep;
|
||||
ep.s = s;
|
||||
tab.push_back(ep.parsecolor() >> 8);
|
||||
while(ep.eat(","))
|
||||
tab.push_back(ep.parsecolor() >> 8);
|
||||
return tab;
|
||||
}
|
||||
|
||||
EX trans23 parsematrix23(const string& s) {
|
||||
trans23 t;
|
||||
#if MAXMDIM == 3
|
||||
|
Loading…
Reference in New Issue
Block a user