Unify assets, refactor waypoints

This commit is contained in:
tobspr 2020-08-14 12:14:15 +02:00
parent 9085f32ec3
commit 3c34227c24
210 changed files with 4219 additions and 7866 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 KiB

View File

@ -7,28 +7,11 @@
<string>5.4.0</string>
<key>autoSDSettings</key>
<array>
<struct type="AutoSDSettings">
<key>scale</key>
<double>1</double>
<key>extension</key>
<string>_100</string>
<key>spriteFilter</key>
<string></string>
<key>acceptFractionalValues</key>
<true/>
<key>maxTextureSize</key>
<QSize>
<key>width</key>
<int>4096</int>
<key>height</key>
<int>4096</int>
</QSize>
</struct>
<struct type="AutoSDSettings">
<key>scale</key>
<double>0.75</double>
<key>extension</key>
<string>_75</string>
<string>_hq</string>
<key>spriteFilter</key>
<string></string>
<key>acceptFractionalValues</key>
@ -45,7 +28,7 @@
<key>scale</key>
<double>0.5</double>
<key>extension</key>
<string>_50</string>
<string>_mq</string>
<key>spriteFilter</key>
<string></string>
<key>acceptFractionalValues</key>
@ -62,7 +45,7 @@
<key>scale</key>
<double>0.25</double>
<key>extension</key>
<string>_25</string>
<string>_lq</string>
<key>spriteFilter</key>
<string></string>
<key>acceptFractionalValues</key>
@ -70,26 +53,9 @@
<key>maxTextureSize</key>
<QSize>
<key>width</key>
<int>1024</int>
<int>2048</int>
<key>height</key>
<int>1024</int>
</QSize>
</struct>
<struct type="AutoSDSettings">
<key>scale</key>
<double>0.1</double>
<key>extension</key>
<string>_10</string>
<key>spriteFilter</key>
<string></string>
<key>acceptFractionalValues</key>
<true/>
<key>maxTextureSize</key>
<QSize>
<key>width</key>
<int>-1</int>
<key>height</key>
<int>-1</int>
<int>2048</int>
</QSize>
</struct>
</array>
@ -174,7 +140,7 @@
<key>freeSizeMode</key>
<enum type="AlgorithmSettings::AlgorithmFreeSizeMode">Best</enum>
<key>sizeConstraints</key>
<enum type="AlgorithmSettings::SizeConstraints">AnySize</enum>
<enum type="AlgorithmSettings::SizeConstraints">POT</enum>
<key>forceSquared</key>
<false/>
<key>maxRects</key>
@ -249,150 +215,48 @@
</struct>
<key>individualSpriteSettings</key>
<map type="IndividualSpriteSettingsMap">
<key type="filename">sprites/belt/forward_0.png</key>
<key type="filename">sprites/belt/forward_1.png</key>
<key type="filename">sprites/belt/forward_2.png</key>
<key type="filename">sprites/buildings/miner.png</key>
<key type="filename">sprites/buildings/rotater.png</key>
<key type="filename">sprites/buildings/trash.png</key>
<key type="filename">sprites/wires/logical_acceptor.png</key>
<key type="filename">sprites/wires/logical_ejector.png</key>
<key type="filename">sprites/wires/overlay_tile.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
<point_f>0.5,0.5</point_f>
<key>spriteScale</key>
<double>1</double>
<key>scale9Enabled</key>
<false/>
<key>scale9Borders</key>
<rect>32,32,64,64</rect>
<key>scale9Paddings</key>
<rect>32,32,64,64</rect>
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/belt/forward_10.png</key>
<key type="filename">sprites/belt/forward_11.png</key>
<key type="filename">sprites/belt/forward_12.png</key>
<key type="filename">sprites/belt/forward_13.png</key>
<key type="filename">sprites/belt/forward_14.png</key>
<key type="filename">sprites/belt/forward_15.png</key>
<key type="filename">sprites/belt/forward_16.png</key>
<key type="filename">sprites/belt/forward_17.png</key>
<key type="filename">sprites/belt/forward_18.png</key>
<key type="filename">sprites/belt/forward_19.png</key>
<key type="filename">sprites/belt/forward_20.png</key>
<key type="filename">sprites/belt/forward_21.png</key>
<key type="filename">sprites/belt/forward_22.png</key>
<key type="filename">sprites/belt/forward_23.png</key>
<key type="filename">sprites/belt/forward_24.png</key>
<key type="filename">sprites/belt/forward_25.png</key>
<key type="filename">sprites/belt/forward_26.png</key>
<key type="filename">sprites/belt/forward_27.png</key>
<key type="filename">sprites/belt/forward_3.png</key>
<key type="filename">sprites/belt/forward_4.png</key>
<key type="filename">sprites/belt/forward_5.png</key>
<key type="filename">sprites/belt/forward_6.png</key>
<key type="filename">sprites/belt/forward_7.png</key>
<key type="filename">sprites/belt/forward_8.png</key>
<key type="filename">sprites/belt/forward_9.png</key>
<key type="filename">sprites/belt/left_0.png</key>
<key type="filename">sprites/belt/left_1.png</key>
<key type="filename">sprites/belt/left_10.png</key>
<key type="filename">sprites/belt/left_11.png</key>
<key type="filename">sprites/belt/left_12.png</key>
<key type="filename">sprites/belt/left_13.png</key>
<key type="filename">sprites/belt/left_14.png</key>
<key type="filename">sprites/belt/left_15.png</key>
<key type="filename">sprites/belt/left_16.png</key>
<key type="filename">sprites/belt/left_17.png</key>
<key type="filename">sprites/belt/left_18.png</key>
<key type="filename">sprites/belt/left_19.png</key>
<key type="filename">sprites/belt/left_2.png</key>
<key type="filename">sprites/belt/left_20.png</key>
<key type="filename">sprites/belt/left_21.png</key>
<key type="filename">sprites/belt/left_22.png</key>
<key type="filename">sprites/belt/left_23.png</key>
<key type="filename">sprites/belt/left_24.png</key>
<key type="filename">sprites/belt/left_25.png</key>
<key type="filename">sprites/belt/left_26.png</key>
<key type="filename">sprites/belt/left_27.png</key>
<key type="filename">sprites/belt/left_3.png</key>
<key type="filename">sprites/belt/left_4.png</key>
<key type="filename">sprites/belt/left_5.png</key>
<key type="filename">sprites/belt/left_6.png</key>
<key type="filename">sprites/belt/left_7.png</key>
<key type="filename">sprites/belt/left_8.png</key>
<key type="filename">sprites/belt/left_9.png</key>
<key type="filename">sprites/belt/right_0.png</key>
<key type="filename">sprites/belt/right_1.png</key>
<key type="filename">sprites/belt/right_10.png</key>
<key type="filename">sprites/belt/right_11.png</key>
<key type="filename">sprites/belt/right_12.png</key>
<key type="filename">sprites/belt/right_13.png</key>
<key type="filename">sprites/belt/right_14.png</key>
<key type="filename">sprites/belt/right_15.png</key>
<key type="filename">sprites/belt/right_16.png</key>
<key type="filename">sprites/belt/right_17.png</key>
<key type="filename">sprites/belt/right_18.png</key>
<key type="filename">sprites/belt/right_19.png</key>
<key type="filename">sprites/belt/right_2.png</key>
<key type="filename">sprites/belt/right_20.png</key>
<key type="filename">sprites/belt/right_21.png</key>
<key type="filename">sprites/belt/right_22.png</key>
<key type="filename">sprites/belt/right_23.png</key>
<key type="filename">sprites/belt/right_24.png</key>
<key type="filename">sprites/belt/right_25.png</key>
<key type="filename">sprites/belt/right_26.png</key>
<key type="filename">sprites/belt/right_27.png</key>
<key type="filename">sprites/belt/right_3.png</key>
<key type="filename">sprites/belt/right_4.png</key>
<key type="filename">sprites/belt/right_5.png</key>
<key type="filename">sprites/belt/right_6.png</key>
<key type="filename">sprites/belt/right_7.png</key>
<key type="filename">sprites/belt/right_8.png</key>
<key type="filename">sprites/belt/right_9.png</key>
<key type="filename">sprites/blueprints/belt_left.png</key>
<key type="filename">sprites/blueprints/belt_right.png</key>
<key type="filename">sprites/blueprints/belt_top.png</key>
<key type="filename">sprites/blueprints/wire-cross.png</key>
<key type="filename">sprites/blueprints/wire-split.png</key>
<key type="filename">sprites/blueprints/wire-turn.png</key>
<key type="filename">sprites/blueprints/wire.png</key>
<key type="filename">sprites/buildings/belt_left.png</key>
<key type="filename">sprites/buildings/belt_right.png</key>
<key type="filename">sprites/buildings/belt_top.png</key>
<key type="filename">sprites/buildings/wire-cross.png</key>
<key type="filename">sprites/buildings/wire-split.png</key>
<key type="filename">sprites/buildings/wire-turn.png</key>
<key type="filename">sprites/buildings/wire.png</key>
<key type="filename">sprites/wires/sets/color-cross.png</key>
<key type="filename">sprites/wires/sets/color-split.png</key>
<key type="filename">sprites/wires/sets/color-turn.png</key>
<key type="filename">sprites/wires/sets/color.png</key>
<key type="filename">sprites/wires/sets/conflict-cross.png</key>
<key type="filename">sprites/wires/sets/conflict-split.png</key>
<key type="filename">sprites/wires/sets/conflict-turn.png</key>
<key type="filename">sprites/wires/sets/conflict.png</key>
<key type="filename">sprites/wires/sets/shape-cross.png</key>
<key type="filename">sprites/wires/sets/shape-split.png</key>
<key type="filename">sprites/wires/sets/shape-turn.png</key>
<key type="filename">sprites/wires/sets/shape.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
<point_f>0.5,0.5</point_f>
<key>spriteScale</key>
<double>1</double>
<key>scale9Enabled</key>
<false/>
<key>scale9Borders</key>
<rect>32,32,63,63</rect>
<key>scale9Paddings</key>
<rect>32,32,63,63</rect>
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/belt/built/forward_0.png</key>
<key type="filename">sprites/belt/built/forward_1.png</key>
<key type="filename">sprites/belt/built/forward_10.png</key>
<key type="filename">sprites/belt/built/forward_11.png</key>
<key type="filename">sprites/belt/built/forward_12.png</key>
<key type="filename">sprites/belt/built/forward_13.png</key>
<key type="filename">sprites/belt/built/forward_2.png</key>
<key type="filename">sprites/belt/built/forward_3.png</key>
<key type="filename">sprites/belt/built/forward_4.png</key>
<key type="filename">sprites/belt/built/forward_5.png</key>
<key type="filename">sprites/belt/built/forward_6.png</key>
<key type="filename">sprites/belt/built/forward_7.png</key>
<key type="filename">sprites/belt/built/forward_8.png</key>
<key type="filename">sprites/belt/built/forward_9.png</key>
<key type="filename">sprites/belt/built/left_0.png</key>
<key type="filename">sprites/belt/built/left_1.png</key>
<key type="filename">sprites/belt/built/left_10.png</key>
<key type="filename">sprites/belt/built/left_11.png</key>
<key type="filename">sprites/belt/built/left_12.png</key>
<key type="filename">sprites/belt/built/left_13.png</key>
<key type="filename">sprites/belt/built/left_2.png</key>
<key type="filename">sprites/belt/built/left_3.png</key>
<key type="filename">sprites/belt/built/left_4.png</key>
<key type="filename">sprites/belt/built/left_5.png</key>
<key type="filename">sprites/belt/built/left_6.png</key>
<key type="filename">sprites/belt/built/left_7.png</key>
<key type="filename">sprites/belt/built/left_8.png</key>
<key type="filename">sprites/belt/built/left_9.png</key>
<key type="filename">sprites/belt/built/right_0.png</key>
<key type="filename">sprites/belt/built/right_1.png</key>
<key type="filename">sprites/belt/built/right_10.png</key>
<key type="filename">sprites/belt/built/right_11.png</key>
<key type="filename">sprites/belt/built/right_12.png</key>
<key type="filename">sprites/belt/built/right_13.png</key>
<key type="filename">sprites/belt/built/right_2.png</key>
<key type="filename">sprites/belt/built/right_3.png</key>
<key type="filename">sprites/belt/built/right_4.png</key>
<key type="filename">sprites/belt/built/right_5.png</key>
<key type="filename">sprites/belt/built/right_6.png</key>
<key type="filename">sprites/belt/built/right_7.png</key>
<key type="filename">sprites/belt/built/right_8.png</key>
<key type="filename">sprites/belt/built/right_9.png</key>
<key type="filename">sprites/blueprints/constant_signal.png</key>
<key type="filename">sprites/blueprints/lever.png</key>
<key type="filename">sprites/blueprints/logic_gate-not.png</key>
@ -431,6 +295,22 @@
<key type="filename">sprites/buildings/underground_belt_exit.png</key>
<key type="filename">sprites/buildings/wire_tunnel.png</key>
<key type="filename">sprites/wires/lever_on.png</key>
<key type="filename">sprites/wires/sets/color_cross.png</key>
<key type="filename">sprites/wires/sets/color_forward.png</key>
<key type="filename">sprites/wires/sets/color_split.png</key>
<key type="filename">sprites/wires/sets/color_turn.png</key>
<key type="filename">sprites/wires/sets/conflict_cross.png</key>
<key type="filename">sprites/wires/sets/conflict_forward.png</key>
<key type="filename">sprites/wires/sets/conflict_split.png</key>
<key type="filename">sprites/wires/sets/conflict_turn.png</key>
<key type="filename">sprites/wires/sets/regular_cross.png</key>
<key type="filename">sprites/wires/sets/regular_forward.png</key>
<key type="filename">sprites/wires/sets/regular_split.png</key>
<key type="filename">sprites/wires/sets/regular_turn.png</key>
<key type="filename">sprites/wires/sets/shape_cross.png</key>
<key type="filename">sprites/wires/sets/shape_forward.png</key>
<key type="filename">sprites/wires/sets/shape_split.png</key>
<key type="filename">sprites/wires/sets/shape_turn.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
<point_f>0.5,0.5</point_f>
@ -445,6 +325,34 @@
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/blueprints/belt_left.png</key>
<key type="filename">sprites/blueprints/belt_right.png</key>
<key type="filename">sprites/blueprints/belt_top.png</key>
<key type="filename">sprites/blueprints/wire-cross.png</key>
<key type="filename">sprites/blueprints/wire-split.png</key>
<key type="filename">sprites/blueprints/wire-turn.png</key>
<key type="filename">sprites/blueprints/wire.png</key>
<key type="filename">sprites/buildings/belt_left.png</key>
<key type="filename">sprites/buildings/belt_right.png</key>
<key type="filename">sprites/buildings/belt_top.png</key>
<key type="filename">sprites/buildings/wire-cross.png</key>
<key type="filename">sprites/buildings/wire-split.png</key>
<key type="filename">sprites/buildings/wire-turn.png</key>
<key type="filename">sprites/buildings/wire.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
<point_f>0.5,0.5</point_f>
<key>spriteScale</key>
<double>1</double>
<key>scale9Enabled</key>
<false/>
<key>scale9Borders</key>
<rect>32,32,63,63</rect>
<key>scale9Paddings</key>
<rect>32,32,63,63</rect>
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/blueprints/cutter-quad.png</key>
<key type="filename">sprites/blueprints/painter-quad.png</key>
<key type="filename">sprites/buildings/cutter-quad.png</key>
@ -537,6 +445,26 @@
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/buildings/miner.png</key>
<key type="filename">sprites/buildings/rotater.png</key>
<key type="filename">sprites/buildings/trash.png</key>
<key type="filename">sprites/wires/logical_acceptor.png</key>
<key type="filename">sprites/wires/logical_ejector.png</key>
<key type="filename">sprites/wires/overlay_tile.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
<point_f>0.5,0.5</point_f>
<key>spriteScale</key>
<double>1</double>
<key>scale9Enabled</key>
<false/>
<key>scale9Borders</key>
<rect>32,32,64,64</rect>
<key>scale9Paddings</key>
<rect>32,32,64,64</rect>
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/buildings/trash-storage.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
@ -570,7 +498,6 @@
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/misc/deletion_marker.png</key>
<key type="filename">sprites/misc/slot_bad_arrow.png</key>
<key type="filename">sprites/misc/slot_good_arrow.png</key>
<struct type="IndividualSpriteSettings">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

View File

@ -11,9 +11,10 @@ const { fileURLToPath } = require("url");
async function run() {
console.log("Running");
const fps = 28;
const dimensions = 126;
const beltBorder = 15.5;
const fps = 14;
const dimensions = 192;
const beltBorder = 23.5;
const lineSize = 5;
const borderColor = "#91949e";
const fillColor = "#d2d4d9";
@ -21,8 +22,8 @@ async function run() {
// Generate arrow sprite
const arrowW = 40;
const arrowH = 20;
const arrowW = 60;
const arrowH = arrowW / 2;
/** @type {HTMLCanvasElement} */
const arrowSprite = createCanvas(arrowW, arrowH);
const arrowContext = arrowSprite.getContext("2d");
@ -37,6 +38,8 @@ async function run() {
arrowContext.closePath();
arrowContext.fill();
const promises = [];
// First, generate the forward belt
for (let i = 0; i < fps; ++i) {
/** @type {HTMLCanvasElement} */
@ -49,7 +52,7 @@ async function run() {
context.fillStyle = fillColor;
context.strokeStyle = borderColor;
context.lineWidth = 3;
context.lineWidth = lineSize;
context.beginPath();
context.rect(beltBorder, -10, dimensions - 2 * beltBorder, dimensions + 20);
@ -64,9 +67,10 @@ async function run() {
context.drawImage(arrowSprite, dimensions / 2 - arrowW / 2, y);
}
const out = fs.createWriteStream(path.join(__dirname, "forward_" + i + ".png"));
const out = fs.createWriteStream(path.join(__dirname, "built", "forward_" + i + ".png"));
const stream = canvas.createPNGStream();
stream.pipe(out);
promises.push(new Promise(resolve => stream.on("end", resolve)));
}
// Generate left and right side belt
@ -82,7 +86,7 @@ async function run() {
context.fillStyle = fillColor;
context.strokeStyle = borderColor;
context.lineWidth = 3;
context.lineWidth = lineSize;
context.beginPath();
context.moveTo(beltBorder, dimensions + 10);
@ -160,14 +164,43 @@ async function run() {
flippedContext.scale(-1, 1);
flippedContext.drawImage(canvas, -dimensions, 0, dimensions, dimensions);
const out = fs.createWriteStream(path.join(__dirname, "right_" + i + ".png"));
const stream = canvas.createPNGStream();
stream.pipe(out);
const outRight = fs.createWriteStream(path.join(__dirname, "built", "right_" + i + ".png"));
const streamRight = canvas.createPNGStream();
streamRight.pipe(outRight);
const outLeft = fs.createWriteStream(path.join(__dirname, "left_" + i + ".png"));
const outLeft = fs.createWriteStream(path.join(__dirname, "built", "left_" + i + ".png"));
const streamLeft = flippedCanvas.createPNGStream();
streamLeft.pipe(outLeft);
promises.push(new Promise(resolve => streamRight.on("end", resolve)));
promises.push(new Promise(resolve => streamLeft.on("end", resolve)));
}
console.log("Waiting for completion");
await Promise.all(promises);
// Also wait a bit more
await new Promise(resolve => setTimeout(resolve, 1000));
console.log("Copying files to all locations");
// Copy other files
fs.copyFileSync(
path.join(__dirname, "built", "forward_0.png"),
path.join(__dirname, "..", "buildings", "belt_top.png")
);
fs.copyFileSync(
path.join(__dirname, "built", "right_0.png"),
path.join(__dirname, "..", "buildings", "belt_right.png")
);
fs.copyFileSync(
path.join(__dirname, "built", "left_0.png"),
path.join(__dirname, "..", "buildings", "belt_left.png")
);
console.log("Done!");
}
run();

View File

@ -0,0 +1,226 @@
/**
*
* Run `yarn global add canvas` first
*/
const { createCanvas } = require("canvas");
const fs = require("fs");
const path = require("path");
const outputFolder = path.join(__dirname, "..", "wires", "sets");
const dimensions = 192;
const lineSize = 12;
const lowerLineSize = 20;
function hexToRGB(h) {
let r = 0,
g = 0,
b = 0;
// 3 digits
if (h.length == 4) {
r = "0x" + h[1] + h[1];
g = "0x" + h[2] + h[2];
b = "0x" + h[3] + h[3];
// 6 digits
} else if (h.length == 7) {
r = "0x" + h[1] + h[2];
g = "0x" + h[3] + h[4];
b = "0x" + h[5] + h[6];
}
return [+r, +g, +b];
}
function RGBToHSL(r, g, b) {
// Make r, g, and b fractions of 1
r /= 255;
g /= 255;
b /= 255;
// Find greatest and smallest channel values
let cmin = Math.min(r, g, b),
cmax = Math.max(r, g, b),
delta = cmax - cmin,
h = 0,
s = 0,
l = 0;
// Calculate hue
// No difference
if (delta == 0) h = 0;
// Red is max
else if (cmax == r) h = ((g - b) / delta) % 6;
// Green is max
else if (cmax == g) h = (b - r) / delta + 2;
// Blue is max
else h = (r - g) / delta + 4;
h = Math.round(h * 60);
// Make negative hues positive behind 360°
if (h < 0) h += 360;
// Calculate lightness
l = (cmax + cmin) / 2;
// Calculate saturation
s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
// Multiply l and s by 100
s = +(s * 100).toFixed(1);
l = +(l * 100).toFixed(1);
return [h, s, l];
}
function HSLToRGB(h, s, l) {
// Must be fractions of 1
s /= 100;
l /= 100;
let c = (1 - Math.abs(2 * l - 1)) * s,
x = c * (1 - Math.abs(((h / 60) % 2) - 1)),
m = l - c / 2,
r = 0,
g = 0,
b = 0;
if (0 <= h && h < 60) {
r = c;
g = x;
b = 0;
} else if (60 <= h && h < 120) {
r = x;
g = c;
b = 0;
} else if (120 <= h && h < 180) {
r = 0;
g = c;
b = x;
} else if (180 <= h && h < 240) {
r = 0;
g = x;
b = c;
} else if (240 <= h && h < 300) {
r = x;
g = 0;
b = c;
} else if (300 <= h && h < 360) {
r = c;
g = 0;
b = x;
}
r = Math.round((r + m) * 255);
g = Math.round((g + m) * 255);
b = Math.round((b + m) * 255);
return [r, g, b];
}
async function run() {
console.log("Running");
const variants = {
regular: "#25fff2",
color: "#eba458",
shape: "#8858eb",
conflict: "#ff3e3e",
};
const promises = [];
for (const variantId in variants) {
const variantColor = variants[variantId];
const variantHSL = RGBToHSL(...hexToRGB(variantColor));
const darkenedColor = HSLToRGB(variantHSL[0], variantHSL[1] - 15, variantHSL[2] - 20);
const hexDarkenedColor = "rgb(" + darkenedColor.join(",") + ")";
console.log(variantColor, "->", hexToRGB(variantColor), variantHSL, "->", darkenedColor);
const parts = {
forward: [[0.5, 0, 0.5, 1]],
turn: [
[0.5, 0.5, 0.5, 1],
[0.5, 0.5, 1, 0.5],
],
split: [
[0.5, 0.5, 0.5, 1],
[0, 0.5, 1, 0.5],
],
cross: [
[0, 0.5, 1, 0.5],
[0.5, 0, 0.5, 1],
],
};
for (const partId in parts) {
const partLines = parts[partId];
const canvas = createCanvas(dimensions, dimensions);
const context = canvas.getContext("2d");
context.quality = "best";
context.clearRect(0, 0, dimensions, dimensions);
context.strokeStyle = hexDarkenedColor;
context.lineWidth = lowerLineSize;
context.lineCap = "square";
context.imageSmoothingEnabled = false;
// Draw lower lines
partLines.forEach(([x1, y1, x2, y2]) => {
context.beginPath();
context.moveTo(x1 * dimensions, y1 * dimensions);
context.lineTo(x2 * dimensions, y2 * dimensions);
context.stroke();
});
context.strokeStyle = variantColor;
context.lineWidth = lineSize;
// Draw upper lines
partLines.forEach(([x1, y1, x2, y2]) => {
context.beginPath();
context.moveTo(x1 * dimensions, y1 * dimensions);
context.lineTo(x2 * dimensions, y2 * dimensions);
context.stroke();
});
const out = fs.createWriteStream(path.join(outputFolder, variantId + "_" + partId + ".png"));
const stream = canvas.createPNGStream();
stream.pipe(out);
promises.push(new Promise(resolve => stream.on("end", resolve)));
}
}
console.log("Waiting for completion");
await Promise.all(promises);
// Also wait a bit more
await new Promise(resolve => setTimeout(resolve, 1000));
console.log("Copying files to all locations");
// // Copy other files
fs.copyFileSync(
path.join(outputFolder, "regular_forward.png"),
path.join(__dirname, "..", "buildings", "wire.png")
);
fs.copyFileSync(
path.join(outputFolder, "regular_turn.png"),
path.join(__dirname, "..", "buildings", "wire-turn.png")
);
fs.copyFileSync(
path.join(outputFolder, "regular_split.png"),
path.join(__dirname, "..", "buildings", "wire-split.png")
);
fs.copyFileSync(
path.join(outputFolder, "regular_cross.png"),
path.join(__dirname, "..", "buildings", "wire-cross.png")
);
console.log("Done!");
}
run();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Some files were not shown because too many files have changed in this diff Show More