xxxxxxxxxx
ArrayList <Mark> brushMarks = new ArrayList <Mark> ();
float CRY, CRX;
float xPivot;
float yPivot;
String CT;
void setup(){
size (500, 500, P3D);
//brushMarks.add(new Mark(100,100));
//brushMarks.add(new Mark(200,200));
xPivot = width/2;
yPivot = height/2;
CT = "normal";
}
void draw(){
//CRY += 1;
background(0, 0, 50);
textAlign(CENTER);
text("Brush: " +CT, width/2, 70);
textSize (20);
lights();
translate(xPivot, 0);
translate(0, yPivot);
if(keyPressed){
if(keyCode == LEFT){
CRY += 0.2;
}
if(keyCode == RIGHT){
CRY -= 0.2;
}
if(keyCode == UP){
CRX += 0.2;
}
if(keyCode == DOWN){
CRX -= 0.2;
}
}
//Mark newMark;
//newMark = new Mark(width/2, height/2);
//newMark.render();
for (Mark brushMark:brushMarks){
brushMark.render();
}
if(mousePressed){
brushMarks.add (new Mark(mouseX - xPivot, mouseY - yPivot));
}
}
void keyPressed(){
if (key == '1'){
CT = "normal";
}
if (key == '2'){
CT = "sticky";
}
if (key == '3'){
CT = "nice curves";
}
if (key == '4'){
CT = "Semi-AutomaticallySetWriting";
}
}
class Mark {
//atri
float xPos, yPos, yRot, xRot;
String Tool;
//cons
Mark(float x,float y){
xPos = x;
yPos = y;
yRot = CRY;
xRot = CRX;
Tool = CT;
}
//meth
void render(){
pushMatrix();
noStroke();
if (Tool == "normal") {
rotateY (CRY - yRot);
rotateX (CRX - xRot);
translate(xPos, yPos);
fill(mouseX, mouseY, 255);
box (20);
}
if (Tool == "sticky") {
rotateY (CRY - yRot);
rotateX (CRX - xRot);
translate(xPos, yPos);
fill(mouseX, mouseY, 255);
box (10);
}
if (Tool == "nice curves") {
rotateY (CRY - yRot);
rotateX (CRX - xRot);
translate(xPos, yPos);
fill(mouseX, mouseY, 255);
sphere (20);
}
if (Tool == "Semi-AutomaticallySetWriting") {
rotateY (CRY - yRot);
rotateX (CRX - xRot);
translate(xPos, yPos);
fill(random(255), random(10), random(255));
text ("gay", random(30), random(30));
}
popMatrix();
}
}