Create a separate draw tile loop section for the editor renderer object

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 3 years ago
parent 76c39a84a7
commit 9766e0544a
  1. 11
      src/sig/objects/EditorRenderer.java
  2. 1
      src/sig/objects/LevelRenderer.java

@ -93,6 +93,17 @@ public class EditorRenderer extends LevelRenderer{
@Override
public void draw(byte[] p) {
super.draw(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;
}
drawMapTileForEditorMode(x,y);
}
}
Draw_Text(4,0,messageLog,Font.PROFONT_12);
}

@ -33,7 +33,6 @@ public class LevelRenderer extends Object{
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)));
}
drawMapTileForEditorMode(x,y);
}
}
Draw_Object(RabiClone.player);

Loading…
Cancel
Save