Created
February 9, 2022 17:39
-
-
Save jes/9d5f7de8fea56c36d3181e515216e808 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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