Beispiel #1
0
 private void sendBoardToDisplay(MITrisBoard board, Display2D display, double brightness) {
   int width = display.getWidth();
   int height = display.getHeight();
   for (int x = 0; x < width; x++) {
     for (int y = 0; y < height; y++) {
       Piece p = board.getPosition(x, y);
       Color c = p == null ? Color.BLACK : p.getColor(board.getLevel(), gameDisplayTime);
       float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), new float[3]);
       hsb[2] *= brightness;
       display.setPixelHSB(x, height - 1 - y, hsb[0], hsb[1], hsb[2]);
     }
   }
 }