浏览代码

reset function for bounder, reset on right click

master
Victor Giers 3 年前
父节点
当前提交
5a1709adeb
共有 2 个文件被更改,包括 17 次插入5 次删除
  1. 10
    2
      bounder.pde
  2. 7
    3
      scancropper2.pde

+ 10
- 2
bounder.pde 查看文件

@@ -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 查看文件

@@ -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) {

正在加载...
取消
保存