Hello, im making an app for doing pixel art using mobiles. I own a Motorola Moto G and did the whole layout for my screen (729x1184 pixels) just to decide what goes where but now that its done I cant figure how to make it responsive to different screen sizes. I have tried using, for example, width/16 as the size for each "pixel" and make a 16x16 grid for drawing, but (examples):
if I use this nothing appears at the screen
int tam = width/16;
void setup(){
int cor = 0;
for (int i = 0; i < 16; i++){
fill(cor, 0 , 0);
rect(cor, 0, tam, tam);
cor += tam;
}
}
if I do this it works
void setup(){
int tam = width/16;
int cor = 0;
for (int i = 0; i < 16; i++){
fill(cor, 0 , 0);
rect(cor, 0, tam, tam);
cor += tam;
}
}
does that mean I will have to create a variable inside the scope its going to be used for every variable that needs to be responsive? It doesnt look right...
Another question, is there any way to ask the device for its screen size? In this case I have some buttons underneath the drawing matrix (like turning grid on/off, color palete and others) wich will have to be a button to a popup windows depending on the screen size (a button called palete that makes the color palete pops up for example). In this case, if the drawing matrix occupies more then a certain percentage of the screen height, considering the size of the matrix as the size of the screen width, as each drawable "pixel" has width/16 and the matrix is 16x16, the layout will be completely different from mobiles with screen sizes that fit the whole thing.
Any tips? Solutions? Anyone facing the same problem?
thanks in advance