megamek.client.ui.AWT
Class TilesetManager

java.lang.Object
  extended by megamek.client.ui.AWT.TilesetManager
All Implemented Interfaces:
ITilesetManager, IPreferenceChangeListener

public class TilesetManager
extends java.lang.Object
implements IPreferenceChangeListener, ITilesetManager

Handles loading and manipulating images from both the mech tileset and the terrain tileset.

Version:
Author:
Ben

Field Summary
static int ARTILLERY_ADJUSTED
           
static int ARTILLERY_AUTOHIT
           
static int ARTILLERY_INCOMING
           
 
Constructor Summary
TilesetManager(java.awt.Component comp)
          Creates new TilesetManager
 
Method Summary
 java.awt.Image baseFor(IHex hex)
          Return the base image for the hex
 void clearHex(IHex hex)
          Removes the hex images from the cache.
 java.awt.Image getArtilleryTarget(int which)
           
 java.awt.Image getEcmShade(int tint)
           
 java.awt.Image getMinefieldSign()
           
 java.awt.Image getNightFog()
           
 java.awt.Image getPlayerCamo(Player player)
          Get the camo pattern for the given player.
 java.awt.Image iconFor(Entity entity)
           
 java.awt.Image imageFor(Entity entity)
          Return the image for the entity
 java.awt.Image imageFor(Entity entity, int facing)
           
 boolean isLoaded()
           
 boolean isStarted()
           
 void loadAllHexes()
          Loads all the hex tileset images
 void loadImage(Entity entity)
          Load a single entity image
 void loadNeededImages(IGame game)
          Load all the images we'll need for the game and place them in the tracker
 java.awt.Image loadPreviewImage(Entity entity, java.awt.Image camo, int tint, java.awt.Component bp)
          Loads a preview image of the unit into the BufferedPanel.
 void preferenceChange(PreferenceChangeEvent e)
           
 void reset()
          Resets the started and loaded flags
 java.util.List<java.awt.Image> supersFor(IHex hex)
          Return a list of superimposed images for the hex
 void waitForHex(IHex hex)
          Waits until a certain hex's images are done loading.
 java.awt.Image wreckMarkerFor(Entity entity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARTILLERY_AUTOHIT

public static final int ARTILLERY_AUTOHIT
See Also:
Constant Field Values

ARTILLERY_ADJUSTED

public static final int ARTILLERY_ADJUSTED
See Also:
Constant Field Values

ARTILLERY_INCOMING

public static final int ARTILLERY_INCOMING
See Also:
Constant Field Values
Constructor Detail

TilesetManager

public TilesetManager(java.awt.Component comp)
               throws java.io.IOException
Creates new TilesetManager

Parameters:
comp -
Throws:
java.io.IOException
Method Detail

preferenceChange

public void preferenceChange(PreferenceChangeEvent e)
Specified by:
preferenceChange in interface IPreferenceChangeListener

iconFor

public java.awt.Image iconFor(Entity entity)
Specified by:
iconFor in interface ITilesetManager

wreckMarkerFor

public java.awt.Image wreckMarkerFor(Entity entity)

imageFor

public java.awt.Image imageFor(Entity entity)
Return the image for the entity


imageFor

public java.awt.Image imageFor(Entity entity,
                               int facing)

baseFor

public java.awt.Image baseFor(IHex hex)
Return the base image for the hex

Parameters:
hex - the hex to get the base image for.
Returns:
the base image for the hex.

supersFor

public java.util.List<java.awt.Image> supersFor(IHex hex)
Return a list of superimposed images for the hex

Parameters:
hex - the hex to get the superimposed images for.
Returns:
the list of images superimposed on this hex.

getMinefieldSign

public java.awt.Image getMinefieldSign()

getNightFog

public java.awt.Image getNightFog()

getEcmShade

public java.awt.Image getEcmShade(int tint)

getArtilleryTarget

public java.awt.Image getArtilleryTarget(int which)

isStarted

public boolean isStarted()
Returns:
true if we're in the process of loading some images

isLoaded

public boolean isLoaded()
Returns:
true if we're done loading images

loadNeededImages

public void loadNeededImages(IGame game)
Load all the images we'll need for the game and place them in the tracker

Parameters:
game - the game to load for.

clearHex

public void clearHex(IHex hex)
Removes the hex images from the cache.

Parameters:
hex -

waitForHex

public void waitForHex(IHex hex)
Waits until a certain hex's images are done loading.

Parameters:
hex - the hex to wait for

loadAllHexes

public void loadAllHexes()
Loads all the hex tileset images


loadPreviewImage

public java.awt.Image loadPreviewImage(Entity entity,
                                       java.awt.Image camo,
                                       int tint,
                                       java.awt.Component bp)
Loads a preview image of the unit into the BufferedPanel.

Specified by:
loadPreviewImage in interface ITilesetManager

getPlayerCamo

public java.awt.Image getPlayerCamo(Player player)
Get the camo pattern for the given player.

Specified by:
getPlayerCamo in interface ITilesetManager
Parameters:
player - - the Player whose camo pattern is needed.
Returns:
The Image of the player's camo pattern. This value will be null if the player has selected no camo pattern or if there was an error loading it.

loadImage

public void loadImage(Entity entity)
Load a single entity image


reset

public void reset()
Resets the started and loaded flags

Specified by:
reset in interface ITilesetManager