|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcage.core.ResourceEngine
public class ResourceEngine
Cage and Carl Resource Engine This class contains static maps for each datatype used within the engine. All data classes (Overlay, VisualItem, Sound, etc) should call register[TYPE] within their constructors so that they are always registered when created. A notable exception to this is TextImage, which is intended to be temporary and so it is not registered by default. This is important because the maps here act as a bridge between the XML scene definitions, the Carl scripts and the actual engine methods and data.
Constructor Summary | |
---|---|
ResourceEngine()
|
Method Summary | |
---|---|
static void |
clearScenes()
Removes/Deletes all loaded scenes. |
static java.util.Collection<Overlay> |
getAllOverlays()
Get all Overlays |
static java.util.Collection<cage.carl.Closure> |
getAllRountines()
|
static java.util.Collection<Scene> |
getAllScenes()
Gets the all scenes. |
static java.util.Collection<VisualItem> |
getAllVisualItems()
Gets the all visual items. |
static Binding |
getBinding(java.lang.Integer keyConst)
Get a binding from the global bindings. |
static Overlay |
getOverlay(java.lang.String key)
Gets the overlay. |
static Scene |
getScene(java.lang.String key)
Gets the scene. |
static Sound |
getSound(java.lang.String key)
Gets the sound. |
static VisualItem |
getVisualItem(java.lang.String key)
Gets the visual item. |
static java.net.URL |
locateResource(java.lang.String filename)
Locate resource. |
static java.io.InputStream |
locateResourceAsStream(java.lang.String filename)
Locate resource as stream. |
static void |
printOverlays()
Prints the overlays. |
static void |
printScenes()
Prints the scenes. |
static void |
printSounds()
Prints the sounds. |
static void |
printVisualItems()
Prints the visual items. |
static void |
registerBinding(java.lang.Integer keyConst,
Binding bind)
Adds a binding to the global bindings |
static void |
registerOverlay(Overlay s)
Register overlay. |
static void |
registerRountine(java.lang.String name)
Adds an action to a list of actions which will be called each tick of the engine clock |
static void |
registerScene(Scene s)
Register scene. |
static void |
registerSound(java.lang.String name,
Sound snd)
Register sound. |
static void |
registerVisualItem(java.lang.String name,
VisualItem img)
Registers an VisualItem for use by different sprites in the Graphics Engine. |
static void |
setResourceLoader(java.lang.ClassLoader resourceLoader)
Sets the ClassLoader to be used by the ResourceEngine when locating resources |
static void |
unregisterBinding(java.lang.Integer keyConst)
Removes a binding from the global bindings |
static Overlay |
unregisterOverlay(java.lang.String key)
Unregister overlay. |
static void |
unregisterRoutine(java.lang.String name)
Removes an action from a list of actions which will be called each tick of the engine clock |
static Scene |
unregisterScene(java.lang.String key)
Unregister scene. |
static void |
unregisterSound(java.lang.String key)
Unregister sound. |
static void |
unregisterVisualItem(java.lang.String key)
Unregister visual item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceEngine()
Method Detail |
---|
public static void registerVisualItem(java.lang.String name, VisualItem img)
name
- The name to use as a key in the VisualItem mapimg
- The VisualItem data to store with the keypublic static VisualItem getVisualItem(java.lang.String key)
key
- the key
public static java.util.Collection<VisualItem> getAllVisualItems()
public static void unregisterVisualItem(java.lang.String key)
key
- the keypublic static void registerSound(java.lang.String name, Sound snd)
name
- the namesnd
- the sndpublic static Sound getSound(java.lang.String key)
key
- the key
public static void unregisterSound(java.lang.String key)
key
- the keypublic static void registerScene(Scene s)
s
- the spublic static Scene unregisterScene(java.lang.String key)
key
- the key
public static void registerOverlay(Overlay s)
s
- the spublic static Overlay unregisterOverlay(java.lang.String key)
key
- the key
public static Overlay getOverlay(java.lang.String key)
key
- the key
public static java.util.Collection<Overlay> getAllOverlays()
public static Scene getScene(java.lang.String key)
key
- the key
public static java.util.Collection<Scene> getAllScenes()
public static void clearScenes()
public static void registerBinding(java.lang.Integer keyConst, Binding bind)
keyConst
- the value of the key the bind is forbind
- the Binding for the key value.public static void unregisterBinding(java.lang.Integer keyConst)
keyConst
- the value of the key the bind is forpublic static Binding getBinding(java.lang.Integer keyConst)
keyConst
- the KeyValue of the binding desired.
public static void registerRountine(java.lang.String name)
name
- The name of the action to addpublic static void unregisterRoutine(java.lang.String name)
name
- The name of the action to removepublic static java.util.Collection<cage.carl.Closure> getAllRountines()
public static void printOverlays()
public static void printScenes()
public static void printSounds()
public static void printVisualItems()
public static void setResourceLoader(java.lang.ClassLoader resourceLoader)
resourceLoader
- The custom ClassLoader to use.public static java.net.URL locateResource(java.lang.String filename)
filename
- the filename
public static java.io.InputStream locateResourceAsStream(java.lang.String filename)
filename
- the filename
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |