We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I've got a nice fullScreen()'esque toggle, via this tip here... But how can one turn off the frame decoration in 3.0? The previous workarounds aren't allowed– no more 'frame' and the new 'surface' doesn't have that function. Any ideas/workarounds?
boolean isFullscreen = false;
void setup() {
size(800, 600);
surface.setResizable(true);
}
void draw() {
background(255);
line(100, 100, width-100, height-100);
}
void keyPressed() {
if (key == 'f') {
if (!isFullscreen) {
surface.setLocation(0, 0);
surface.setSize(displayWidth, displayHeight);
//frame.setUndecorated(true); // not allowed
//surface.setUndecorated(true); // doesn't exist
isFullscreen = true;
} else {
surface.setSize(800, 600);
//frame.setUndecorated(false);
isFullscreen = false;
}
}
}
Answers
As far as I know, frame has been removed from P3, so you just cannot achieve what you want.
But, you could make it restart every time you press 'f' so that way user can switch from fullscreen to not fullscreen.
You can still get to the
frame
variable, you just have to jump through a few hoops, and it depends on which renderer you use. It usually takes scouring the Processing source code to figure out exactly how to get to what you want (and when to do it).Here's an example for the default renderer:
Also note that you can only call
setUndecorated()
before the frame is visible, so you can't do exactly what you're trying to do anyway.Yeah, really only useful if this can be called mid-run, so one can toggle between the two modes. Guess I should put this as a feature request for upcoming versions to try and reincorporate the function.
@FFD8 This isn't something that Processing can change. This is a symptom of Java's restriction, which is most likely a restriction from an even lower level.
You can't change whether a window is decorated after it's visible. That's not Processing's fault.
What you can do is create a new frame and transfer the model over, then hide the old frame. That's more complicated, so it's up to you if it's worth the extra effort.
@KevinWorkman - Ah ok.. for some reason I thought I'd played with this on the fly back in 2.2.1, but maybe I only imagined it. Good (+bad) to know that it's deeper than Processing. Your idea about creating the frame on the fly and passing everything to it is a really interesting one. Maybe that's what you were getting at up above.
In the end, I decided to just do fullScreen all the time for the tool– but will definitely play around with this idea in the near future. Thanks!