ControlP5: problem with Snapshots

edited October 2013 in Library Questions

Hi there!

I have a sketh with some CP5 Buttons. I would like to record snapshot to know if the buttons are switched or not (they have setSwitch(true)). I'm trying to use the snapshot propertie (cp5.getProperties().setSnapshot("preset0")), but it is not working, I think that the snapshots are not able to record this kind of controller.

Any suggestion would be greatly appreciated!

Regards, Raul

Answers

  • Answer ✓

    Why not use a Toggle instead?

    import controlP5.*;
    ControlP5 cp5;
    
    void setup() {
    
      size(400, 400); 
      cp5 = new ControlP5(this);
      cp5.addToggle("switch").setSize(50,50).getCaptionLabel().align(CENTER,CENTER);
    }
    
    void draw() {
      background( 0 );
    }
    
    void keyPressed() {
      switch(key) {
        case('1'):
        cp5.getProperties().setSnapshot("preset0");
        break;
        case('2'):
        cp5.getProperties().getSnapshot("preset0");
        break;
      }
    }
    
  • Hi!

    Yes, I think that's the best solution.

    Thanks a lot, Raul

Sign In or Register to comment.