Advertisement
Codydude56

[wBot] drawTile

Jul 29th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. private void drawTile(Graphics render, Tile tile, Color color, boolean outline) {
  2.  
  3. Point southwest = Calculations.tileToScreen(tile.getX(), tile.getY(), 0);
  4. Point southeast = Calculations.tileToScreen(tile.getX() + 1, tile.getY(), 0);
  5. Point northwest = Calculations.tileToScreen(tile.getX(), tile.getY() + 1, 0);
  6. Point northeast = Calculations.tileToScreen(tile.getX() + 1, tile.getY() + 1, 0);
  7.  
  8. if (outline) {
  9. render.setColor(Color.BLACK);
  10. render.drawPolygon(new int[]{(int) northwest.getX(), (int) northeast.getX(), (int) southeast.getX(), (int) southwest.getX()},
  11. new int[]{(int) northwest.getY(), (int) northeast.getY(), (int) southeast.getY(), (int) southwest.getY()},
  12. 4);
  13. }
  14.  
  15. render.setColor(color);
  16. render.fillPolygon(new int[]{(int) northwest.getX(), (int) northeast.getX(), (int) southeast.getX(), (int) southwest.getX()},
  17. new int[]{(int) northwest.getY(), (int) northeast.getY(), (int) southeast.getY(), (int) southwest.getY()},
  18. 4);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement