How to set window size slightly smaller than display resolution size?

edited December 2015 in Questions about Code

Hello !

I am new to processing and I want to make the size of the window to something like :

size(displayWidth-50, displayHeight-50);

I tried many many things and searched a lot on the web and only find ways to make the window completly fullscreen. Any idea how I could do this ?

Thank you !


  • edited December 2015 Answer ✓

    When troubleshooting always post detailed specs. [-(

    In your particular case, I believe you're using Processing 3.
    Otherwise size(displayWidth-50, displayHeight-50); would certainly work under Processing 2.

    P3 can't deal w/ size() using anything but literal values anymore! @-)
    For that we gotta place it into settings() now:

    void settings() {
      size(displayWidth - 50, displayHeight - 50);
      //size(displayWidth * 3/4, displayHeight * 3/4); // 75%
      //size(displayWidth*3 >> 2, displayHeight*3 >> 2); // alt. 75%
  • this is a new faq I think...... for version 3

    is settings called automatically? Is there a size() command in setup as well? I guess so.....

  • Thank you very much for your answers!! I will give version number when asking from now on.

Sign In or Register to comment.