Setting size of display window to a percentage of screen size

size() usage is quite limited: It can be used only once and it requires explicit values, no variables. So you need to think a bit differently. You can use displayWidth to test display size and based on that set size like this.

void settings() {
  if (displayWidth > 2000) {
    size(2000,2000);
  } else if(displayWidth < 1000) {
    size(500,500);
  } else {
    size(1000,1000);
  }
  
}
1 Like