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