/** * Called to dispose of resources and shut down the sketch. * Destroys the thread, dispose the renderer, and notify listeners. * <p/> * Not to be called or overriden by users. If called multiple times, * will only notify listeners once. Register a dispose listener instead. */ final public void dispose() { // moved here from stop() finished = true; // let the sketch know it is shut down time activity = null; // don't run stop and disposers twice // call to shut down renderer, in case it needs it (pdf does) if (g != null) g.dispose(); //surfaceView.destroyDrawingCache(); //surfaceView.surfaceDestroyed(surfaceView.getHolder()); //surfaceView = null; // window = null; handleMethods("dispose"); if (thread == null) return; thread = null; }
@Override public void onPause() { super.onPause(); // TODO need to save all application state here! // System.out.println("PApplet.onPause() called"); paused = true; handleMethods("pause"); pause(); // handler for others to write }
@Override public void onResume() { super.onResume(); // TODO need to bring back app state here! if (DEBUG) System.out.println("PApplet.onResume() called"); paused = false; handleMethods("resume"); //start(); // kick the thread back on resume(); }
/** * Called to dispose of resources and shut down the sketch. * Destroys the thread, dispose the renderer,and notify listeners. * <p> * Not to be called or overriden by users. If called multiple times, * will only notify listeners once. Register a dispose listener instead. */ public void dispose() { // moved here from stop() finished = true; // let the sketch know it is shut down time // don't run the disposers twice if (surface.stopThread()) { // shut down renderer if (g != null) { g.dispose(); } // run dispose() methods registered by libraries handleMethods("dispose"); } if (platform == MACOSX) { try { final String td = "processing.core.ThinkDifferent"; final Class<?> thinkDifferent = getClass().getClassLoader().loadClass(td); thinkDifferent.getMethod("cleanup").invoke(null); } catch (Exception e) { e.printStackTrace(); } } }
/** * Called by the browser or applet viewer to inform this applet that it * should start its execution. It is called after the init method and * each time the applet is revisited in a Web page. * <p/> * Called explicitly via the first call to PApplet.paint(), because * PAppletGL needs to have a usable screen before getting things rolling. */ public void start() { // paused = false; // unpause the thread // removing for 3.0a5, don't think we want this here resume(); handleMethods("resume"); surface.resumeThread(); }
handleMethods("pause");
handleMethods("draw"); handleMethods("post");
handleMethods("pre"); handleMethods("draw"); handleMethods("post");
handleMethods("draw"); handleMethods("post");
protected void handleKeyEvent(KeyEvent event) { // keyEvent = event; key = event.getKey(); keyCode = event.getKeyCode(); switch (event.getAction()) { case KeyEvent.PRESS: keyPressed = true; keyPressed(event); break; case KeyEvent.RELEASE: keyPressed = false; keyReleased(event); break; } handleMethods("keyEvent", new Object[]{event}); }
handleMethods("keyEvent", new Object[] { event });
handleMethods("mouseEvent", new Object[] { event });
handleMethods("mouseEvent", new Object[]{event});