Hello
I’m new in Processing so I have a question for cellphones proportion…
Imagine that I have the following code:
void setup(){
size(900,1600);
}
void draw(){
backgroud(0);
ellipse(150,1200,300,300);
ellipse(450,1200,300,300);
ellipse(750,1200,300,300);
}
This program creates a box with a normal cellphone proportion 16:9, and it draws 3 circles at the bottom filling it without any space left to draw another circle.
What if I want to switch the “size(900,1600);” with “fullScreen();” in a way that the circles change their size according to the cellphones sizes, adapting and filling up the space resizing the balls? Is there any way to change the size of the circles acoording to the cellphone size in an easy way? Because I created a program that calculate the proportion and it is really annoying to use because in every object that contains size, xy position, velocity, and more I need to apply this proportion code.
Proportion code:
int cellYSize;
int cellXSize;
int xOffSize;
int xOS;
float allP;
void proportionStp(int Height){
//general cellphones proportion 16:9
cellYSize = Height;//changeable (height)
cellXSize = (cellYSize * 16)/9;
xOffSize = width - cellXSize;
xOS = xOffSize / 2;
allP = cellYSize/720.0; //This cellphone as 1
}
void showProportion(){
noStroke();
fill(0);
strokeJoin(MITER);
rect(0,0,xOS,cellYSize);
rect(width - xOS,0,width,cellYSize);
fill(50);
rect(0,cellYSize,width,height);
}
-In everything I used allP to multiply and correct the size, you don’t need to understand this tiny part of the code, just to show you that I think that I’m complicating things
I think that there is a better way that I don’t know so here I am, asking for help
Thank you and sorry if I wrote anything wrong