Skip to content

Instantly share code, notes, and snippets.

@jes
Created February 9, 2022 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jes/9d5f7de8fea56c36d3181e515216e808 to your computer and use it in GitHub Desktop.
Save jes/9d5f7de8fea56c36d3181e515216e808 to your computer and use it in GitHub Desktop.
//var f = "uncomment me to change colours";
var yellow = new Uint16Array([0x0000,0xFFC0],0,1); // black, yellow
var white = new Uint16Array([0x0000,0xffff],0,1); // black, white
var red = new Uint16Array([0x0000,0xf800],0,1); // black, red
var buf = Graphics.createArrayBuffer(240,160,1, {msb:true});
function flip(x,y,palette) {
g.drawImage({width:240,height:40,bpp:1,buffer:buf.buffer, palette:palette},x,y);
}
g.clear();
buf.setColor(1);
buf.setFontAlign(-1, -1);
buf.setFont("Vector",40);
buf.clear();
buf.drawString("yellow",0,0);
flip(0, 0, yellow);
buf.clear();
buf.drawString("white",0,0);
flip(0, 40, white);
buf.clear();
buf.drawString("red",0,0);
flip(0, 80, red);
// Why does adding/deleting "f" change the colours?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment