I am completely new to processing, and I wanted to test it by creating a simple sketch that draws a rectangle, however, when i run the sketch, a window pops up with nothing on it. I tried filling it, putting an outline on it, and various other things, nothing happened. I don't think it's a problem with the code but a problem with the app itself, and i'm not sure how to fix it. I am using processing 3.5.4 on windows.
Code:
class Sketch {
void setup() {
size(100, 100);
}
void draw() {
rect(50, 50, 25, 25);
}
}
Expected Output: A square shows up on screen.
Output: Nothing shows up
<iframe src="https://drive.google.com/file/d/1gAQsX0hpAyH_iSbUXkyO87a8NpXscLEL/preview" width="640" height="480"></iframe>
Chiming in with the obvious (don't hurt me if I didn't get your question right):
draw()
and setup()
are already of Processing. In fact, those you wrote into a class won't be automatically executed, as Processing will be looking for it's own methods. That's why you get this:
Which is, incidentally, exactly the same result as if you ran an empty sketch.
To fix this, just take draw()
and setup()
out of the class, and Processing will then find and run them:
void setup() {
size(100, 100);
}
void draw() {
rect(50, 50, 25, 25);
}
Have fun!