|
|
|
@ -8,6 +8,7 @@ import sig.engine.MouseScrollValue; |
|
|
|
|
import sig.engine.Object; |
|
|
|
|
import sig.engine.Panel; |
|
|
|
|
import sig.engine.Sprite; |
|
|
|
|
import sig.map.Map; |
|
|
|
|
import sig.map.Tile; |
|
|
|
|
|
|
|
|
|
public class LevelRenderer extends Object{ |
|
|
|
@ -43,19 +44,25 @@ public class LevelRenderer extends Object{ |
|
|
|
|
int tempIndex = selectedTile.ordinal()+down-up; |
|
|
|
|
int selectedIndex = tempIndex<0?Tile.values().length-Math.abs(tempIndex):tempIndex%Tile.values().length; |
|
|
|
|
selectedTile = Tile.values()[selectedIndex]; |
|
|
|
|
//System.out.println(selectedTile);
|
|
|
|
|
System.out.println(selectedTile); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void draw(int[] p) { |
|
|
|
|
for (int y=(int)(this.getY()/Tile.TILE_HEIGHT);y<(int)(RabiClone.BASE_HEIGHT/Tile.TILE_HEIGHT+this.getY()/Tile.TILE_HEIGHT+1);y++) { |
|
|
|
|
if (y<0||y>Map.MAP_HEIGHT) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
for (int x=(int)(0+this.getX()/Tile.TILE_WIDTH);x<(int)(RabiClone.BASE_WIDTH/Tile.TILE_WIDTH+this.getX()/Tile.TILE_WIDTH+1);x++) { |
|
|
|
|
if (x<0||x>Map.MAP_WIDTH) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (RabiClone.CURRENT_MAP.getTile(x,y)!=Tile.VOID) { |
|
|
|
|
DrawTile(x*Tile.TILE_WIDTH-this.getX(),y*Tile.TILE_HEIGHT-this.getY(),RabiClone.CURRENT_MAP.getTile(x,y)); |
|
|
|
|
//System.out.println((x*Tile.TILE_WIDTH+(this.getX()%Tile.TILE_WIDTH) )+","+(y*Tile.TILE_HEIGHT+(this.getY()%Tile.TILE_HEIGHT)));
|
|
|
|
|
} |
|
|
|
|
if (x==RabiClone.p.highlightedSquare.getX()&&y==RabiClone.p.highlightedSquare.getY()) { |
|
|
|
|
DrawTile(x*Tile.TILE_WIDTH-this.getX(),y*Tile.TILE_HEIGHT-this.getY(),Tile.HIGHLIGHTED_TILE); |
|
|
|
|
DrawTransparentTile(x*Tile.TILE_WIDTH-this.getX(),y*Tile.TILE_HEIGHT-this.getY(),selectedTile,64); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -64,5 +71,9 @@ public class LevelRenderer extends Object{ |
|
|
|
|
private void DrawTile(double x, double y, Tile tile) { |
|
|
|
|
Draw_Sprite_Partial(x,y, tile.getSpriteSheetX()*tile.getTileWidth(), tile.getSpriteSheetY()*tile.getTileHeight(), tile.getTileWidth(), tile.getTileHeight(), getSprite()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void DrawTransparentTile(double x, double y, Tile tile, int alpha) { |
|
|
|
|
Draw_Sprite_Partial_Ext(x,y, tile.getSpriteSheetX()*tile.getTileWidth(), tile.getSpriteSheetY()*tile.getTileHeight(), tile.getTileWidth(), tile.getTileHeight(), getSprite(), alpha); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|