How to make the close button do nothing?

edited June 2015 in How To...

I want to make the "game" I'm working on do nothing on close. I mean, if you want to exit using the close button, it will make nothing until you can press a certain button in it.

Answers

  • edited June 2015 Answer ✓

    That's not easy. I'm not sure it's even possible. Maybe you could just hide the frame so there is no X button?

    void setup(){
      size(220,220);
      frame.removeNotify();
      frame.setUndecorated(true);
      background(255);
    }
    
    void draw(){
      line(mouseX,mouseY,pmouseX,pmouseY);
    }
    
    void keyPressed(){
      exit();
    }
    
  • you can also kill ESC by key=0;

Sign In or Register to comment.