okay, colors for everything

This commit is contained in:
2025-11-05 03:11:41 -07:00
parent 12e0518948
commit a38466b8e0
3 changed files with 10 additions and 5 deletions

View File

@@ -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.

View File

@@ -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]}],

View File

@@ -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]