A typical game will have several Scenes: for example, a title scene, menu scene, main game scene, high score scene, help scene, etc.
For Applets, the first Scene is defined by the "scene" applet parameter:
<param name="scene" value="MyFirstScene" />
The {@link pulpcore.Stage} is responsible for invoking the Scene's methods, with the exception of {@link #reload()}. @see pulpcore.Stage#setScene(Scene) @see pulpcore.Stage#replaceScene(Scene) @see pulpcore.Stage#pushScene(Scene) @see pulpcore.Stage#popScene() */ public abstract class Scene { /** Performs any actions needed to load this scene. By default, this method does nothing. Typical implementations will load images and sounds in this method. */ public void load() { } /** Performs any actions needed to unload this scene. By default, this method does nothing. This method should return as quickly as possible; if unloading a scene requires a long computation, it should be done in a separate thread. */ public void unload() { } /** Reloads the scene. This method calls {@code unload()} followed by {@code load()}. */ public synchronized void reload() { unload(); load(); } /** Notifies that this scene has been shown after another Scene is hidden or immediately after a call to start(). Note, this method is not called if the OS shows the app. By default, this method does nothing. */ public void showNotify() { } /** Notifies that this scene has been hidden by another Scene or immediately before a call to stop(). Note, this method is not called if the OS hides the app. By default, this method does nothing. */ public void hideNotify() { } /** Notifies that this scene that the Stage or the OS has requested a full redraw. By default, this method does nothing. */ public void redrawNotify() { } /** Updates the scene. This method is periodically called by the {@link pulpcore.Stage} while this Scene is active. A scene will typically update sprites and handle input.
When a Scene is first shown (after a call to showNotify), the elapsedTime is zero.
The Stage starts a synchronized block on this Scene before calling this method and ends the block after {@link #drawScene(CoreGraphics) } returns. @param elapsedTime time, in milliseconds, since the last call to updateScene(). */ public abstract void updateScene(int elapsedTime); /** Draws to the surface's graphics context. The Stage calls this method after calling {@link #updateScene(int) }.
The Stage starts a synchronized block on this Scene before calling {@link #updateScene(int) } and ends the block after this method returns. @param g the CoreGraphics object to draw to. The CoreGraphics clip is set to the entire display area. */ public abstract void drawScene(CoreGraphics g); }