I'm trying to get a program window to scale properly.
I designed the program to fit a screen with a 3:2 aspect ratio, so I set the size to 1020,680 while building it, with the intention of using size(displayWidth, displayHeight) when finished.
Of course, that would simply run the program at a size of 1020,680 with blank spaces beyond that.
So in all of my X-locations I use the simple equation "width/(1020/X)", and in all my Y-locations use "height/(680/Y)"
I've used this method to make program windows scale to different sizes before, but never on a program as complicated as this one, and sure enough it didn't work this time. So I wrote a very simple program to figure out where the issue is and then started adding layers of complexity until eventually got to this point:
(Note: it didn't get very complex before I ran into a problem)
PImage bubble;
void setup(){
size(1020,680);
bubble = loadImage("bubble.png");
print(width + " ");
println( height);
}
void draw(){
background(0);
noFill();
stroke(255);
imageMode(CORNER);
ellipse( 150,100,50,50);
stroke(0,0,255);
ellipse( width/(1020/150),height/(680/100),50,50);
}
width = 1020.... height = 680...
so.... width/(1020/150) = 1020/(1020/150) = 150
and.... height/(680/100) = 680/(680/100) = 100
so why-oh-why are those two circles not in the same location?