From 719d61982953caf61c0df7776347e13105a2e8b2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 22 Oct 2022 12:53:57 +0200 Subject: Add asset rendering scripts. --- tools/genboxes.py | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tools/genboxes.py (limited to 'tools/genboxes.py') diff --git a/tools/genboxes.py b/tools/genboxes.py new file mode 100644 index 0000000..92488ed --- /dev/null +++ b/tools/genboxes.py @@ -0,0 +1,65 @@ +mode = None + +list = [] + +x = y = w = h = 0 +name = None + +def flush(): + global x, y, w, h, name + if mode == 'rect': + list.append((x,y,w,h,'box',name)) + if mode == 'circle': + x = cx - rx + y = cy - ry + w = rx * 2 + h = ry * 2 + list.append((x,y,w,h,'circle',name)) + x = y = w = h = 0 + name = None + +for line in open("boxes.svg").readlines(): + line = line.strip() + if line == "') + print('
') + print('') + for (x,y,w,h,c,name) in list: + x = round(x/4) - 1 + y = round(y/4) - 1 + w = round(w/4) + 2 + h = round(h/4) + 2 + print(f'
{name}
') + print('
') + +#print_html() +print_list() -- cgit v1.2.3