Browse Source

reset function for bounder, reset on right click

master
Victor Giers 1 year ago
parent
commit
5a1709adeb
2 changed files with 17 additions and 5 deletions
  1. 10
    2
      bounder.pde
  2. 7
    3
      scancropper2.pde

+ 10
- 2
bounder.pde View File

@@ -9,7 +9,7 @@ class Bounder {
return a;
}
PVector p1, p2, p3, p4;
void click() {
void leftclick() {
if (state < 3) state++;
else state = 1;
if (state == 1) {
@@ -21,9 +21,17 @@ class Bounder {
}
if (state == 3) {
h = -p2.dist(new PVector(mouseX, mouseY));
noLoop();
}
}
void rightclick(){
reset();
}
void reset(){
boolean redrawthis = (state == 3) ? true : false;
state = 0;
if(redrawthis) redraw();
}
void update() {
if (state == 2) {
h = -p2.dist(new PVector(mouseX, mouseY));

+ 7
- 3
scancropper2.pde View File

@@ -55,8 +55,7 @@ void keyPressed() {
}
if (key == ' ') {
if (bounder.state == 3) bounder.compile(false);
bounder.state = 0;
println("Bounder reset");
bounder.reset();
}
if (key == CODED) {
if (keyCode == RIGHT) {
@@ -76,7 +75,12 @@ void keyPressed() {
}

void mousePressed() {
bounder.click();
if(mouseButton == LEFT){
bounder.leftclick();
}
if(mouseButton == RIGHT){
bounder.rightclick();
}
}

void setImage(int i) {

Loading…
Cancel
Save