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
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Tile.java,v 1.2 2001/07/14 00:21:24 shaper Exp $
|
||||
// $Id: Tile.java,v 1.3 2001/07/16 00:45:07 shaper Exp $
|
||||
|
||||
package com.threerings.cocktail.miso.tile;
|
||||
|
||||
@@ -24,6 +24,9 @@ public class Tile
|
||||
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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TileSet.java,v 1.2 2001/07/14 00:21:24 shaper Exp $
|
||||
// $Id: TileSet.java,v 1.3 2001/07/16 00:45:07 shaper Exp $
|
||||
|
||||
package com.threerings.cocktail.miso.tile;
|
||||
|
||||
@@ -55,11 +55,9 @@ public class TileSet
|
||||
// load the full tile image if we don't already have it
|
||||
if (_imgTiles == null) {
|
||||
Log.info("Getting full tileset image [file=" + _file + "].");
|
||||
if (_imgTiles == null) {
|
||||
if ((_imgTiles = ImageManager.getImage(_file)) == null) {
|
||||
Log.warning("Failed to retrieve full tileset image.");
|
||||
return null;
|
||||
}
|
||||
if ((_imgTiles = ImageManager.getImage(_file)) == null) {
|
||||
Log.warning("Failed to retrieve full tileset image.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// $Id: MathUtil.java,v 1.1 2001/07/16 00:45:07 shaper Exp $
|
||||
|
||||
package com.threerings.cocktail.miso.util;
|
||||
|
||||
import com.threerings.cocktail.miso.Log;
|
||||
|
||||
import java.awt.Point;
|
||||
|
||||
/**
|
||||
* Provides miscellaneous useful utility routines for mathematical
|
||||
* calculations.
|
||||
*/
|
||||
public class MathUtil
|
||||
{
|
||||
/**
|
||||
* Return the distance between the given points.
|
||||
*/
|
||||
public static float distance (int x0, int y0, int x1, int y1)
|
||||
{
|
||||
return (float)Math.sqrt(((x1 - x0) * (x1 - x0)) +
|
||||
((y1 - y0) * (y1 - y0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representation of the given line.
|
||||
*/
|
||||
public static String lineToString (int x0, int y0, int x1, int y1)
|
||||
{
|
||||
return "(" + x0 + ", " + y0 + ") -> (" + x1 + ", " + y1 + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representation of the given line.
|
||||
*/
|
||||
public static String lineToString (Point p1, Point p2)
|
||||
{
|
||||
return lineToString(p1.x, p1.y, p2.x, p2.y);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user