Dear all,
I would like to rotate a rectangle 90 deg each time I press a button.
Below are my syntaxes.
import processing.opengl.*;
import controlP5.*;
ControlP5 controlP5;
Button button1;
void setup()
{
size(400, 400, OPENGL);
frameRate(25);
controlP5 = new ControlP5(this);
controlP5.setAutoDraw(false);
button1 = controlP5.addButton("RotateZ", 1, 50, 50, 50, 50);
}
void draw()
{
background(0);
noStroke();
lights();
fill(255);
rect(150, 150, 100, 150);
controlP5.draw();
}
void RotateZ()
{
// some codes to point to the rectangle
rotateZ(-PI/2);
// Need a loop to perform the act of each time I pressed the button, it will rotate the rectangle 90 deg
}
I have played around for days to point the rectangle to the rotation but with no luck.
I have encountered errors such as "cannot convert void to int".
I am kinda of noob to programming so pardon me if this is a trivial question.
Thank you all in advanced:)
hanny
1