kritzikratzi / fullscreen-p5

Fullscreen-API for the Processing programming language
http://www.superduper.org/processing/fullscreen_api/
MIT License
15 stars 7 forks source link

fs.setResolution(screen.width, screen.height) not supported #16

Closed swinton closed 14 years ago

swinton commented 14 years ago

I'm trying to set full screen resolution to the screen.width and screen.height but it doesn't seem to be supported, my sketch just defaults to the sketch size, i.e.

void setup(){
// set size to 640x480
size(640, 480);

// 5 fps
frameRate(5);

// Create the fullscreen object
fs = new FullScreen(this);

fs.setResolution(screen.width, screen.height);

// enter fullscreen mode
fs.enter();
}

Any suggestions for making this work?

kritzikratzi commented 14 years ago

well, the size of the sketch should always be the size of the sketch :) what exactly goes wrong? in this case the sketch should be 640x480, the screen resolution should not switch and when in fullscreen mode you should have a black spacing border around your sketch. is that what is happening?

swinton commented 14 years ago

Yep, that is what is happening (I'm getting the black border).

I think I've sorted this now, by explicitly setting the frame and sketch size in draw(), depending on whether we're in full-screen mode, i.e.:


import fullscreen.*;
FullScreen fs;

void setup() {
  size(640, 480);
  fs = new FullScreen(this);
}

void draw() {
  if (fs.isFullScreen()) {
    // change the sketch size for full-screen mode
    size(screen.width, screen.height);
    frame.setSize(screen.width, screen.height + 22);
    fs.setResolution(screen.width, screen.height);
  } else {
    size(640, 480);
    frame.setSize(640, 480 + 22);
    fs.setResolution(640, 480);
  }

  // start sketching... :)
}
kritzikratzi commented 14 years ago

actually this is exactly expected behaviour, i think what you want is simply this:

void setup(){ // set size to 640x480 size(640, 480);

// 5 fps frameRate(5);

// Create the fullscreen object fs = new FullScreen(this);

fs.setResolution( 640, 480 ); // or use fs.setResolution( width, height ) instead!

// enter fullscreen mode fs.enter(); }

(without your extra code from draw)

in the next version some kind of automatic scaling to the screen size will be added, but it's gonna be a bit of wait. until then you're stuck with this behaviour.

sorry, have to close because it's not a bug, but your wish will be taken care of (one day...)