MCPcopy Create free account
hub / github.com/benfry/processing4 / init

Method init

core/src/processing/core/ThinkDifferent.java:63–76  ·  view source on GitHub ↗

Initialize the sketch with the quit handler. Initialize the sketch with the quit handler such that, if there is no known crash, the application will not exit on its own if this is the first quit attempt. @param sketch The sketch whose quit handler callback should be set.

(final PApplet sketch)

Source from the content-addressed store, hash-verified

61 * @param sketch The sketch whose quit handler callback should be set.
62 */
63 static public void init(final PApplet sketch) {
64 getDesktop().setQuitHandler((event, quitResponse) -> {
65 sketch.exit();
66
67 boolean noKnownCrash = PApplet.uncaughtThrowable == null;
68
69 if (noKnownCrash && !attemptedQuit) { // haven't tried yet
70 quitResponse.cancelQuit(); // tell OS X we'll handle this
71 attemptedQuit = true;
72 } else {
73 quitResponse.performQuit(); // just force it this time
74 }
75 });
76 }
77
78
79 /**

Callers

nothing calls this directly

Calls 2

getDesktopMethod · 0.95
exitMethod · 0.45

Tested by

no test coverage detected