Dynamic Screen & Background Resize (Need Guidance)
in
Programming Questions
•
2 years ago
Hi All,
I am new here. Not well-versed in programming but learning.
I am trying to have a dynamic screen resize + a function thet would take a loaded JPEG, and based on the auto detected screen aspect ratio, centre and rescale it.
Below is part of my code so far. Nothing seems to be happening to the image. I would appreciate any help or any existing discussion that you can point me to. Thanks.
- PImage b;
int amount = 20; //amount of points to draw
float screenratio;
float alph = 0.0;
void setup() {
size((int)screenWidth, (int)screenHeight); // + To Add auto detect background image width
pg1 = makeTexture(40);
frameRate(30);
smooth();
b = loadImage("fantasy.jpg");
screenratio = screenWidth / screenHeight;
}
void draw(){
imageMode(CENTER);
image(b,0,0,screenratio*b.width,b.height);
2