Draw a grid to separate every screen
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
4a5c8508ff
commit
8033c2a4ba
@ -50,6 +50,10 @@ public abstract class Object implements GameEntity{
|
||||
public void drawOverlay(byte[] p) {
|
||||
}
|
||||
|
||||
protected void Draw(byte[] canvas, int index, PaletteColor col, Alpha alpha) {
|
||||
DrawLoop.Draw(canvas, index, (byte)col.ordinal(), alpha);
|
||||
}
|
||||
|
||||
protected void Draw_Sprite(double x, double y, Sprite sprite){
|
||||
DrawLoop.Draw_Sprite(x,y,sprite);
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ public enum Tile {
|
||||
|
||||
final public static int TILE_WIDTH=32;
|
||||
final public static int TILE_HEIGHT=32;
|
||||
final public static int TILE_SCREEN_COUNT_X=RabiClone.BASE_WIDTH/TILE_WIDTH;
|
||||
final public static int TILE_SCREEN_COUNT_Y=RabiClone.BASE_HEIGHT/TILE_HEIGHT;
|
||||
final public static int TILE_SCREEN_COUNT_X=Map.MAP_WIDTH/TILE_WIDTH;
|
||||
final public static int TILE_SCREEN_COUNT_Y=Map.MAP_HEIGHT/TILE_HEIGHT;
|
||||
|
||||
int spriteSheetX,spriteSheetY;
|
||||
boolean invisible;
|
||||
|
@ -104,9 +104,41 @@ public class EditorRenderer extends LevelRenderer{
|
||||
drawMapTileForEditorMode(x,y);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
drawTileGrid(p,x,y);
|
||||
}
|
||||
}
|
||||
Draw_Text(4,0,messageLog,Font.PROFONT_12);
|
||||
}
|
||||
|
||||
private void drawTileGrid(byte[] p, int x, int y) {
|
||||
if (x%Tile.TILE_SCREEN_COUNT_X==0) {
|
||||
for (int yy=0;yy<Tile.TILE_HEIGHT;yy++) {
|
||||
int index=(y*Tile.TILE_HEIGHT+yy)*Map.MAP_WIDTH+x*Tile.TILE_WIDTH;
|
||||
if (index<0||index>=p.length) {
|
||||
return;
|
||||
}
|
||||
Draw(p,index,PaletteColor.BLACK,Alpha.ALPHA0);
|
||||
}
|
||||
}
|
||||
if (y%Tile.TILE_SCREEN_COUNT_Y==0) {
|
||||
for (int xx=0;xx<Tile.TILE_HEIGHT;xx++) {
|
||||
int index=y*Tile.TILE_HEIGHT*Map.MAP_WIDTH+(x*Tile.TILE_WIDTH+xx);
|
||||
if (index<0||index>=p.length) {
|
||||
return;
|
||||
}
|
||||
Draw(p,index,PaletteColor.BLACK,Alpha.ALPHA0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawMapTileForEditorMode(int x, int y) {
|
||||
if (x==RabiClone.p.highlightedSquare.getX()&&y==RabiClone.p.highlightedSquare.getY()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user