org.xith3d.ui.hud.widgets.assemblies
Class LoadingScreen

java.lang.Object
  extended by org.xith3d.ui.hud.widgets.assemblies.LoadingScreen
All Implemented Interfaces:
LoadingScreenUpdater, ProgressValueSource, ResourceLoaderListener

public class LoadingScreen
extends java.lang.Object
implements LoadingScreenUpdater, ProgressValueSource, ResourceLoaderListener

Many games need a loading screen. This clas will help you with it.

See Also:
LoadingScreenUpdater

Constructor Summary
LoadingScreen(float width, float height, java.lang.String backgroundTexture, int maxValue, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
LoadingScreen(float width, float height, java.lang.String backgroundTexture, ProgressBar.Description pbDesc, int maxValue, Label.Description labelDesc, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
LoadingScreen(float width, float height, Texture2D backgroundTexture, int maxValue, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
LoadingScreen(float width, float height, Texture2D backgroundTexture, ProgressBar.Description pbDesc, int maxValue, Label.Description labelDesc, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
LoadingScreen(org.openmali.types.twodee.Sized2fRO size, java.lang.String backgroundTexture, ProgressBar.Description pbDesc, int maxValue, Label.Description labelDesc, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
LoadingScreen(org.openmali.types.twodee.Sized2fRO size, Texture2D backgroundTexture, ProgressBar.Description pbDesc, int maxValue, Label.Description labelDesc, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
 
Method Summary
 void afterAllResourceLoaded(ResourceLoader resLoader)
          
 void afterResourceBundleLoaded(ResourceLoader resLoader, java.lang.Class<? extends ResourceRequest> bundleType)
          
 void afterResourceLoaded(ResourceLoader resLoader, ResourceRequest request, java.lang.Object resource)
          
 void attach(WidgetContainer container)
          Adds all LoadingScreen Widgets to the given WidgetContainer.
 void beforeAnyResourceLoaded(ResourceLoader resLoader)
          
 void beforeResourceBundleLoaded(ResourceLoader resLoader, java.lang.Class<? extends ResourceRequest> bundleType)
          
 void beforeResourceLoaded(ResourceLoader resLoader, ResourceRequest request)
          
static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas, java.lang.String backgroundTexture, int maxValue)
          Creates a new LoadingScreen with the given parameters.
static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas, java.lang.String backgroundTexture, int maxValue, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas, java.lang.String backgroundTexture, ProgressBar.Description pbDesc, int maxValue, Label.Description labelDesc, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas, Texture2D backgroundTexture, int maxValue)
          Creates a new LoadingScreen with the given parameters.
static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas, Texture2D backgroundTexture, int maxValue, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas, Texture2D backgroundTexture, ProgressBar.Description pbDesc, int maxValue, Label.Description labelDesc, java.lang.String initialCaption)
          Creates a new LoadingScreen with the given parameters.
 void detach()
          Removes all LoadingScreen Widgets from their WidgetContainer.
 Image getBackgroundImage()
           
 Label getCaptionLabel()
           
 HUD getHUD()
           
 int getMaxProgressValue()
          
 ProgressBar getProgressBar()
           
 java.lang.String getProgressCaption()
           
 int getProgressValue()
           
 RenderLoopController getRenderLoopController()
           
 RenderPass getRenderPass()
           
 void init(int maxValue, java.lang.String caption, java.lang.String backgroundTexture)
          Initializes the progress, caption and background image.
 void init(int maxValue, java.lang.String caption, Texture2D backgroundTexture)
          Initializes the progress, caption and background image.
 void setRenderLoopController(RenderLoopController rlc)
          Sets the RenderLoopController, that is invoked each update.
 void update()
          Updates the progress value incremented by one and leaves the caption unchanged.
 void update(int incValue)
          Updates the progress value and leaves the caption unchanged.
 void update(int incValue, java.lang.String caption)
          Updates the progress value and caption.
 void update(int incValue, java.lang.String caption, java.lang.String backgroundTexture)
          Updates the progress value, caption and background image.
 void update(int incValue, java.lang.String caption, Texture2D backgroundTexture)
          Updates the progress value, caption and background image.
 void update(int incValue, Texture2D backgroundTexture)
          Updates the progress value and background image.
 void update(java.lang.String caption)
          Updates the progress value incremented by one and sets the new caption.
 void update(Texture2D backgroundTexture)
          Increases the progress value by one and updates the background image.
protected  void updateContent(int value, int maxValue, java.lang.String caption, Texture2D backgroundTexture)
          Updates all the contents of the LoadingScreen.
 void updateOnly(java.lang.String caption)
          Updates the caption only.
 void updateOnly(Texture2D backgroundTexture)
          Updates the background image only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadingScreen

public LoadingScreen(float width,
                     float height,
                     Texture2D backgroundTexture,
                     ProgressBar.Description pbDesc,
                     int maxValue,
                     Label.Description labelDesc,
                     java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.

Parameters:
width - the width of the backgroundImage
height - the height of the backgroundImage
backgroundTexture - the Texture for the backgroundImage
pbDesc - description of the ProgressBar
maxValue - maximum value for the ProgressBar
labelDesc - description of the caption label Widget
initialCaption - initial caption

LoadingScreen

public LoadingScreen(float width,
                     float height,
                     java.lang.String backgroundTexture,
                     ProgressBar.Description pbDesc,
                     int maxValue,
                     Label.Description labelDesc,
                     java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.

Parameters:
width - the width of the backgroundImage
height - the height of the backgroundImage
backgroundTexture - the Texture for the backgroundImage
pbDesc - description of the ProgressBar
maxValue - maximum value for the ProgressBar
labelDesc - description of the caption label Widget
initialCaption - initial caption

LoadingScreen

public LoadingScreen(org.openmali.types.twodee.Sized2fRO size,
                     Texture2D backgroundTexture,
                     ProgressBar.Description pbDesc,
                     int maxValue,
                     Label.Description labelDesc,
                     java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.

Parameters:
size - the size of the backgroundImage
backgroundTexture - the Texture for the backgroundImage
pbDesc - description of the ProgressBar
maxValue - maximum value for the ProgressBar
labelDesc - description of the caption label Widget
initialCaption - initial caption

LoadingScreen

public LoadingScreen(org.openmali.types.twodee.Sized2fRO size,
                     java.lang.String backgroundTexture,
                     ProgressBar.Description pbDesc,
                     int maxValue,
                     Label.Description labelDesc,
                     java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.

Parameters:
size - the size of the backgroundImage
backgroundTexture - the Texture for the backgroundImage
pbDesc - description of the ProgressBar
maxValue - maximum value for the ProgressBar
labelDesc - description of the caption label Widget
initialCaption - initial caption

LoadingScreen

public LoadingScreen(float width,
                     float height,
                     Texture2D backgroundTexture,
                     int maxValue,
                     java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.

Parameters:
width - the width of the backgroundImage
height - the height of the backgroundImage
backgroundTexture - the Texture for the backgroundImage
maxValue - maximum value for the ProgressBar
initialCaption - initial caption

LoadingScreen

public LoadingScreen(float width,
                     float height,
                     java.lang.String backgroundTexture,
                     int maxValue,
                     java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.

Parameters:
width - the width of the backgroundImage
height - the height of the backgroundImage
backgroundTexture - the Texture for the backgroundImage
maxValue - maximum value for the ProgressBar
initialCaption - initial caption
Method Detail

setRenderLoopController

public void setRenderLoopController(RenderLoopController rlc)
Sets the RenderLoopController, that is invoked each update.


getRenderLoopController

public RenderLoopController getRenderLoopController()
Returns:
the RenderLoopController, that is invoked each update

getBackgroundImage

public Image getBackgroundImage()
Returns:
the Image Widget holding the background image.

getCaptionLabel

public Label getCaptionLabel()
Returns:
the Label holding the caption for the progress.

getProgressBar

public ProgressBar getProgressBar()
Returns:
the ProgressBar Widget.

getHUD

public HUD getHUD()
Returns:
the value of getProgressBar().getHUD().

getRenderPass

public RenderPass getRenderPass()
Returns:
the RenderPass assotiated to the HUD
See Also:
HUD.getRenderPass()

getProgressValue

public int getProgressValue()
Specified by:
getProgressValue in interface ProgressValueSource
Returns:
the current progress value.

getMaxProgressValue

public int getMaxProgressValue()

Specified by:
getMaxProgressValue in interface ProgressValueSource
Returns:
the progress-value, that corresponds to 100%.

getProgressCaption

public java.lang.String getProgressCaption()
Returns:
the current progress caption.

attach

public void attach(WidgetContainer container)
Adds all LoadingScreen Widgets to the given WidgetContainer.

Parameters:
container - the WidgetContainer to place them on

detach

public void detach()
Removes all LoadingScreen Widgets from their WidgetContainer.


init

public void init(int maxValue,
                 java.lang.String caption,
                 Texture2D backgroundTexture)
Initializes the progress, caption and background image. The progress value is resetted to zero.

Specified by:
init in interface LoadingScreenUpdater
Parameters:
maxValue - the new maximum progress value
caption - the new caption (or null to keep the old one)
backgroundTexture - the new background Texture (or null to keep the old one)

init

public final void init(int maxValue,
                       java.lang.String caption,
                       java.lang.String backgroundTexture)
Initializes the progress, caption and background image. The progress value is resetted to zero.

Specified by:
init in interface LoadingScreenUpdater
Parameters:
maxValue - the new maximum progress value
caption - the new caption (or null to keep the old one)
backgroundTexture - the new background Texture (or null to keep the old one)

updateContent

protected void updateContent(int value,
                             int maxValue,
                             java.lang.String caption,
                             Texture2D backgroundTexture)
Updates all the contents of the LoadingScreen.

Parameters:
value -
maxValue -
caption -
backgroundTexture -

update

public void update(int incValue,
                   java.lang.String caption,
                   Texture2D backgroundTexture)
Updates the progress value, caption and background image.

Specified by:
update in interface LoadingScreenUpdater
Parameters:
incValue - the value to add to the current progress value
caption - the new caption (or null to keep the old one)
backgroundTexture - the new background Texture (or null to keep the old one)

update

public final void update(int incValue,
                         Texture2D backgroundTexture)
Updates the progress value and background image.

Specified by:
update in interface LoadingScreenUpdater
Parameters:
incValue - the value to add to the current progress value
backgroundTexture - the new background Texture (or null to keep the old one)

update

public final void update(Texture2D backgroundTexture)
Increases the progress value by one and updates the background image.

Specified by:
update in interface LoadingScreenUpdater
Parameters:
backgroundTexture - the new background Texture (or null to keep the old one)

updateOnly

public final void updateOnly(Texture2D backgroundTexture)
Updates the background image only.

Specified by:
updateOnly in interface LoadingScreenUpdater
Parameters:
backgroundTexture - the new background Texture (or null to keep the old one)

update

public final void update(int incValue,
                         java.lang.String caption,
                         java.lang.String backgroundTexture)
Updates the progress value, caption and background image.

Specified by:
update in interface LoadingScreenUpdater
Parameters:
incValue - the value to add to the current progress value
caption - the new caption (or null to keep the old one)
backgroundTexture - the new background Texture (or null to keep the old one)

update

public final void update(int incValue,
                         java.lang.String caption)
Updates the progress value and caption.

Specified by:
update in interface LoadingScreenUpdater
Parameters:
incValue - the value to add to the current progress value
caption - the new caption (or null to keep the old one)

update

public final void update(int incValue)
Updates the progress value and leaves the caption unchanged.

Specified by:
update in interface LoadingScreenUpdater
Parameters:
incValue - the value to add to the current progress value

updateOnly

public final void updateOnly(java.lang.String caption)
Updates the caption only.

Specified by:
updateOnly in interface LoadingScreenUpdater
Parameters:
caption - the new caption (or null to keep the old one)

update

public final void update(java.lang.String caption)
Updates the progress value incremented by one and sets the new caption.

Specified by:
update in interface LoadingScreenUpdater
Parameters:
caption - the new caption (or null to keep the old one)

update

public final void update()
Updates the progress value incremented by one and leaves the caption unchanged.

Specified by:
update in interface LoadingScreenUpdater

beforeAnyResourceLoaded

public void beforeAnyResourceLoaded(ResourceLoader resLoader)

Specified by:
beforeAnyResourceLoaded in interface ResourceLoaderListener

beforeResourceBundleLoaded

public void beforeResourceBundleLoaded(ResourceLoader resLoader,
                                       java.lang.Class<? extends ResourceRequest> bundleType)

Specified by:
beforeResourceBundleLoaded in interface ResourceLoaderListener

afterResourceBundleLoaded

public void afterResourceBundleLoaded(ResourceLoader resLoader,
                                      java.lang.Class<? extends ResourceRequest> bundleType)

Specified by:
afterResourceBundleLoaded in interface ResourceLoaderListener

beforeResourceLoaded

public void beforeResourceLoaded(ResourceLoader resLoader,
                                 ResourceRequest request)

Specified by:
beforeResourceLoaded in interface ResourceLoaderListener

afterResourceLoaded

public void afterResourceLoaded(ResourceLoader resLoader,
                                ResourceRequest request,
                                java.lang.Object resource)

Specified by:
afterResourceLoaded in interface ResourceLoaderListener

afterAllResourceLoaded

public void afterAllResourceLoaded(ResourceLoader resLoader)

Specified by:
afterAllResourceLoaded in interface ResourceLoaderListener

createWithHUD

public static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas,
                                          Texture2D backgroundTexture,
                                          ProgressBar.Description pbDesc,
                                          int maxValue,
                                          Label.Description labelDesc,
                                          java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.
Implicitly creates a new HUD and places the LoadingScreen on it.

Parameters:
canvas - the canvas to create the HUD on
backgroundTexture - the Texture for the backgroundImage
pbDesc - description of the ProgressBar
maxValue - maximum value for the ProgressBar
labelDesc - description of the caption label Widget
initialCaption - initial caption

createWithHUD

public static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas,
                                          java.lang.String backgroundTexture,
                                          ProgressBar.Description pbDesc,
                                          int maxValue,
                                          Label.Description labelDesc,
                                          java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.
Implicitly creates a new HUD and places the LoadingScreen on it.

Parameters:
canvas - the canvas to create the HUD on
backgroundTexture - the Texture for the backgroundImage
pbDesc - description of the ProgressBar
maxValue - maximum value for the ProgressBar
labelDesc - description of the caption label Widget
initialCaption - initial caption

createWithHUD

public static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas,
                                          Texture2D backgroundTexture,
                                          int maxValue,
                                          java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.
Implicitly creates a new HUD and places the LoadingScreen on it.

Parameters:
canvas - the canvas to create the HUD on
backgroundTexture - the Texture for the backgroundImage
maxValue - maximum value for the ProgressBar
initialCaption - initial caption

createWithHUD

public static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas,
                                          java.lang.String backgroundTexture,
                                          int maxValue,
                                          java.lang.String initialCaption)
Creates a new LoadingScreen with the given parameters.
Implicitly creates a new HUD and places the LoadingScreen on it.

Parameters:
canvas - the canvas to create the HUD on
backgroundTexture - the Texture for the backgroundImage
maxValue - maximum value for the ProgressBar
initialCaption - initial caption

createWithHUD

public static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas,
                                          Texture2D backgroundTexture,
                                          int maxValue)
Creates a new LoadingScreen with the given parameters.
Implicitly creates a new HUD and places the LoadingScreen on it.

Parameters:
canvas - the canvas to create the HUD on
backgroundTexture - the Texture for the backgroundImage
maxValue - maximum value for the ProgressBar

createWithHUD

public static LoadingScreen createWithHUD(org.openmali.types.twodee.Sized2iRO canvas,
                                          java.lang.String backgroundTexture,
                                          int maxValue)
Creates a new LoadingScreen with the given parameters.
Implicitly creates a new HUD and places the LoadingScreen on it.

Parameters:
canvas - the canvas to create the HUD on
backgroundTexture - the Texture for the backgroundImage
maxValue - maximum value for the ProgressBar