We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have no idea why variables x and y gives me value 50.
// GLOBAL VARIABLES
float x = width / 2;
float y = height / 2;
float rectWidth = 50;
float rectHeight = 75;
void setup(){
fullScreen();
println(width + " WIDTH");
println(height + " HEIGHT");
println(x + " X");
println(y + " Y");
}
void draw(){
background(0);
fill(255);
rect(x, y, rectWidth, rectHeight);
}
In console I get this:
1366 WIDTH
768 HEIGHT
50.0 X
50.0 Y
Answers
Width and height do NOT work before size or fullScreen
you need to split the lines up and call them in setup after size / fullscreen
I need to initialize x and y variables in setup() function :((
Thank you as always Chrisir ;)
;-)