Program jumps out of object when i press a key

Hi, I am coding a visualisation of statistics and I made an intro where the user can chose between 3 options which lead to three different statistics.

I used if(key ==1) {



and so on.

The problem is when I press keys while the option is running it jumps back to intro.

Does anyone have an idea how i can avoid this.

//import import*; //Variablen für Entscheidung ob true oder false boolean introDec; boolean fivesecDec; boolean develDec; boolean gameDec; Intro intro; Fivesec fivesec; Devel devel; Game game; //Variablen Movie introFilm; void setup() { fullScreen(1); intro = new Intro(); fivesec = new Fivesec(); devel = new Devel(); game = new Game(); introFilm = new Movie(this, "Intro.mp4"); } void draw() { if (key == '1') { introDec =! introDec; fivesecDec = true; develDec = false; gameDec = false; } if (key =='2') { introDec =! introDec; fivesecDec = false; develDec = true; gameDec = false; } if (key == '3') { introDec =! introDec; fivesecDec = false; develDec = false; gameDec = true; } //Einblenden der Statistiken if (introDec) { fivesecDec = false; develDec = false; gameDec = false;; } if (fivesecDec) { introDec = false; fivesec.init();; } if (develDec) { introDec = false; fivesecDec = false; gameDec = false; devel.init();; } if (gameDec) { introDec = false; fivesecDec = false; develDec = false; game.init();; }//Ende void Draw //Auswählen der Statistiken if (key == 'X' || key == 'x') { develDec = false; gameDec = false; fivesecDec = false; introDec = true; } } //Abfrage der Frames durch void movieEvent(Movie m) {; } 

Thanks in advance

submitted by /u/levoxtrip
[link] [comments]

ControlP5 – Trying to implement multiple consoles.

I am trying to implement two onscreen areas for streaming information in a console style. Using the examples I used this code:

and this is the code I have changed it to:

It seems the console feature works with only "Println" inmind. I would like to get the addition console that i've created to real serial inputs that come from an arduino. That way I have an in program "println" console, and a "serialMonitor" console.

In the below image, I am trying to get the println to work on the left (which it does), and on the right have it act the same way but with only raw information from the arduino. The text shown "Position Test" is actually a string being displayed from serial however is been draw there with text(..) and not with the console feature of ControlP5

Is there a way that this can be done. Possibly creating a new handler for .addConsole(TextArea); that changes the type away from println?

submitted by /u/Metalsutton
[link] [comments]

ArtStation Application

Hey everyone, I have been working on a development tool to help with drawing shapes at specific positions on the screen. If you have ever tried to create a sprite/art asset in Processing you understand the frustration of getting everything in perfect position.

To that end I created this tool that allows you to draw directly to its canvas and manipulate the shapes as needed. Then when you are happy with your art asset, you can export the processing code to your clip board and paste it into your Processing IDE.

Though I originally created this tool for my own use, I would love to get feedback on its usability from other processing users! Please don't hesitate to respond here or on my github. I would love to ultimately make this tool available via the tools tab in the Processing IDE, so feedback for improvements are very welcome!

The source code can be found here, download the zip file to get the JAR:

submitted by /u/shifty4690
[link] [comments]

Converting SVG code into Processing

Is it possible to convert SVG code into Processing? With all respect to the language, it seems extremely time consuming to draw shapes using the coordinate system so I was thinking how great it would be to create shapes in vector editors such as Illustrator and exporting them as SVG then converting the SVG to Processing code.

For example, the following code creates a basic circle in SVG:

<svg height="500" width="500"> <circle cx="103" cy="103" r="100" stroke="black" stroke-width="3" fill="red" /> </svg> 

The following code is the same graphic in Processing:

// window size size(500,500); // circle stroke(#000000); strokeWeight(3); fill(#ff0000); ellipse(103,103,200,200); 

Surely there are some tools to convert the SVG into Processing code? I'm new to the language so don't know the ecosystem of tools available so am hoping that one of you could point me in the right direction.


P.S. I do not want to use the Load Display SVG function detailed here as I would like to convert the SVG into pure Processing code.

submitted by /u/lukem118
[link] [comments]