So I'm trying to get the scene to (proportionally) re-size when the display window is re-sized. Essentially what I have is a program that has two methods that draw a simple image and currently my window is just a set width and height but I want it to be able to be re-sized and the image just gets redrawn and fits inside the newly re-sized window.
I've looked through multiple topics on this but none seem to be very helpful for my issue. I've tried to implement what some of those other topics were talking about but haven't had much luck.
Below is my code for this:
Code:
void setup()
{
size(500,500);
frame.setResizable(true);
noLoop();
background(0,255,0);
}
//draw person method
void drawPerson()
{
//create head
ellipse(250,250,150,150);
//left eye
ellipse(220,220,20,20);
ellipse(220,220,8,8);
//right eye
ellipse(280,220,20,20);
ellipse(280,220,8,8);
//mouth
line(230,285,270,285);
line(215,270,230,285);
line(270,285,285,270);
//body
line(250,324,250,425);
//arms
line(200,345,300,345);
//legs
line(250,425,230,470);
line(250,425,270,470);
}
void drawSun()
{
ellipse(500,0,160,160);
line(340,30,420,10);
line(355,120,450,60);
line(480,76,470,150);
}
void draw()
{
drawSun();
drawPerson();
}
public void mousePressed()
{
redraw();
}
Any help would be appreciate, thanks!