|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.video.TextureManager
public class TextureManager
TextureManager holds mappings of String names to BufferedImage objects.
TextureManager also has utility methods for loading and using it's textures.
Textures are loaded via the load(Hierarchy) method, using a URL as
the base directory that they are loaded from.
Textures are used with Model instances by calling the bind, unbind
and activate methods.
API Stability: Stable.
Constructor Summary | |
---|---|
TextureManager()
Constructs an empty TextureManager. |
|
TextureManager(java.net.URL baseURL)
Constructs an empty TextureManager. |
Method Summary | |
---|---|
void |
activate(java.lang.String name,
Context opt)
Activates the specified texture. |
void |
addImage(java.lang.String name,
java.awt.image.BufferedImage img,
float priority)
Adds an image. |
void |
bind(Context opt)
Binds all textures for rendering. |
java.net.URL |
getBaseURL()
Provides the base URL used for loading images. |
java.awt.image.BufferedImage |
getImage(java.lang.String name)
Provides the image for the given name. |
boolean |
hasImage(java.lang.String name)
Provides the means to determine if a given name has been mapped to an image. |
boolean |
isBound()
If true, then the add and remove methods will throw a java.lang.IllegalStateException when they're used. |
void |
load(Hierarchy h)
Loads a set of images using the given Hierarchy object as a mapping of image names to image locations. |
void |
removeAll()
Removes all images. |
void |
removeImage(java.lang.String name)
Removes an image. |
void |
setBaseFile(java.io.File file)
Utility method to set the base URL using a java.io.File object to produce the base URL. |
void |
setBaseURL(java.net.URL baseURL)
Sets the base URL used for loading images. |
void |
unbind(Context opt)
Unbinds all textures. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextureManager()
public TextureManager(java.net.URL baseURL) throws java.net.MalformedURLException
baseURL
- the URL object to use as a base.
java.net.MalformedURLException
Method Detail |
---|
public void setBaseURL(java.net.URL baseURL)
baseURL
- the URL object to use as a base.public void setBaseFile(java.io.File file) throws java.net.MalformedURLException
file
- the File object.
java.net.MalformedURLException
- if file cannot be converted to a URL.public java.net.URL getBaseURL()
public void addImage(java.lang.String name, java.awt.image.BufferedImage img, float priority)
name
- the name of the image to add.img
- the image to add.public void removeImage(java.lang.String name)
name
- the name of the image to remove.public void removeAll()
public boolean hasImage(java.lang.String name)
name
- the name of the image to check for.
public java.awt.image.BufferedImage getImage(java.lang.String name)
name
- the name of the image.
public boolean isBound()
public void bind(Context opt)
opt
- the Context object holding rendering attributes.public void unbind(Context opt)
opt
- the Context object holding rendering attributes.public void activate(java.lang.String name, Context opt)
public void load(Hierarchy h)
h
- the Hierachy object that describes the mappings.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |