You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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.

    And the output is different because the default font has changed.

About

Avatar for Gordon @Gordon started