We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Is it possible to check the visibility state?
For example, I have this code:
void draw() {
if (!isVisible()) {
surface.setVisible(true);
}
}
/**
* @return true if visible, false otherwise
*/
boolean isVisible() {
}
What should the isVisible() method look like?
Answers
I am assuming if your sketch is not visible, then it is bc you set it so. In that case, I will suggest my code below.
Kf
Forgive me, maybe not quite correctly asked my question.
But I already found the solution to this problem myself.
Here it is:
import processing.awt.PSurfaceAWT; void draw() { if (!isVisible()) { surface.setVisible(true); } } /** * @return true if visible, false otherwise */ boolean isVisible() { return ((PSurfaceAWT.SmoothCanvas) surface.getNative()).getFrame().isVisible(); } void mousePressed() { surface.setVisible(false); }