Files
narya/src/java/com/threerings/media/tile/Tile.java
T
Walter Korman 0a0fce7db3 Highlight the tile under the mouse cursor. Increase the width of a
scene for easier testing.  Other minor clean-up.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@51 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-07-16 00:45:07 +00:00

63 lines
1.7 KiB
Java

//
// $Id: Tile.java,v 1.3 2001/07/16 00:45:07 shaper Exp $
package com.threerings.cocktail.miso.tile;
import java.awt.Image;
import java.awt.image.BufferedImage;
/**
* A tile represents a single square in a single layer in a scene.
*/
public class Tile
{
public BufferedImage img; // the tile image
public short tsid; // the tile set identifier
public short tid; // the tile identifier within the set
// height and width of a tile image in pixels
public static final int HEIGHT = 16;
public static final int WIDTH = 32;
// halved values of tile width/height in pixels for use in common
// tile-dimension-related calculations
public static final int HALF_HEIGHT = HEIGHT / 2;
public static final int HALF_WIDTH = WIDTH / 2;
public static final float EDGE_LENGTH = (float)
Math.sqrt((HALF_WIDTH * HALF_WIDTH) + (HALF_HEIGHT * HALF_HEIGHT));
/**
* Construct a new tile with the specified identifiers. Intended
* only for use by the TileManager. Do not use this method.
*
* @see com.threerings.cocktail.miso.TileManager#getTile
*/
public Tile (short tsid, short tid)
{
this.tsid = tsid;
this.tid = tid;
}
/**
* Construct a new tile with the specified identifiers. Intended
* only for use by the TileManager. Do not use this method.
*
* @see com.threerings.cocktail.miso.TileManager#getTile
*/
public Tile (int tsid, int tid)
{
this.tsid = (short) tsid;
this.tid = (short) tid;
}
public String toString ()
{
StringBuffer buf = new StringBuffer();
buf.append("[tsid=").append(tsid);
buf.append(", tid=").append(tid);
buf.append(", img=").append(img);
return buf.append("]").toString();
}
}