PulpCore

pulpcore.scene
Class LoadingScene

java.lang.Object
  extended by pulpcore.scene.Scene
      extended by pulpcore.scene.Scene2D
          extended by pulpcore.scene.LoadingScene

public class LoadingScene
extends Scene2D

A scene that downloads the asset catalog file (zip file). It automatically handles download errors by allowing the user to retry a failed download.

The default implementation creates a solid-colored background with a progress bar in the middle of the stage. Subclasses can change this appearance by invoking getMainLayer().removeAll() and adding other visual elements.


Constructor Summary
LoadingScene(String assetCatalogFile)
           
LoadingScene(String assetCatalogFile, Scene nextScene)
           
LoadingScene(String assetCatalogFile, Scene nextScene, int backgroundColor, CoreFont font)
           
 
Method Summary
 double getProgress()
          Returns a value from 0 to 1.
 void load()
          Performs any actions needed to load this scene.
 void onCompletion(Timeline timeline)
          Sets the timeline to start once the download is complete.
 void setErrorMessage(String message, String retryButtonText)
           
 boolean shouldProgressBeVisible()
           
 void unload()
          Forces all invokeAndWait() and addEventAndWait() calls to return, and removes all layers, sprites, and timelines.
 void update(int elapsedTime)
          Subclasses should call super.update() to handing downloading success and error.
 
Methods inherited from class pulpcore.scene.Scene2D
add, addEvent, addEventAndWait, addLayer, addTimeline, drawScene, getCursor, getMainLayer, getMaxElapsedTime, getNumSprites, getNumTimelines, getNumVisibleSprites, hideNotify, invokeAndWait, invokeLater, isDirtyRectanglesEnabled, isPaused, redrawNotify, remove, removeAllTimelines, removeLayer, removeTimeline, setCursor, setDirtyRectanglesEnabled, setMaxElapsedTime, setPaused, showNotify, updateScene
 
Methods inherited from class pulpcore.scene.Scene
reload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadingScene

public LoadingScene(String assetCatalogFile)

LoadingScene

public LoadingScene(String assetCatalogFile,
                    Scene nextScene)

LoadingScene

public LoadingScene(String assetCatalogFile,
                    Scene nextScene,
                    int backgroundColor,
                    CoreFont font)
Method Detail

onCompletion

public void onCompletion(Timeline timeline)
Sets the timeline to start once the download is complete. Normally, the timeline includes a SetScene event.


setErrorMessage

public void setErrorMessage(String message,
                            String retryButtonText)

load

public void load()
Description copied from 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.

Overrides:
load in class Scene

unload

public void unload()
Description copied from class: Scene2D
Forces all invokeAndWait() and addEventAndWait() calls to return, and removes all layers, sprites, and timelines.

Overrides:
unload in class Scene2D

update

public void update(int elapsedTime)
Subclasses should call super.update() to handing downloading success and error.

Overrides:
update in class Scene2D

shouldProgressBeVisible

public boolean shouldProgressBeVisible()

getProgress

public double getProgress()
Returns a value from 0 to 1. If the download hasn't started, returns a value less than 0.


PulpCore

Copyright © 2007-2009 Interactive Pulp, LLC.