Skip to content

Commit

Permalink
Add pony mode
Browse files Browse the repository at this point in the history
  • Loading branch information
190n committed Oct 10, 2023
1 parent 9fa1136 commit 5a00f0c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions web-host/src/cpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,15 @@ export default class CPU {
renderDisplay(out: ImageData) {
for (let y = 0; y < 32; y += 1) {
for (let x = 0; x < 64; x += 1) {
const pixel = this.getPixel(x, y) ? 255 : 0;
out.data[(y * 64 + x) * 4 + 0] = pixel;
out.data[(y * 64 + x) * 4 + 1] = pixel;
out.data[(y * 64 + x) * 4 + 2] = pixel;
let rgb;
if (window.location.hash == '#pony') {
rgb = this.getPixel(x, y) ? [0x5f, 0x52, 0x2b] : [0x91, 0x41, 0x2a];
} else {
rgb = this.getPixel(x, y) ? [0xff, 0xff, 0xff] : [0x00, 0x00, 0x00];
}
out.data[(y * 64 + x) * 4 + 0] = rgb[0];
out.data[(y * 64 + x) * 4 + 1] = rgb[1];
out.data[(y * 64 + x) * 4 + 2] = rgb[2];
out.data[(y * 64 + x) * 4 + 3] = 255;
}
}
Expand Down

0 comments on commit 5a00f0c

Please sign in to comment.