JTP
Class Images

java.lang.Object
  extended by JTP.Images

public class Images
extends Object

Defines and loads game graphics resources (staged). Note: Images are not loaded in constructor to enable (more granular) loading progress to be shown on program startup. (Hence there is no custom constructor method.)

Author:
V.Termanis

Field Summary
static int E_ARROW_DOWN
           
static int E_ARROW_LEFT
           
static int E_ARROW_RIGHT
           
static int E_ARROW_UP
           
static int E_CLEAR
           
static int E_CLOSE
           
static int E_LEVEL_BACK
           
static int E_LEVEL_FIRST
           
static int E_LEVEL_FORWARD
           
static int E_LEVEL_LAST
           
static int E_LEVEL_MESSAGES
           
static int E_LEVEL_NUMBER_BG
           
static int E_LEVEL_SWAP
           
static int E_LEVEL_TIME
           
static int E_PLAY
           
static int E_SAVE
           
static int E_SAVECLOSE
           
static int O_1P
           
static int O_2P
           
static int O_3D
           
static int O_3D_GRAVITY
           
static int O_3D_ICE
           
static int O_3D_TELEPORT
           
static int O_BACK
           
static int O_CLOSE
           
static int O_DISABLED_TILE
           
static int O_DISABLED_TILE_P1
           
static int O_DISABLED_TILE_P2
           
static int O_ERROR
           
static int O_FIRST
           
static int O_FORWARD
           
static int O_INFO
           
static int O_LAST
           
static int O_MEDIAMERGE
           
static int O_QUESTION
           
static int O_START_BOTH
           
static int O_TIME
           
static int O_WARNING
           
static int T_ARROW_DOWN
           
static int T_ARROW_LEFT
           
static int T_ARROW_RIGHT
           
static int T_ARROW_UP
           
static int T_GRAVITY
           
static int T_ICE
           
static int T_NORMAL
           
static int T_START
           
static int T_START2
           
static int T_TELEPORT
           
 
Constructor Summary
Images()
           
 
Method Summary
 BufferedImage get3DImage(int tileIndex, boolean in)
          Returns the matching "3D" wall for a tile of the given index.
 int getEditorImageCount()
          Returns the total number of editor image resources (excluding common ones)
 int getEditorImageOffset()
          Returns starting offset for the editor image group.
 ImageIcon getIcon(int index)
          Returns the image resource with the given (absolute) index in icon form.
 BufferedImage getImage(int index)
          Returns the image resource associated with the given index.
 BufferedImage getImage(int index, boolean in)
          Returns the image resource associated with the given index.
 BufferedImage getOtherImage(int index, boolean in)
          Returns the image resource assicated with the given index (relative to the "other" image group).
 int getOtherImageCount()
          Returns the total number of other (common) image resources.
 int getOtherImageOffset()
          Returns starting offset for the other (common) image group.
 int getTileImageCount()
          Returns the total number of tile image resources (excluding "3D" walls)
 int getTileImageOffset()
          Returns starting offset for the tile image group.
 boolean loadNextSet()
          Loads the next set of image resources into memory.
 boolean moreToLoad()
          Indicates whether more images still have to be loaded.
 void toggleMediaMerge()
          Swaps the T_NORMAL image resource with O_MEDIAMERGE .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

T_NORMAL

public static final int T_NORMAL
See Also:
Constant Field Values

T_ICE

public static final int T_ICE
See Also:
Constant Field Values

T_TELEPORT

public static final int T_TELEPORT
See Also:
Constant Field Values

T_GRAVITY

public static final int T_GRAVITY
See Also:
Constant Field Values

T_ARROW_UP

public static final int T_ARROW_UP
See Also:
Constant Field Values

T_ARROW_DOWN

public static final int T_ARROW_DOWN
See Also:
Constant Field Values

T_ARROW_LEFT

public static final int T_ARROW_LEFT
See Also:
Constant Field Values

T_ARROW_RIGHT

public static final int T_ARROW_RIGHT
See Also:
Constant Field Values

T_START

public static final int T_START
See Also:
Constant Field Values

T_START2

public static final int T_START2
See Also:
Constant Field Values

E_LEVEL_SWAP

public static final int E_LEVEL_SWAP
See Also:
Constant Field Values

E_LEVEL_FIRST

public static final int E_LEVEL_FIRST
See Also:
Constant Field Values

E_LEVEL_LAST

public static final int E_LEVEL_LAST
See Also:
Constant Field Values

E_LEVEL_MESSAGES

public static final int E_LEVEL_MESSAGES
See Also:
Constant Field Values

E_LEVEL_BACK

public static final int E_LEVEL_BACK
See Also:
Constant Field Values

E_LEVEL_FORWARD

public static final int E_LEVEL_FORWARD
See Also:
Constant Field Values

E_LEVEL_TIME

public static final int E_LEVEL_TIME
See Also:
Constant Field Values

E_CLEAR

public static final int E_CLEAR
See Also:
Constant Field Values

E_PLAY

public static final int E_PLAY
See Also:
Constant Field Values

E_SAVE

public static final int E_SAVE
See Also:
Constant Field Values

E_CLOSE

public static final int E_CLOSE
See Also:
Constant Field Values

E_SAVECLOSE

public static final int E_SAVECLOSE
See Also:
Constant Field Values

E_ARROW_UP

public static final int E_ARROW_UP
See Also:
Constant Field Values

E_ARROW_DOWN

public static final int E_ARROW_DOWN
See Also:
Constant Field Values

E_ARROW_LEFT

public static final int E_ARROW_LEFT
See Also:
Constant Field Values

E_ARROW_RIGHT

public static final int E_ARROW_RIGHT
See Also:
Constant Field Values

E_LEVEL_NUMBER_BG

public static final int E_LEVEL_NUMBER_BG
See Also:
Constant Field Values

O_CLOSE

public static final int O_CLOSE
See Also:
Constant Field Values

O_1P

public static final int O_1P
See Also:
Constant Field Values

O_2P

public static final int O_2P
See Also:
Constant Field Values

O_3D

public static final int O_3D
See Also:
Constant Field Values

O_3D_GRAVITY

public static final int O_3D_GRAVITY
See Also:
Constant Field Values

O_3D_ICE

public static final int O_3D_ICE
See Also:
Constant Field Values

O_3D_TELEPORT

public static final int O_3D_TELEPORT
See Also:
Constant Field Values

O_START_BOTH

public static final int O_START_BOTH
See Also:
Constant Field Values

O_TIME

public static final int O_TIME
See Also:
Constant Field Values

O_FIRST

public static final int O_FIRST
See Also:
Constant Field Values

O_BACK

public static final int O_BACK
See Also:
Constant Field Values

O_FORWARD

public static final int O_FORWARD
See Also:
Constant Field Values

O_LAST

public static final int O_LAST
See Also:
Constant Field Values

O_MEDIAMERGE

public static final int O_MEDIAMERGE
See Also:
Constant Field Values

O_DISABLED_TILE

public static final int O_DISABLED_TILE
See Also:
Constant Field Values

O_DISABLED_TILE_P1

public static final int O_DISABLED_TILE_P1
See Also:
Constant Field Values

O_DISABLED_TILE_P2

public static final int O_DISABLED_TILE_P2
See Also:
Constant Field Values

O_INFO

public static final int O_INFO
See Also:
Constant Field Values

O_QUESTION

public static final int O_QUESTION
See Also:
Constant Field Values

O_WARNING

public static final int O_WARNING
See Also:
Constant Field Values

O_ERROR

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

Images

public Images()
Method Detail

moreToLoad

public boolean moreToLoad()
Indicates whether more images still have to be loaded.

Returns:
false if all image resources have been loaded into memory, true otherwise.

loadNextSet

public boolean loadNextSet()
                    throws IOException
Loads the next set of image resources into memory.

Returns:
false if there is nothing left to load, true otherwise.
Throws:
IOException

getImage

public BufferedImage getImage(int index,
                              boolean in)
Returns the image resource associated with the given index.

Parameters:
index - of the wanted image
in - set to true to request the "_in" version of this resource
Returns:
the requested image resource

getImage

public BufferedImage getImage(int index)
Returns the image resource associated with the given index.

Parameters:
index - of the wanted image
Returns:
the requested image resource

getOtherImage

public BufferedImage getOtherImage(int index,
                                   boolean in)
Returns the image resource assicated with the given index (relative to the "other" image group).

Parameters:
index - relative index of the wanted image
in - set to true to request the "_in" version of this resource
Returns:
the requested image resource

get3DImage

public BufferedImage get3DImage(int tileIndex,
                                boolean in)
Returns the matching "3D" wall for a tile of the given index. Note: see the Tile class for a list of tile indices.

Parameters:
tileIndex - index of the wanted "3D" image
in - set to true to request the "_in" version of this resource
Returns:
the requested image resource

getTileImageCount

public int getTileImageCount()
Returns the total number of tile image resources (excluding "3D" walls)

Returns:
the number of images

getTileImageOffset

public int getTileImageOffset()
Returns starting offset for the tile image group.

Returns:
the offset

getEditorImageCount

public int getEditorImageCount()
Returns the total number of editor image resources (excluding common ones)

Returns:
the number of images

getEditorImageOffset

public int getEditorImageOffset()
Returns starting offset for the editor image group.

Returns:
the offset

getOtherImageCount

public int getOtherImageCount()
Returns the total number of other (common) image resources.

Returns:
the number of images

getOtherImageOffset

public int getOtherImageOffset()
Returns starting offset for the other (common) image group.

Returns:
the offset

getIcon

public ImageIcon getIcon(int index)
Returns the image resource with the given (absolute) index in icon form.

Parameters:
index - the absolute index of this image
Returns:
the converted image

toggleMediaMerge

public void toggleMediaMerge()
Swaps the T_NORMAL image resource with O_MEDIAMERGE .