How to start a sketch with full screen?

I’ve been trying multiple tactics to let my sketch open with a full screen.
With processing you just put fullScreen(); in setup and the sketch occupies the entire screen. With p5js this does not work.
The only way I manage in p5js is with this code:

function mousePressed() {
let fs = fullscreen();
fullscreen(!fs);
}
This however means that I can’t use the mouse any more.
I’m sure there is a better way.
Any help is appreciated.
Cheers,
Adrian.

1 Like

Hello @adrinalino :slightly_smiling_face:

I think this will give you the full screen display:

:nerd_face:

Hello @adrinalino,

The description for the reference discusses usage:
https://p5js.org/reference/#/p5/fullscreen

Try a different input such as a keyPressed().

function keyPressed() 
  {
  if (key == 'f') {
  // Your code here
  }
}

The above worked when integrated with the code from the reference.

:)

Hi guys, Thanks for your replies.

If I use " createCanvas(displayWidth, displayHeight);" it does open a window the size of my screen but it does not fill the screen. I still have to use sliders to scroll through the image.

The keyPressed function also works but first I have to click the image to make the keyPressed function work.
The reason for me to work with p5js in stead of processing is that it has nice shader editors. If I use the screen as a buffer then the initial screen does need to be full size.
There must be a smart way to open the screen full size.
Thanks for your help.