Skip to content

Instantly share code, notes, and snippets.

@TheophileWalter
Created May 9, 2016 19:33
Show Gist options
  • Save TheophileWalter/2554df4ba36fabb2ffc388059568db80 to your computer and use it in GitHub Desktop.
Save TheophileWalter/2554df4ba36fabb2ffc388059568db80 to your computer and use it in GitHub Desktop.
// Méthode d'affichage du labyrinthe.
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
for (int i = laby.getHero().cell.getI()-VIEW_FIELD; i <= laby.getHero().cell.getI()+VIEW_FIELD; i++) {
for (int j = laby.getHero().cell.getJ()-VIEW_FIELD; j <= laby.getHero().cell.getJ()+VIEW_FIELD; j++) {
Cell cell = laby.get(i, j);
if (cell == null) {
continue;
}
cell.paintCell(g2, (j-laby.getHero().cell.getJ()+VIEW_FIELD)*SCALE, (i-laby.getHero().cell.getI()+VIEW_FIELD)*SCALE, SCALE);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment