Create a menu interface that connects to various sketches....

edited November 2014 in How To...

Hey All!!

I've got a number of interactive sketches that use colourUnderMouse to create interactions with img files and am trying to contain them all in a single sketch that uses a button menu to call them up.

I've been told this is simple but in checking out ControlP5, G4P and guido I can't figure it out....

Any help please???

L

Answers

  • What trouble are you having? What exactly are you confused about? Where is your MCVE?

    It's pretty impossible for us to help with questions as vague as "I can't figure it out". Can you try to be more specific?

  • If you can make a common setup(), you can put each sketch (the part in draw()) in its own function, then the real draw() part will call a function, depending on your input.

  • Thanks PhiLho - I'll give that a try. Right now I'm using stages to initiate different tabbed functions using keyPressed.

    void draw () { if (stage == 1) { textSize (50); text("GAME TITLE", 120, 100); textSize (20); text ("For Game 1, press A", 140, 130); text ("For Game 2, press S", 140, 150); if (keyPressed) { if (key == 'a' || key == 'A') { stage = 2;
    if (stage == 2) { drawGame1 (); } } if (key == 's' || key == 'S') { stage = 3;
    if (stage == 3) { drawGame2 ();

    It is initiating the screens as background images but not allowing the interactions to run which is infuriating...

  • instead of doing keyPressed, better use the extra function keyPressed() and evaluate the key there

    also in that function have a switch(stage){ .... to handle the different stages concerning interactions --- so you have a different behaviour in keypressed depending on stages as you have now in draw()

    same goes for mousePressed() mouseDragged and the like....

    ;-)

Sign In or Register to comment.