예제 #1
0
 // --------------------------------------------------------------------------
 // CHANGE LISTENERS:
 // --------------------------------------------------------------------------
 public void onChange(BoardModel board) {
   for (int i = 0; i < board.getRowsOnBoard(); i++) {
     for (int j = 0; j < board.getColsOnBoard(); j++) {
       TileModel square = tiles.get(i).get(j);
       square.setTileState(board.getTileState(i, j));
     }
   }
 }
예제 #2
0
 public void initializeTiles() {
   this.tileSize = Resources.tileSize;
   Vector2 sizeVec = new Vector2(tileSize, tileSize); // rectangular tiles
   ArrayList<ArrayList<TileModel>> tiles = new ArrayList<ArrayList<TileModel>>();
   for (int i = 0; i < Resources.rows; i++) {
     ArrayList<TileModel> squareRow = new ArrayList<TileModel>();
     for (int j = 0; j < Resources.cols; j++) {
       Vector2 pos = new Vector2(tileSize * j, tileSize * i);
       TileModel square = new TileModel(pos, sizeVec);
       square.setSize(tileSize);
       squareRow.add(square);
     }
     tiles.add(squareRow);
   }
   this.tiles = tiles;
 }