Is there any way to switch whether sketch is full screen mode or not?

edited March 2016 in How To...

I want to switch full screen / non-full screen sketch, or decorated / undecorated frame while running using a specific key or something. I know there's fullScreen() method in Processing 3, but it can be used no more than once. Is there any official way to switch it using Processing 3?

Answers

  • If you read everything on the fullscreen() reference page you'll notice: "The size() and fullScreen() methods cannot both be used in the same program, just choose one."

    BUT I did manage to do this:

    Boolean big = true;
    void setup(){
      fullScreen();
      surface.setResizable(true);
    }
    
    void draw(){
    }
    
    void mousePressed(){
      if(big) {
        surface.setSize(600,400);
        big = false;
      } else {
        surface.setSize(800,600);
        big = true;
      }
    }
    

    So that's something? But then you are stuck with the sketch in the top left corner, lol. There might be a library that allow you to use both size() and fullScreen(), idk.

Sign In or Register to comment.