You are reading a single comment by @Owen and its replies. Click here to read the full conversation.
  • Hello,
    I've got an 8x16 LED matrix and I'm using the Graphics module to draw a simple game onto it. I'm using an Array to hold some background pixels with I then loop and use Graphics.setPixel() to output. Everything works fine but looping my array for active pixels seems very slow. So my question is, is there a fast/better way to be doing the following?

      // Create empty array
      var board = Array();
      for (var r=0; r < 16; r++) {
          board[r] = Array();
          for (var c=0; c < 8; c++) {
              board[r][c] = 0;
          }
      }
    
      // (un)set pixels in array code here
    
      // Loop and output pixels
      for(var r=0; r < 16; r++) {
          for(var c=0; c < 8; c++) {
              if(board[r][c] == 1) {
                  martix.setPixel(c,r);
              }
          }
      }
    
About

Avatar for Owen @Owen started