コード例 #1
0
ファイル: GamePanel.java プロジェクト: CodeResource/AStar
 private void drawMap(Graphics2D g2d, TileMap map) {
   for (TileCell[] columns : map.getCells()) {
     for (TileCell cell : columns) {
       if (cell.isEnd()) {
         drawCellWithColor(g2d, cell, Color.GREEN);
       } else if (cell.isPath()) {
         if (!cell.isStart()) {
           drawCellWithColor(g2d, cell, Color.YELLOW);
         }
         drawCellG(g2d, cell);
       } else if (!cell.isCanPass()) {
         drawCellWithColor(g2d, cell, Color.DARK_GRAY);
       } else {
         g2d.setColor(Color.BLACK);
         g2d.drawRect(cell.getX(), cell.getY(), TileCell.WIDTH, TileCell.HEIGHT);
         drawCellG(g2d, cell);
       }
     }
   }
 }