topical media & game development

talk show tell print

graphic-processing-algorithm-Appendix-p315-1-MyScreen.pde / pde



  class MyScreen{
    MyPixel [] pixelGrid;
    MyScreen(int xgrid, int ygrid){
      pixelGrid = new MyPixel[xgrid*ygrid];
      for(int p=0; p<pixelGrid.length; p++){
        pixelGrid[p] = new MyPixel();
        pixelGrid[p].x = p\%xgrid;
        pixelGrid[p].y = p/xgrid;
      }
    }
    void plot(){
      for(int p=0; p<pixelGrid.length; p++)
        pixelGrid[p].plot();
    }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.