Draw bottom input wire for NOT gates and counters

This commit is contained in:
Andrew Ekstedt 2020-12-15 21:42:44 -08:00
parent 7c82a4cdf9
commit a99ace0b7a

View File

@ -980,7 +980,6 @@ export class Tileset {
blit(...unpowered_coords); blit(...unpowered_coords);
if (tile && tile.cell) { if (tile && tile.cell) {
// What goes on top varies a bit... // What goes on top varies a bit...
// FIXME implement for NOT and counter!
let r = this.layout['#wire-width'] / 2; let r = this.layout['#wire-width'] / 2;
if (tile.cell.powered_edges & DIRECTIONS[tile.direction].bit) { if (tile.cell.powered_edges & DIRECTIONS[tile.direction].bit) {
// Output (on top) // Output (on top)
@ -989,14 +988,22 @@ export class Tileset {
} }
if (tile.cell.powered_edges & DIRECTIONS[DIRECTIONS[tile.direction].right].bit) { if (tile.cell.powered_edges & DIRECTIONS[DIRECTIONS[tile.direction].right].bit) {
// Right input, which includes the middle // 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); 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); blit(powered_coords[0], powered_coords[1], x0, y0, x1 - x0, y1 - y0);
} }
if (tile.cell.powered_edges & DIRECTIONS[DIRECTIONS[tile.direction].left].bit) { if (tile.cell.powered_edges & DIRECTIONS[DIRECTIONS[tile.direction].left].bit) {
// Left input, which does not include the middle // 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); 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); 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 // Layer 2: the tile itself