vooga.engine.resource.modules
Class ImageModule

java.lang.Object
  extended by vooga.engine.resource.modules.ResourceModule
      extended by vooga.engine.resource.modules.ImageModule

public class ImageModule
extends ResourceModule

ResourceModule designed to track Images which are stored as BufferedImages. Depends on the Game class to load image files as BufferedImages.


Constructor Summary
ImageModule()
           
 
Method Summary
 void clearElements()
          Clears the current resource map.
 java.awt.image.BufferedImage getImage(java.lang.String key)
           
 void loadElements(java.util.Collection<org.w3c.dom.Element> elements)
          Adds Elements to the resource map.
 void loadImage(java.lang.String key, java.io.File file)
          Puts a new entry into this Resources's imageMap, with a String key and a BufferedImage[] value.
 void loadImage(java.lang.String key, java.lang.String filePath)
          Puts a new entry into this Resources's imageMap, with a String key and a BufferedImage[] value.
 
Methods inherited from class vooga.engine.resource.modules.ResourceModule
getDefaultPath, getGame, setDefaultPath, setGame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageModule

public ImageModule()
Method Detail

loadElements

public void loadElements(java.util.Collection<org.w3c.dom.Element> elements)
Description copied from class: ResourceModule
Adds Elements to the resource map. Presumably, these elements are part of a Document from parsing an XML file using the Document Object Model

Specified by:
loadElements in class ResourceModule
Parameters:
elements - Elements of the parsed XML document to be added

loadImage

public void loadImage(java.lang.String key,
                      java.io.File file)
Puts a new entry into this Resources's imageMap, with a String key and a BufferedImage[] value. This method is used when a single image is being put into the map.


loadImage

public void loadImage(java.lang.String key,
                      java.lang.String filePath)
Puts a new entry into this Resources's imageMap, with a String key and a BufferedImage[] value. This method is used when a single image is being put into the map.


getImage

public java.awt.image.BufferedImage getImage(java.lang.String key)

clearElements

public void clearElements()
Description copied from class: ResourceModule
Clears the current resource map. Resource maps should be cleared when they are full of currently unneeded resources and the game is starting to use too much memory.

Specified by:
clearElements in class ResourceModule