read a line of an ArrayBuffer

Posted on
  • Hello,

    i'm a bit newb with arrayBuffer...
    i use a flipdot display compose with 1 line of 7 points and a block of 7 lines of 7 points.
    I need an array of 8x8 to drawString(t,x,y)

    var g = Graphics.createArrayBuffer(8,8,1);

    How to access of the data stored in the first line of the array?
    g[0] ?
    and the rest of the buffer?

    sorry for this basic question but i don't know how to use this object.

  • No problem - by default g.buffer is an untyped arraybuffer, so ideally you make it into something typed:

    var g = Graphics.createArrayBuffer(8,8,1);
    // ...
    var a = new Uint8Array(g.buffer);
    // you can still change 'g' and the values in 'a' will change too
  • I've done this...
    i'm waiting the postman with the 7x1 display for testing... (monday or later)

      g = Graphics.createArrayBuffer(8,8,1);
      a = new Uint8Array(g.buffer);
      // ecran 1x7
      // ecran 7x7
  • Yes, that seems fine. Just FYI - you don't need g.setFont4x6(texte,compteur,0); - you can just write g.setFont4x6();

  • @Gordon oups, you're rigth.
    It's a bad cut/past.
    I've modifying the code

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

read a line of an ArrayBuffer

Posted by Avatar for Mrbbp @Mrbbp