Skip to content

Commit 9453b6b

Browse files
committed
Added the functionality of dynamic app window resizing
1 parent 2dfe385 commit 9453b6b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

main.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
let appWidth,appHeight; //variable to maintain the size of the app
12
function setup()
23
{
3-
createCanvas(windowWidth,windowHeight);
4+
appWidth=(windowWidth<1280)?1280:windowWidth; //minimum width of the app should be 1280 pixels and max should be the windowWidth
5+
appHeight=(windowHeight<720)?720:windowHeight; //minimum height of the app should be 720 pixels and max should be the windowHeight
6+
createCanvas(appWidth,appHeight);
47
}
58

69
function draw()
@@ -13,5 +16,7 @@ function draw()
1316
}
1417
function windowResized()
1518
{
16-
resizeCanvas(windowWidth, windowHeight);
19+
appWidth=(windowWidth<1280)?1280:windowWidth;
20+
appHeight=(windowHeight<720)?720:windowHeight;
21+
resizeCanvas(appWidth, appHeight);
1722
}

0 commit comments

Comments
 (0)