How I show object after press button until I change other?

edited March 2016 in How To...

hi, I'm trying to show something after press button. But now I can show that only while press button. How can I do it stay until I press other button?

This code, I'm modify from SMT example.

import vialab.SMT.*;

void setup() {
  size(400, 400, SMT.RENDERER);
  SMT.init(this, TouchSource.AUTOMATIC);

  SMT.add(new ButtonZone("TestButton1", 10, 10, 200, 50, "Button1", 20));
  SMT.add(new ButtonZone("TestButton2", 10, 70, 200, 50, "Button2", 20));
}

void draw() {
  background(#FEFCFF);

  ButtonZone b = SMT.get("TestButton1", ButtonZone.class);
  if (b.isButtonDown()) {
    text("x = ...\ny = ...\nz = ... ", 200, 200);
    fill(#ED1E28);
    rect(10, 200, 150, 150);
  }

  ButtonZone c = SMT.get("TestButton2", ButtonZone.class);
  if (c.isButtonDown()) {
    text("a = ...\nb = ...\nc = ... ", 200, 200);
    fill(#3F49CC);
    rect(10, 200, 150, 150);
  }
}

void touchTestButton1() {}

void pressTestButton1() {
  println("Button1 Pressed");
}

void touchTestButton2() {}

void pressTestButton2() {
  println("Button2 Pressed");
}
Tagged:
Sign In or Register to comment.