We are about to switch to a new forum software. Until then we have removed the registration on this forum.
i should be getting something like 1.777778, not 1.0.
Code:
void settings(){
//Code for aspect ratio
int h = displayHeight;
int w = displayWidth;
float ratio = w/h;
ratio = ratio*100;
int numRatio = round(ratio);
//Possible values of numRatio are: 125(5:4), 133(4:3), 160(16:10), 178(16:9)
int[] aspect = new int[2];
switch(numRatio){
case(125): aspect[0]=5; aspect[1]=4; break;
case(133): aspect[0]=4; aspect[1]=3; break;
case(160): aspect[0]=16; aspect[1]=10; break;
case(178): aspect[0]=16; aspect[1]=9; break;
}
println(w + ", " + h + ", " + displayWidth + ", " + displayHeight + ", " + ratio + ", " + numRatio + ", " + aspect[0] + ", " + aspect[1]);
}
output:
1366, 768, 1366, 768, 1.0, 1, 0, 0
ive tried using the actual displayHeight and displayWidth vars, but they didnt work so i tried to assign them before hand. Not sure why its returning 1.0.
Answers
Solved. the w and h variable needed to be a float. works as planned.