prog
This commit is contained in:
@@ -45,7 +45,7 @@ out = [
|
||||
"",
|
||||
]
|
||||
|
||||
lua = []
|
||||
js = []
|
||||
for name, (r, g, b, a) in colors.items():
|
||||
r8, g8, b8, a8 = (int(float(ch) * 255) for ch in (r, g, b, a))
|
||||
macro = "COLOR_" + name.upper()
|
||||
@@ -60,16 +60,16 @@ for name, (r, g, b, a) in colors.items():
|
||||
f"#define {macro} {macro}_4B",
|
||||
"",
|
||||
]
|
||||
lua += [
|
||||
f"function color{camel}()",
|
||||
f" return color({r8}, {g8}, {b8}, {a8})",
|
||||
"end",
|
||||
js += [
|
||||
f"function color{camel}() {{",
|
||||
f" return color({r8}, {g8}, {b8}, {a8});",
|
||||
"}",
|
||||
"",
|
||||
]
|
||||
|
||||
out.append("// Lua color functions")
|
||||
out.append("// JS color functions")
|
||||
out.append("#define COLOR_SCRIPT \\")
|
||||
for line in "\n".join(lua).rstrip().splitlines():
|
||||
for line in "\n".join(js).rstrip().splitlines():
|
||||
out.append(f' "{line}\\n" \\')
|
||||
out[-1] = out[-1].rstrip(" \\")
|
||||
out.append("")
|
||||
|
||||
@@ -50,7 +50,7 @@ out += [
|
||||
"static const char_t *INPUT_ACTION_SCRIPT =",
|
||||
]
|
||||
for input_id in input_ids:
|
||||
out.append(f" \"{id_enum(input_id)} = {id_values[input_id]}\\n\"")
|
||||
out.append(f" \"var {id_enum(input_id)} = {id_values[input_id]};\\n\"")
|
||||
out += [";", ""]
|
||||
|
||||
os.makedirs(os.path.dirname(args.output), exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user