org.jrabbit.base.data.thread
Class ResourceLoadingThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.jrabbit.base.data.thread.WatchableThread
          extended by org.jrabbit.base.data.thread.WatchableGLThread
              extended by org.jrabbit.base.data.thread.ResourceLoadingThread
All Implemented Interfaces:
java.lang.Runnable

public abstract class ResourceLoadingThread
extends WatchableGLThread

A base class for loading resources in a separate Thread that has some default methods for loading each of the 3 basic resources (images, sounds, and fonts).

Author:
Chris Molini

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  Font[] fonts
          The list of any fonts loaded by this thread.
protected  Image[] images
          The list of any Images loaded by this thread.
protected  SoundData[] sounds
          The list of any sounds loaded by this thread.
 
Fields inherited from class org.jrabbit.base.data.thread.WatchableGLThread
CONTEXT_SHARING_FAILURE, CONTEXT_SHARING_SUCCESS, CONTEXT_SHARING_UNDECIDED, sharedDrawable
 
Fields inherited from class org.jrabbit.base.data.thread.WatchableThread
progress, total
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ResourceLoadingThread()
           
 
Method Summary
protected  void act()
          Delegates loading of each resource to the appropriate method.
 Font[] fonts()
          Accesses the loaded Fonts.
 Image[] images()
          Accesses the loaded Images.
protected  void loadFonts()
          Override this method to load any desired Fonts.
protected  void loadImages()
          Override this method to load any desired Images.
protected  void loadSounds()
          Override this method to load any desired Sounds.
 SoundData[] sounds()
          Accesses the loaded Sound data.
 
Methods inherited from class org.jrabbit.base.data.thread.WatchableGLThread
contextSharingFailed, contextSharingResult, contextSharingSuccess, releaseContext, run, shareContext
 
Methods inherited from class org.jrabbit.base.data.thread.WatchableThread
complete, percentComplete
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

images

protected Image[] images
The list of any Images loaded by this thread.


sounds

protected SoundData[] sounds
The list of any sounds loaded by this thread.


fonts

protected Font[] fonts
The list of any fonts loaded by this thread.

Constructor Detail

ResourceLoadingThread

public ResourceLoadingThread()
Method Detail

act

protected void act()
Delegates loading of each resource to the appropriate method.

Specified by:
act in class WatchableThread

loadFonts

protected void loadFonts()
Override this method to load any desired Fonts.


loadImages

protected void loadImages()
Override this method to load any desired Images.


loadSounds

protected void loadSounds()
Override this method to load any desired Sounds.


images

public Image[] images()
Accesses the loaded Images. Should not be used until loading is complete.

Returns:
All Images loaded by this Thread.

sounds

public SoundData[] sounds()
Accesses the loaded Sound data. Should not be used until loading is complete.

Returns:
All Images loaded by this Thread.

fonts

public Font[] fonts()
Accesses the loaded Fonts. Should not be used until loading is complete.

Returns:
All Images loaded by this Thread.