1 package se
.umu
.cs
.dit06ajnajs
;
4 import javax
.imageio
.ImageIO
;
5 import java
.awt
.image
.BufferedImage
;
6 import java
.util
.logging
.Logger
;
7 import java
.io
.IOException
;
9 public final class MapBuilder
{
10 private static Logger logger
= Logger
.getLogger("AntiTD");
12 // TODO: test implementation
13 public static Map
createMap() {
15 URL url
= MapBuilder
.class.getResource("/resources/grass.jpg");
16 logger
.info("Image URL: " + url
);
21 BufferedImage grassImage
= ImageIO
.read(url
);
22 MapSquare
[][] mapArray
= new MapSquare
[xsize
][ysize
];
23 for (int y
= 0; y
< ysize
; y
++) {
24 for (int x
= 0; x
< xsize
; x
++) {
25 int xPos
= squareWidth
* x
;
26 int yPos
= squareWidth
* y
;
27 mapArray
[x
][y
] = new TowerSquare(xPos
, yPos
, grassImage
);
28 logger
.info(mapArray
[x
][y
].toString());
31 Map resultMap
= new Map(46, mapArray
);
33 } catch (IOException e
) {
34 // TODO - fix error message