Graphics.prototype.print = function() { for (var y=0;y<this.getHeight();y++) console.log(new Uint8Array(this.buffer,this.getWidth()*y,this.getWidth()).toString()); }; var g = Graphics.createArrayBuffer(8,8,8); g.setColor(1); g.drawString("X",0,0); g.print();
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.43 Copyright 2017 G.Williams >1,0,1,0,0,0,0,0 1,0,1,0,0,0,0,0 0,1,0,0,0,0,0,0 1,0,1,0,0,0,0,0 1,0,1,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0
I added .toString because now it outputs new Uint8Array([0,0,0,0,0,0,0,0]) as new Uint8Array(8) to save space.
.toString
new Uint8Array([0,0,0,0,0,0,0,0])
new Uint8Array(8)
And the output is different because the default font has changed.
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I added
.toString
because now it outputsnew Uint8Array([0,0,0,0,0,0,0,0])
asnew Uint8Array(8)
to save space.And the output is different because the default font has changed.