From bb449ea7ce9224284c2b60698cf0b0c7d70f9c71 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 23 Apr 2023 01:44:54 +0200 Subject: Asset scripts and start of client. --- tools/genhex.js | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tools/genhex.js (limited to 'tools/genhex.js') diff --git a/tools/genhex.js b/tools/genhex.js new file mode 100644 index 0000000..c0e8812 --- /dev/null +++ b/tools/genhex.js @@ -0,0 +1,63 @@ +// hexagonal counters with embedded image and outline + +const fs = require('fs') + +function print_hex(output, input, hi, lo, bd) { + let image = fs.readFileSync(input).toString('base64') + let svg = [] + + let img_w = 50 + let img_h = 58 // 57.735 + + let svg_w = img_w + 4 + let svg_h = img_h + 6 + + svg.push(``) + + let iw = img_w / 2 + let ih = iw / Math.sqrt(3) + let iy = (svg_h - ih * 4) / 2 + + let ow = img_w / 2 + 2 + let oh = ow / Math.sqrt(3) + let oy = (svg_h - oh * 4) / 2 + + svg.push('') + svg.push(``) + svg.push('') + + svg.push('') + svg.push(``) + svg.push('') + + svg.push(``) + + svg.push(``) + + svg.push(``) + svg.push(``) + + svg.push('') + + fs.writeFileSync(output, svg.join("\n") + "\n") +} + +print_hex("images/castra.svg", "images/castra.png", "#ffffff", "#b2b2b2", "#434343") +print_hex("images/quaestor.svg", "images/quaestor.png", "#ffffff", "#b2b2b2", "#434343") + +print_hex("images/mob.svg", "images/mob.png", "#eaebc7", "#888968", "#323214") +print_hex("images/mob_x2.svg", "images/mob_x2.png", "#eaebc7", "#888968", "#323214") + +print_hex("images/blue_breakaway.svg", "images/blue_breakaway.png", "#d5ffff", "#6e96b6", "#113854") +print_hex("images/blue_seat_of_power.svg", "images/blue_seat_of_power.png", "#d5ffff", "#6e96b6", "#113854") + +print_hex("images/green_breakaway.svg", "images/green_breakaway.png", "#ace48f", "#568837", "#033600") +print_hex("images/green_seat_of_power.svg", "images/green_seat_of_power.png", "#ace48f", "#568837", "#033600") + +print_hex("images/red_breakaway.svg", "images/red_breakaway.png", "#ff5455", "#c00000", "#680000") +print_hex("images/red_seat_of_power.svg", "images/red_seat_of_power.png", "#ff5455", "#c00000", "#680000") + +print_hex("images/yellow_breakaway.svg", "images/yellow_breakaway.png", "#fffe92", "#c3a634", "#553a00") +print_hex("images/yellow_seat_of_power.svg", "images/yellow_seat_of_power.png", "#fffe92", "#c3a634", "#553a00") -- cgit v1.2.3