ok the Graphics2D.scale thing work, BUT it does it to the ENTIRE screen, as i found out, the work around is the scale it again, but it doesnt work that way,
unless i go below 1.0 to scale the interface to stay normal. So i must learn AffineTransform.
here is a method that i want to zoom into ONLY the tiles, yet the does nothing. i dont understand how the identity object is supposed to know what images to use?
i know this doesnt work at all, because i cant even zoom in at all now, because it doesnt know what to scale with… i have to use AffineTransform so i dont scale the interface WITH the tiles.
Actually this method is used to understand what tile to draw according the array, and then draw it at the proper position(it works fine in that sense).
/**
* Draw this tile to the graphics context provided
*
* @param g The graphics context on which to draw
*/
public void draw(Graphics2D g, boolean showCoords, boolean showBoundrys, double zoom) {
for (int i = 0; i < this.MAP_WIDTH; i++) {
for (int j = 0; j < this.MAP_HEIGHT; j++) {
if (this.tile[i][j] == NODRAW) { this.tileVis[i][j] = HIDDEN; }
if (this.tileVis[i][j] == VISIBLE) {[b]AffineTransform identity = new AffineTransform();[/b]
if (this.tile[i][j] == LIGHT_GRASS) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\lightGrass.png","TILE"); }
if (this.tile[i][j] == DARK_GRASS) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\darkGrass.png","TILE"); }
if (this.tile[i][j] == DIRT) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\dirt.png","TILE"); }
if (this.tile[i][j] == SAND) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\sand.png","TILE"); }
if (this.tile[i][j] == WATER) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\water.png","TILE"); }
if (this.tile[i][j] == YELLOW_GRASS){ this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\yellowGrass.png","TILE"); }
if (this.tile[i][j] == ROCK_GRASS) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\rockGrass.png","TILE"); }
if (this.tile[i][j] == GY_GRASS) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\gyGrass.png","TILE"); }
if (this.tile[i][j] == GRASS_2) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\grass2.png","TILE"); }
if (this.tile[i][j] == DARK_SAND) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\darkSand.png","TILE"); }
if (this.tile[i][j] == RED_SAND) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\redSand.png","TILE"); }
if (this.tile[i][j] == BRICK) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\brick.png","TILE"); }
if (this.tile[i][j] == TRACK) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\track.png","TILE"); }
if (this.tile[i][j] == FARM) { this.tileGraphic = SpriteStore.get().getSprite("\\tile_textures\\farm.png","TILE"); }
[b]AffineTransform transform = new AffineTransform();
transform.setTransform(identity);
transform.scale(this.zoomLevel, this.zoomLevel); [/b]
this.tileGraphic.draw(g, (int)this.xPos+(this.tileGraphic.getWidth()*i), (int)this.yPos+(this.tileGraphic.getHeight()*j));
if (showCoords) {
coordDraw = "(" + i + "," + j + ")";
g.drawString(coordDraw,getTileXPos(i)+(TILE_SIZE/2)-coordDraw.length()*3+(int)this.xPos,getTileYPos(j)+(TILE_SIZE/2)+(int)this.yPos+3);
}
if (showBoundrys) {
g.drawRect(getTileXPos(i-1)+(int)this.xPos+TILE_SIZE,getTileYPos(j-1)+(int)this.yPos+TILE_SIZE,TILE_SIZE,TILE_SIZE);
}
}
}
}
}