From a38466b8e012a3391f04ecf68b1892bdfafcbe94 Mon Sep 17 00:00:00 2001 From: Tangent Date: Wed, 5 Nov 2025 03:11:41 -0700 Subject: [PATCH] okay, colors for everything --- ReadMe.md | 3 +-- map.json | 6 +++++- src/main.lua | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index d599c53..848f1ee 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -18,8 +18,7 @@ You can drag and drop a JSON file to load it. Both nodes and edges can have an extra object with metadata, some of which is used by this program. An array called `offset` will adjust the positioning of -labels. An array called `color` will set the color via 0 to 1 RGBA values -(node only). +labels. An array called `color` will set the color via 0 to 1 RGBA values. Added `areas` which are exactly like nodes except that they always draw a white label and can have a custom radius specified. Drawn between edges and nodes. diff --git a/map.json b/map.json index b6671f1..fad3025 100644 --- a/map.json +++ b/map.json @@ -71,7 +71,11 @@ ["original border 2", "original border 1", "original border (west)"], ["original border 1", "original border 4", "original border (north)"], ["original border 4", "original border 3", "original border (east)"], - ["original border 3", "original border 2", "original border (south)"] + ["original border 3", "original border 2", "original border (south)"], + ["unnamed beach point", "Sugarcane Point", "", {"color": [0.33, 0.33, 1, 0.67]}], + ["future sand mine", "Sugarcane Point", true, {"color": [0.33, 0.33, 1, 0.67], "offset": [0, 14]}], + ["future sand mine", "spawn hovel", true, {"color": [0.33, 0.33, 1, 0.67]}], + ["Spawn Point", "spawn hovel", ""] ], "areas": { "unnamed ocean": [600, 64, -150, true, {"radius": 300, "color": [0, 0, 1, 0.25]}], diff --git a/src/main.lua b/src/main.lua index 72b9115..ef50bca 100644 --- a/src/main.lua +++ b/src/main.lua @@ -81,7 +81,8 @@ function love.draw() end if not (edge[3] == false) then - love.graphics.setColor(0.33, 0.33, 0.33, 1) + local color = edge[4] and edge[4].color or {0.33, 0.33, 0.33, 1} + love.graphics.setColor(color) love.graphics.line(node_a[1], node_a[3], node_b[1], node_b[3]) local center_x = node_a[1] + (node_b[1] - node_a[1]) / 2 @@ -91,7 +92,8 @@ function love.draw() distance = edge[3] end - love.graphics.setColor(0.67, 0.67, 0.67, 1) + local color = edge[4] and edge[4].color or {0.67, 0.67, 0.67, 1} + love.graphics.setColor(color) if edge[4] and edge[4].offset then -- these actually work better not scale-adjusted center_x = center_x + edge[4].offset[1]