rlgamekit.map.display
Class ColorCodes

java.lang.Object
  extended by rlgamekit.map.display.ColorCodes

public class ColorCodes
extends java.lang.Object

Color codes to be used with the rendering backends. At the moment only the ASCIITilePainter makes use of these.

See Also:
ASCIITilePainter

Field Summary
static int BLACK
           
static int BLUE
           
static int CYAN
           
static int DARKGRAY
           
static int GREEN
           
static int LEMONGREEN
           
static int LIGHTGRAY
           
static int MAGENTA
           
static int ORANGE
           
static int PURPLE
           
static int RED
           
static int[] rgb
           
static int SEAGREEN
           
static int TORQUOISE
           
static int VIOLET
           
static int WHITE
           
static int YELLOW
           
 
Constructor Summary
ColorCodes()
           
 
Method Summary
static int getColor(int tileNo)
          Color codes are encoded in the upper 16 bit of the tile numbers.
static char getColorCharacter(int tileNo)
          Get the describing character (identifier) for a color, e.g.
static int getColorCode(char colorChar)
          Parse a configuration code into an color value.
static int getColorIndex(int tileNo)
          Color indices are encoded in the upper 16 bit of the tile numbers.
static java.awt.Color getTileColor(int tileNo)
          Get the Color for the color index encoded in the upper 16 bit of the tile number.
static void setColor(int index, java.awt.Color color)
          Set one of the colors to a new color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rgb

public static final int[] rgb

WHITE

public static final int WHITE
See Also:
Constant Field Values

RED

public static final int RED
See Also:
Constant Field Values

GREEN

public static final int GREEN
See Also:
Constant Field Values

BLUE

public static final int BLUE
See Also:
Constant Field Values

YELLOW

public static final int YELLOW
See Also:
Constant Field Values

MAGENTA

public static final int MAGENTA
See Also:
Constant Field Values

CYAN

public static final int CYAN
See Also:
Constant Field Values

ORANGE

public static final int ORANGE
See Also:
Constant Field Values

VIOLET

public static final int VIOLET
See Also:
Constant Field Values

LEMONGREEN

public static final int LEMONGREEN
See Also:
Constant Field Values

SEAGREEN

public static final int SEAGREEN
See Also:
Constant Field Values

PURPLE

public static final int PURPLE
See Also:
Constant Field Values

TORQUOISE

public static final int TORQUOISE
See Also:
Constant Field Values

LIGHTGRAY

public static final int LIGHTGRAY
See Also:
Constant Field Values

DARKGRAY

public static final int DARKGRAY
See Also:
Constant Field Values

BLACK

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

ColorCodes

public ColorCodes()
Method Detail

setColor

public static void setColor(int index,
                            java.awt.Color color)
Set one of the colors to a new color.

Parameters:
index - The index of the color to replace.
color - The new color.

getColor

public static int getColor(int tileNo)
Color codes are encoded in the upper 16 bit of the tile numbers.

Parameters:
tileNo - Combined tile number and color code.
Returns:
Color code.

getColorIndex

public static int getColorIndex(int tileNo)
Color indices are encoded in the upper 16 bit of the tile numbers.

Parameters:
tileNo - Combined tile number and color code.
Returns:
Color index with (index = (color code >>> 16)).

getTileColor

public static java.awt.Color getTileColor(int tileNo)
Get the Color for the color index encoded in the upper 16 bit of the tile number.

Parameters:
tileNo - Combined tile number and color code.
Returns:
Color object for the tile.

getColorCode

public static int getColorCode(char colorChar)
Parse a configuration code into an color value. 'w' : ColorCodes.WHITE 'r' : ColorCodes.RED 'g' : ColorCodes.GREEN 'b' : ColorCodes.BLUE 'y' : ColorCodes.YELLOW 'm' : ColorCodes.MAGENTA 'c' : ColorCodes.CYAN 'o' : ColorCodes.ORANGE 'v' : ColorCodes.VIOLET 'l' : ColorCodes.LEMONGREEN 'a' : ColorCodes.SEAGREEN 'p' : ColorCodes.PURPLE 'e' : ColorCodes.TORQUOISE 's' : ColorCodes.LIGHTGRAY 'd' : ColorCodes.DARKGRAY 'k' : ColorCodes.BLACK

Parameters:
colorChar - The color identifier
Returns:
The color code parsed from the identifier, or white, if the code could not be parsed.

getColorCharacter

public static char getColorCharacter(int tileNo)
Get the describing character (identifier) for a color, e.g. 'r' for red. These characters can be used by getColorCode() to determine the color code.

Parameters:
tileNo - Combined tile number and color code.
Returns:
The color character.