Control through multiple windows

edited October 2013 in Using Processing

Hi everyone.

I've been experimenting with multiple windows (as shown in this post: http://forum.processing.org/one/topic/multiple-windows-2-4-2011.html), and I've succeeded in using the main window (the red one) to control the Second Applet by using void mousePressed(), then changing the framerate through s.frameRate().

How do I do this the other way around?

-- MenteCode

Answers

  • You need to pass the main PApplet reference to any other class which needs to control the main sketch! %%-

  • Do you mean to say that I should make a class for the main applet as well, so I could control it?

    -- MenteCode

  • edited October 2013 Answer ✓

    No! I've meant that you have to pass that reference to your other class. Usually through its constructor. :(|)
    Of course in order for that to work, you have to instantiate that class within the main sketch.
    And use this keyword as the passing argument! :-B
    This way, this means the sketch's own instance reference. Not from some other object's reference!

    void setup() {
      new Bossy(this);
      exit();
    }
    
    class Bossy {
      final PApplet p;
    
      Bossy(PApplet pa) {
        p = pa;
      }
    }
    
Sign In or Register to comment.