com.threerings.media.tile
Class TileUtil

java.lang.Object
  extended by com.threerings.media.tile.TileUtil

public class TileUtil
extends Object

Miscellaneous utility routines for working with tiles.


Field Summary
protected static long ADDEND
           
protected static long MASK
           
protected static long MULTIPLIER
           
 
Constructor Summary
TileUtil()
           
 
Method Summary
static int getFQTileId(int tileSetId, int tileIndex)
          Generates a fully-qualified tile id given the supplied tileset id and tile index.
static int getTileHash(int x, int y)
          Compute some hash value for "randomizing" tileset picks based on x and y coordinates.
static int getTileIndex(int fqTileId)
          Extracts the tile index from the supplied fully qualified tile id.
static int getTileSetId(int fqTileId)
          Extracts the tile set id from the supplied fully qualified tile id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MULTIPLIER

protected static final long MULTIPLIER
See Also:
Constant Field Values

ADDEND

protected static final long ADDEND
See Also:
Constant Field Values

MASK

protected static final long MASK
See Also:
Constant Field Values
Constructor Detail

TileUtil

public TileUtil()
Method Detail

getFQTileId

public static int getFQTileId(int tileSetId,
                              int tileIndex)
Generates a fully-qualified tile id given the supplied tileset id and tile index.


getTileSetId

public static int getTileSetId(int fqTileId)
Extracts the tile set id from the supplied fully qualified tile id.


getTileIndex

public static int getTileIndex(int fqTileId)
Extracts the tile index from the supplied fully qualified tile id.


getTileHash

public static int getTileHash(int x,
                              int y)
Compute some hash value for "randomizing" tileset picks based on x and y coordinates.

Returns:
a positive, seemingly random number based on x and y.