From 905031ee16eac5b85c4c58eb1f3b2c475e4892b7 Mon Sep 17 00:00:00 2001 From: Steven Elliott Date: Tue, 4 Apr 2017 18:03:47 -0500 Subject: [PATCH] Enhanced the drawmaps.py demo so that it renders things as colored circles. The relationship between the thing type to thing color is random but consistent. --- demo/drawmaps.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/demo/drawmaps.py b/demo/drawmaps.py index 56f6cd1..71d4be0 100644 --- a/demo/drawmaps.py +++ b/demo/drawmaps.py @@ -48,6 +48,20 @@ def drawmap(wad, name, filename, width, format): draw.line((p1x, p1y+1, p2x, p2y+1), fill=color) draw.line((p1x, p1y-1, p2x, p2y-1), fill=color) + tr = 2; # Thing radius - how big each thing is. + for thing in edit.things: + tt = thing.type + tx = thing.x * scale + 4 + ty = -thing.y * scale + 4 + # Multiply by prime numbers to map to a random color. + # TODO: Come up with a type to color map that resembles the actual + # thing colors. + # TODO: Avoid colors that are too close to the background color or + # wall colors. + tc = ((tt * 29333) % 256, (tt * 41227) % 256, (tt * 78979) % 256) + draw.ellipse(((tx - tr) - xmin, (ty - tr) - ymin, + (tx + tr) - xmin, (ty + tr) - ymin), fill=tc) + del draw im.save(filename, format)