mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-09-12 15:26:00 +00:00
refer to color by HTML name in commandline arguments
This commit is contained in:
@@ -102,6 +102,14 @@ EX namespace arg {
|
||||
}
|
||||
}
|
||||
EX bool argis(const string& s) { if(args()[0] == '-' && args()[1] == '-') return args().substr(1) == s; return args() == s; }
|
||||
|
||||
EX color_t argcolor(int bits) {
|
||||
string s = args();
|
||||
auto p = find_color_by_name(s);
|
||||
if(p && bits == 24) return p->second;
|
||||
if(p && bits == 32) return (p->second << 8) | 0xFF;
|
||||
return strtoll(argcs(), NULL, 16);
|
||||
}
|
||||
|
||||
EX void shift_arg_formula(ld& x, const reaction_t& r IS(reaction_t())) {
|
||||
shift(); ld old = x; x = argf();
|
||||
|
Reference in New Issue
Block a user