Putain, AWT est bien complexe
.
Moi qui voulait un peu de difficulté, je suis servi
.
public void renderTmp() {
// On crée le bufferStrategy en triple buffering
BufferStrategy bs = getBufferStrategy();
if(bs == null) { // S'il n'est pas encore crée, on en crée un.
createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics(); // On récupère le Graphics
GameGraphics gg = new GameGraphics(g); // On crée un graphics évolué à partir du graphics récuperé
{
// On clear l'écran de noir
g.setColor(Color.BLACK);
g.fillRect(0, 0, getWidth(), getHeight());
// On éffectue les différents render
render(gg, bitmap);
// On rempli notre image
for(int i = 0; i < bitmap.width; ++i) {
for(int j = 0; j < bitmap.height; ++j) {
pixels[i + j * WIDTH] = bitmap.pixels[i][j] * 255;
}
}
// On l'affiche ensuite
g.drawImage(img, 0, 0, WIDTH * SCALE, HEIGHT * SCALE, null);
}
// On dispose nos Graphics
gg.dispose();
g.dispose();
// On affiche le tout
bs.show();
}
.