class Rectangle { // Attributs float x; // Position float y; float w; // Largeur float h; // Hauteur color c; // Couleur float alpha; // Angle de rotation // Constructeur Rectangle( float x, float y, float w, float h, color c, float alpha ) { this.x = x; this.y = y; this.w = w; this.h = h; this.c = c; this.alpha = alpha; } // Methodes // pivoter void pivoter( float alpha ) { this.alpha = alpha; } // affichage void afficher() { rectMode(CENTER); pushMatrix(); // Sauver la matrice de transformation translate(x, y); rotate(alpha); fill(c); stroke(c); rect(0, 0, w, h); popMatrix(); // Restaurer la matrice } }