From a99ace0b7aa7d49416f8f5cc7cf4374af897f6c6 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Tue, 15 Dec 2020 21:42:44 -0800 Subject: [PATCH] Draw bottom input wire for NOT gates and counters --- js/tileset.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/tileset.js b/js/tileset.js index f4de817..601491b 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -980,7 +980,6 @@ export class Tileset { blit(...unpowered_coords); if (tile && tile.cell) { // What goes on top varies a bit... - // FIXME implement for NOT and counter! let r = this.layout['#wire-width'] / 2; if (tile.cell.powered_edges & DIRECTIONS[tile.direction].bit) { // Output (on top) @@ -989,14 +988,22 @@ export class Tileset { } if (tile.cell.powered_edges & DIRECTIONS[DIRECTIONS[tile.direction].right].bit) { // Right input, which includes the middle + // This actually covers the entire lower right corner, for bent inputs. let [x0, y0, x1, y1] = this._rotate(tile.direction, 0.5 - r, 0.5 - r, 1, 1); blit(powered_coords[0], powered_coords[1], x0, y0, x1 - x0, y1 - y0); } if (tile.cell.powered_edges & DIRECTIONS[DIRECTIONS[tile.direction].left].bit) { // Left input, which does not include the middle + // This actually covers the entire lower left corner, for bent inputs. let [x0, y0, x1, y1] = this._rotate(tile.direction, 0, 0.5 - r, 0.5 - r, 1); blit(powered_coords[0], powered_coords[1], x0, y0, x1 - x0, y1 - y0); } + if (tile.cell.powered_edges & DIRECTIONS[DIRECTIONS[tile.direction].opposite].bit) { + // Bottom input (for NOT gates and counters) + // Only covers a line down the middle because bottom inputs don't bend. + let [x0, y0, x1, y1] = this._rotate(tile.direction, 0.5 - r, 0.5 + r, 0.5 + r, 1); + blit(powered_coords[0], powered_coords[1], x0, y0, x1 - x0, y1 - y0); + } } // Layer 2: the tile itself