Tabs -> spaces
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@268 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -28,29 +28,29 @@ package com.threerings.cast;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("cast");
|
||||
new com.samskivert.util.Log("cast");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ public class BuilderModel
|
||||
*/
|
||||
protected void notifyListeners (int event)
|
||||
{
|
||||
int size = _listeners.size();
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
((BuilderModelListener)_listeners.get(ii)).modelChanged(event);
|
||||
}
|
||||
int size = _listeners.size();
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
((BuilderModelListener)_listeners.get(ii)).modelChanged(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,8 +43,8 @@ public class BuilderPanel extends JPanel
|
||||
{
|
||||
setLayout(new VGroupLayout());
|
||||
|
||||
// give ourselves a wee bit of a border
|
||||
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
// give ourselves a wee bit of a border
|
||||
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH);
|
||||
gl.setOffAxisPolicy(HGroupLayout.STRETCH);
|
||||
|
||||
@@ -42,9 +42,9 @@ public class ComponentPanel extends JPanel
|
||||
*/
|
||||
public ComponentPanel (BuilderModel model, String cprefix)
|
||||
{
|
||||
setLayout(new VGroupLayout(VGroupLayout.STRETCH));
|
||||
// set up a border
|
||||
setBorder(BorderFactory.createEtchedBorder());
|
||||
setLayout(new VGroupLayout(VGroupLayout.STRETCH));
|
||||
// set up a border
|
||||
setBorder(BorderFactory.createEtchedBorder());
|
||||
// add the component editors to the panel
|
||||
addClassEditors(model, cprefix);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class GeomUtil
|
||||
int row = tileIndex / tilesPerRow;
|
||||
int col = tileIndex % tilesPerRow;
|
||||
|
||||
// crop the tile-sized image chunk from the full image
|
||||
// crop the tile-sized image chunk from the full image
|
||||
return new Rectangle(
|
||||
tileWidth*col, tileHeight*row, tileWidth, tileHeight);
|
||||
}
|
||||
|
||||
@@ -35,25 +35,25 @@ public class Log
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
|
||||
public static int getLevel ()
|
||||
|
||||
@@ -35,24 +35,24 @@ public class Log
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.fine(message);
|
||||
log.fine(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,16 +311,16 @@ public abstract class FrameManager
|
||||
*/
|
||||
public static Component getRoot (Component comp, Rectangle rect)
|
||||
{
|
||||
for (Component c = comp; c != null; c = c.getParent()) {
|
||||
if (!c.isVisible() || !c.isDisplayable()) {
|
||||
return null;
|
||||
}
|
||||
for (Component c = comp; c != null; c = c.getParent()) {
|
||||
if (!c.isVisible() || !c.isDisplayable()) {
|
||||
return null;
|
||||
}
|
||||
if (c instanceof Window || c instanceof Applet) {
|
||||
return c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
rect.x += c.getX();
|
||||
rect.y += c.getY();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,24 +36,24 @@ public class Log
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.fine(message);
|
||||
log.fine(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ImageManager
|
||||
*/
|
||||
public ImageManager (ResourceManager rmgr, OptimalImageCreator icreator)
|
||||
{
|
||||
_rmgr = rmgr;
|
||||
_rmgr = rmgr;
|
||||
_icreator = icreator;
|
||||
|
||||
// create our image cache
|
||||
|
||||
@@ -124,33 +124,33 @@ public class OggPlayer extends MusicPlayer
|
||||
// System.out.println(ee);
|
||||
//}
|
||||
AudioFormat audioFormat =
|
||||
new AudioFormat((float)rate,
|
||||
16,
|
||||
channels,
|
||||
true, // PCM_Signed
|
||||
false // littleEndian
|
||||
);
|
||||
new AudioFormat((float)rate,
|
||||
16,
|
||||
channels,
|
||||
true, // PCM_Signed
|
||||
false // littleEndian
|
||||
);
|
||||
DataLine.Info info =
|
||||
new DataLine.Info(SourceDataLine.class,
|
||||
audioFormat,
|
||||
AudioSystem.NOT_SPECIFIED);
|
||||
new DataLine.Info(SourceDataLine.class,
|
||||
audioFormat,
|
||||
AudioSystem.NOT_SPECIFIED);
|
||||
if (!AudioSystem.isLineSupported(info)) {
|
||||
//System.out.println("Line " + info + " not supported.");
|
||||
return;
|
||||
//System.out.println("Line " + info + " not supported.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
outputLine = (SourceDataLine) AudioSystem.getLine(info);
|
||||
//outputLine.addLineListener(this);
|
||||
outputLine.open(audioFormat);
|
||||
outputLine = (SourceDataLine) AudioSystem.getLine(info);
|
||||
//outputLine.addLineListener(this);
|
||||
outputLine.open(audioFormat);
|
||||
}
|
||||
catch (LineUnavailableException ex) {
|
||||
System.out.println("Unable to open the sourceDataLine: " + ex);
|
||||
System.out.println("Unable to open the sourceDataLine: " + ex);
|
||||
return;
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
System.out.println("Illegal Argument: " + ex);
|
||||
return;
|
||||
System.out.println("Illegal Argument: " + ex);
|
||||
return;
|
||||
}
|
||||
|
||||
frameSizeInBytes = audioFormat.getFrameSize();
|
||||
@@ -294,7 +294,7 @@ public class OggPlayer extends MusicPlayer
|
||||
break; // need more data
|
||||
}
|
||||
if (result == -1) { // missing or corrupt data at this page position
|
||||
// System.err.println("Corrupt or missing data in bitstream; continuing...");
|
||||
// System.err.println("Corrupt or missing data in bitstream; continuing...");
|
||||
|
||||
} else {
|
||||
os.pagein(og);
|
||||
|
||||
@@ -172,7 +172,7 @@ public class SpriteManager extends AbstractMediaManager
|
||||
{
|
||||
for (int ii=0, nn=_sprites.size(); ii < nn; ii++) {
|
||||
Sprite sprite = _sprites.get(ii);
|
||||
sprite.paintPath(gfx);
|
||||
sprite.paintPath(gfx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,12 +185,12 @@ public class SpriteManager extends AbstractMediaManager
|
||||
// */
|
||||
// protected void handleCollisions ()
|
||||
// {
|
||||
// // gather a list of all sprite collisions
|
||||
// int size = _sprites.size();
|
||||
// for (int ii = 0; ii < size; ii++) {
|
||||
// // gather a list of all sprite collisions
|
||||
// int size = _sprites.size();
|
||||
// for (int ii = 0; ii < size; ii++) {
|
||||
// Sprite sprite = _sprites.get(ii);
|
||||
// checkCollisions(ii, size, sprite);
|
||||
// }
|
||||
// checkCollisions(ii, size, sprite);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
@@ -205,35 +205,35 @@ public class SpriteManager extends AbstractMediaManager
|
||||
// */
|
||||
// protected void checkCollisions (int idx, int size, Sprite sprite)
|
||||
// {
|
||||
// // TODO: make this handle quickly moving objects that may pass
|
||||
// // through each other.
|
||||
// // TODO: make this handle quickly moving objects that may pass
|
||||
// // through each other.
|
||||
//
|
||||
// // if we're the last sprite we know we've already handled any
|
||||
// // collisions
|
||||
// if (idx == (size - 1)) {
|
||||
// return;
|
||||
// }
|
||||
// // if we're the last sprite we know we've already handled any
|
||||
// // collisions
|
||||
// if (idx == (size - 1)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // calculate the x-position of the right edge of the sprite we're
|
||||
// // checking for collisions
|
||||
// Rectangle bounds = sprite.getBounds();
|
||||
// int edgeX = bounds.x + bounds.width;
|
||||
// // calculate the x-position of the right edge of the sprite we're
|
||||
// // checking for collisions
|
||||
// Rectangle bounds = sprite.getBounds();
|
||||
// int edgeX = bounds.x + bounds.width;
|
||||
//
|
||||
// for (int ii = (idx + 1); ii < size; ii++) {
|
||||
// Sprite other = _sprites.get(ii);
|
||||
// Rectangle obounds = other.getBounds();
|
||||
// if (obounds.x > edgeX) {
|
||||
// // since sprites are stored in the list sorted by
|
||||
// // ascending x-position, we know this sprite and any
|
||||
// // other sprites farther on in the list can't possibly
|
||||
// // intersect with the sprite we're checking, so we're
|
||||
// // done.
|
||||
// for (int ii = (idx + 1); ii < size; ii++) {
|
||||
// Sprite other = _sprites.get(ii);
|
||||
// Rectangle obounds = other.getBounds();
|
||||
// if (obounds.x > edgeX) {
|
||||
// // since sprites are stored in the list sorted by
|
||||
// // ascending x-position, we know this sprite and any
|
||||
// // other sprites farther on in the list can't possibly
|
||||
// // intersect with the sprite we're checking, so we're
|
||||
// // done.
|
||||
// return;
|
||||
//
|
||||
// } else if (obounds.intersects(bounds)) {
|
||||
// sprite.notifyObservers(new CollisionEvent(sprite, other));
|
||||
// }
|
||||
// }
|
||||
// } else if (obounds.intersects(bounds)) {
|
||||
// sprite.notifyObservers(new CollisionEvent(sprite, other));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// /** The comparator used to sort sprites by horizontal position. */
|
||||
// protected static final Comparator SPRITE_COMP = new SpriteComparator();
|
||||
@@ -241,10 +241,10 @@ public class SpriteManager extends AbstractMediaManager
|
||||
// /** Used to sort sprites. */
|
||||
// protected static class SpriteComparator<Sprite> implements Comparator
|
||||
// {
|
||||
// public int compare (Sprite s1, Sprite s2)
|
||||
// {
|
||||
// return (s2.getX() - s1.getX());
|
||||
// }
|
||||
// public int compare (Sprite s1, Sprite s2)
|
||||
// {
|
||||
// return (s2.getX() - s1.getX());
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override // from AbstractMediaManager
|
||||
|
||||
@@ -29,11 +29,11 @@ public class NoSuchTileSetException extends Exception
|
||||
{
|
||||
public NoSuchTileSetException (String tileSetName)
|
||||
{
|
||||
super("No tile set named '" + tileSetName + "'");
|
||||
super("No tile set named '" + tileSetName + "'");
|
||||
}
|
||||
|
||||
public NoSuchTileSetException (int tileSetId)
|
||||
{
|
||||
super("No tile set with id '" + tileSetId + "'");
|
||||
super("No tile set with id '" + tileSetId + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,16 +204,16 @@ public class ObjectTileSet extends SwissArmyTileSet
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", owidths=").append(StringUtil.toString(_owidths));
|
||||
buf.append(", oheights=").append(StringUtil.toString(_oheights));
|
||||
buf.append(", xorigins=").append(StringUtil.toString(_xorigins));
|
||||
buf.append(", yorigins=").append(StringUtil.toString(_yorigins));
|
||||
buf.append(", prios=").append(StringUtil.toString(_priorities));
|
||||
buf.append(", zations=").append(StringUtil.toString(_zations));
|
||||
buf.append(", xspots=").append(StringUtil.toString(_xspots));
|
||||
buf.append(", yspots=").append(StringUtil.toString(_yspots));
|
||||
buf.append(", sorients=").append(StringUtil.toString(_sorients));
|
||||
buf.append(", constraints=").append(StringUtil.toString(_constraints));
|
||||
buf.append(", owidths=").append(StringUtil.toString(_owidths));
|
||||
buf.append(", oheights=").append(StringUtil.toString(_oheights));
|
||||
buf.append(", xorigins=").append(StringUtil.toString(_xorigins));
|
||||
buf.append(", yorigins=").append(StringUtil.toString(_yorigins));
|
||||
buf.append(", prios=").append(StringUtil.toString(_priorities));
|
||||
buf.append(", zations=").append(StringUtil.toString(_zations));
|
||||
buf.append(", xspots=").append(StringUtil.toString(_xspots));
|
||||
buf.append(", yspots=").append(StringUtil.toString(_yspots));
|
||||
buf.append(", sorients=").append(StringUtil.toString(_sorients));
|
||||
buf.append(", constraints=").append(StringUtil.toString(_constraints));
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SwissArmyTileSet extends TileSet
|
||||
// documentation inherited
|
||||
public int getTileCount ()
|
||||
{
|
||||
return _numTiles;
|
||||
return _numTiles;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,40 +135,40 @@ public class SwissArmyTileSet extends TileSet
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", widths=").append(StringUtil.toString(_widths));
|
||||
buf.append(", heights=").append(StringUtil.toString(_heights));
|
||||
buf.append(", tileCounts=").append(StringUtil.toString(_tileCounts));
|
||||
buf.append(", offsetPos=").append(StringUtil.toString(_offsetPos));
|
||||
buf.append(", gapSize=").append(StringUtil.toString(_gapSize));
|
||||
buf.append(", widths=").append(StringUtil.toString(_widths));
|
||||
buf.append(", heights=").append(StringUtil.toString(_heights));
|
||||
buf.append(", tileCounts=").append(StringUtil.toString(_tileCounts));
|
||||
buf.append(", offsetPos=").append(StringUtil.toString(_offsetPos));
|
||||
buf.append(", gapSize=").append(StringUtil.toString(_gapSize));
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected Rectangle computeTileBounds (int tileIndex)
|
||||
{
|
||||
// find the row number containing the sought-after tile
|
||||
int ridx, tcount, ty, tx;
|
||||
ridx = tcount = 0;
|
||||
// find the row number containing the sought-after tile
|
||||
int ridx, tcount, ty, tx;
|
||||
ridx = tcount = 0;
|
||||
|
||||
// start tile image position at image start offset
|
||||
tx = _offsetPos.x;
|
||||
ty = _offsetPos.y;
|
||||
|
||||
while ((tcount += _tileCounts[ridx]) < tileIndex + 1) {
|
||||
while ((tcount += _tileCounts[ridx]) < tileIndex + 1) {
|
||||
// increment tile image position by row height and gap distance
|
||||
ty += (_heights[ridx++] + _gapSize.height);
|
||||
}
|
||||
ty += (_heights[ridx++] + _gapSize.height);
|
||||
}
|
||||
|
||||
// determine the horizontal index of this tile in the row
|
||||
int xidx = tileIndex - (tcount - _tileCounts[ridx]);
|
||||
int xidx = tileIndex - (tcount - _tileCounts[ridx]);
|
||||
|
||||
// final image x-position is based on tile width and gap distance
|
||||
tx += (xidx * (_widths[ridx] + _gapSize.width));
|
||||
|
||||
// Log.info("Computed tile bounds [tileIndex=" + tileIndex +
|
||||
// Log.info("Computed tile bounds [tileIndex=" + tileIndex +
|
||||
// ", ridx=" + ridx + ", xidx=" + xidx +
|
||||
// ", tx=" + tx + ", ty=" + ty + "].");
|
||||
|
||||
// crop the tile-sized image chunk from the full image
|
||||
// crop the tile-sized image chunk from the full image
|
||||
return new Rectangle(tx, ty, _widths[ridx], _heights[ridx]);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ public class Tile // implements Cloneable
|
||||
*/
|
||||
public String toString ()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder("[");
|
||||
StringBuilder buf = new StringBuilder("[");
|
||||
toString(buf);
|
||||
return buf.append("]").toString();
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,7 +145,7 @@ public class TileManager
|
||||
*/
|
||||
public TileSetRepository getTileSetRepository ()
|
||||
{
|
||||
return _setrep;
|
||||
return _setrep;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +206,7 @@ public class TileManager
|
||||
* @see TileUtil#getFQTileId
|
||||
*/
|
||||
public Tile getTile (int fqTileId)
|
||||
throws NoSuchTileSetException
|
||||
throws NoSuchTileSetException
|
||||
{
|
||||
return getTile(TileUtil.getTileSetId(fqTileId),
|
||||
TileUtil.getTileIndex(fqTileId), null);
|
||||
@@ -219,7 +219,7 @@ public class TileManager
|
||||
* @see TileUtil#getFQTileId
|
||||
*/
|
||||
public Tile getTile (int fqTileId, TileSet.Colorizer rizer)
|
||||
throws NoSuchTileSetException
|
||||
throws NoSuchTileSetException
|
||||
{
|
||||
return getTile(TileUtil.getTileSetId(fqTileId),
|
||||
TileUtil.getTileIndex(fqTileId), rizer);
|
||||
@@ -235,7 +235,7 @@ public class TileManager
|
||||
* @return the tile object.
|
||||
*/
|
||||
public Tile getTile (int tileSetId, int tileIndex, TileSet.Colorizer rizer)
|
||||
throws NoSuchTileSetException
|
||||
throws NoSuchTileSetException
|
||||
{
|
||||
TileSet set = getTileSet(tileSetId);
|
||||
return set.getTile(tileIndex, rizer);
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class TileSet
|
||||
*/
|
||||
public String getName ()
|
||||
{
|
||||
return (_name == null) ? _imagePath : _name;
|
||||
return (_name == null) ? _imagePath : _name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,7 +322,7 @@ public abstract class TileSet
|
||||
protected boolean checkTileIndex (int tileIndex)
|
||||
{
|
||||
int tcount = getTileCount();
|
||||
if (tileIndex >= 0 && tileIndex < tcount) {
|
||||
if (tileIndex >= 0 && tileIndex < tcount) {
|
||||
return true;
|
||||
} else {
|
||||
Log.warning("Requested invalid tile [tset=" + this +
|
||||
@@ -377,9 +377,9 @@ public abstract class TileSet
|
||||
*/
|
||||
public String toString ()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder("[");
|
||||
StringBuilder buf = new StringBuilder("[");
|
||||
toString(buf);
|
||||
return buf.append("]").toString();
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -422,8 +422,8 @@ public abstract class TileSet
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
buf.append("name=").append(_name);
|
||||
buf.append(", path=").append(_imagePath);
|
||||
buf.append(", tileCount=").append(getTileCount());
|
||||
buf.append(", path=").append(_imagePath);
|
||||
buf.append(", tileCount=").append(getTileCount());
|
||||
}
|
||||
|
||||
/** The path to the file containing the tile images. */
|
||||
|
||||
@@ -163,10 +163,10 @@ public class TrimmedObjectTileSet extends TileSet
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", ometrics=").append(StringUtil.toString(_ometrics));
|
||||
buf.append(", bounds=").append(StringUtil.toString(_bounds));
|
||||
buf.append(", bits=").append(StringUtil.toString(_bits));
|
||||
buf.append(", zations=").append(StringUtil.toString(_zations));
|
||||
buf.append(", ometrics=").append(StringUtil.toString(_ometrics));
|
||||
buf.append(", bounds=").append(StringUtil.toString(_bounds));
|
||||
buf.append(", bits=").append(StringUtil.toString(_bits));
|
||||
buf.append(", zations=").append(StringUtil.toString(_zations));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,7 +83,7 @@ public class TrimmedTile extends Tile
|
||||
// documentation inherited
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
buf.append(", tbounds=").append(StringUtil.toString(_tbounds));
|
||||
buf.append(", tbounds=").append(StringUtil.toString(_tbounds));
|
||||
}
|
||||
|
||||
/** Our extra trimmed image dimension information. */
|
||||
|
||||
@@ -88,8 +88,8 @@ public class UniformTileSet extends TileSet
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", width=").append(_width);
|
||||
buf.append(", height=").append(_height);
|
||||
buf.append(", width=").append(_width);
|
||||
buf.append(", height=").append(_height);
|
||||
}
|
||||
|
||||
/** The width (in pixels) of the tiles in this tileset. */
|
||||
|
||||
@@ -86,14 +86,14 @@ public class AStarPathUtil
|
||||
*/
|
||||
public void considerSteps (int x, int y)
|
||||
{
|
||||
considerStep(x - 1, y - 1, DIAGONAL_COST);
|
||||
considerStep(x, y - 1, ADJACENT_COST);
|
||||
considerStep(x + 1, y - 1, DIAGONAL_COST);
|
||||
considerStep(x - 1, y, ADJACENT_COST);
|
||||
considerStep(x + 1, y, ADJACENT_COST);
|
||||
considerStep(x - 1, y + 1, DIAGONAL_COST);
|
||||
considerStep(x, y + 1, ADJACENT_COST);
|
||||
considerStep(x + 1, y + 1, DIAGONAL_COST);
|
||||
considerStep(x - 1, y - 1, DIAGONAL_COST);
|
||||
considerStep(x, y - 1, ADJACENT_COST);
|
||||
considerStep(x + 1, y - 1, DIAGONAL_COST);
|
||||
considerStep(x - 1, y, ADJACENT_COST);
|
||||
considerStep(x + 1, y, ADJACENT_COST);
|
||||
considerStep(x - 1, y + 1, DIAGONAL_COST);
|
||||
considerStep(x, y + 1, ADJACENT_COST);
|
||||
considerStep(x + 1, y + 1, DIAGONAL_COST);
|
||||
}
|
||||
|
||||
protected void considerStep (int x, int y, int cost)
|
||||
@@ -186,8 +186,8 @@ public class AStarPathUtil
|
||||
return getNodePath(bestpath);
|
||||
}
|
||||
|
||||
// no path found
|
||||
return null;
|
||||
// no path found
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -197,10 +197,10 @@ public class ArcPath extends TimedPath
|
||||
gfx.setColor(Color.blue);
|
||||
gfx.drawRect(x, y, width-1, height-1);
|
||||
|
||||
gfx.setColor(Color.yellow);
|
||||
gfx.setColor(Color.yellow);
|
||||
gfx.drawArc(x, y, width-1, height-1, 0, 360);
|
||||
|
||||
gfx.setColor(Color.red);
|
||||
gfx.setColor(Color.red);
|
||||
gfx.drawArc(x, y, width-1, height-1, 360-sangle, -delta);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ public class LinePath extends TimedPath
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx)
|
||||
{
|
||||
gfx.setColor(Color.red);
|
||||
gfx.setColor(Color.red);
|
||||
gfx.drawLine(_source.x, _source.y, _dest.x, _dest.y);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,16 +309,16 @@ public class LineSegmentPath
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx)
|
||||
{
|
||||
gfx.setColor(Color.red);
|
||||
Point prev = null;
|
||||
int size = size();
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
PathNode n = (PathNode)getNode(ii);
|
||||
if (prev != null) {
|
||||
gfx.setColor(Color.red);
|
||||
Point prev = null;
|
||||
int size = size();
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
PathNode n = (PathNode)getNode(ii);
|
||||
if (prev != null) {
|
||||
gfx.drawLine(prev.x, prev.y, n.loc.x, n.loc.y);
|
||||
}
|
||||
prev = n.loc;
|
||||
}
|
||||
prev = n.loc;
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MathUtil
|
||||
*/
|
||||
public static int distanceSq (int x0, int y0, int x1, int y1)
|
||||
{
|
||||
return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0));
|
||||
return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,8 +53,8 @@ public class MathUtil
|
||||
*/
|
||||
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 (float)Math.sqrt(((x1 - x0) * (x1 - x0)) +
|
||||
((y1 - y0) * (y1 - y0)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ public class MathUtil
|
||||
*/
|
||||
public static String lineToString (int x0, int y0, int x1, int y1)
|
||||
{
|
||||
return "(" + x0 + ", " + y0 + ") -> (" + x1 + ", " + y1 + ")";
|
||||
return "(" + x0 + ", " + y0 + ") -> (" + x1 + ", " + y1 + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ public class MathUtil
|
||||
*/
|
||||
public static String lineToString (Point p1, Point p2)
|
||||
{
|
||||
return lineToString(p1.x, p1.y, p2.x, p2.y);
|
||||
return lineToString(p1.x, p1.y, p2.x, p2.y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.miso;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("miso");
|
||||
new com.samskivert.util.Log("miso");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,17 +57,17 @@ public class TilePath extends LineSegmentPath
|
||||
public TilePath (MisoSceneMetrics metrics, Sprite sprite,
|
||||
List tiles, int destx, int desty)
|
||||
{
|
||||
// constrain destination pixels to fine coordinates
|
||||
Point fpos = new Point();
|
||||
MisoUtil.screenToFull(metrics, destx, desty, fpos);
|
||||
// constrain destination pixels to fine coordinates
|
||||
Point fpos = new Point();
|
||||
MisoUtil.screenToFull(metrics, destx, desty, fpos);
|
||||
|
||||
// add the starting path node
|
||||
int sx = sprite.getX(), sy = sprite.getY();
|
||||
Point ipos = MisoUtil.screenToTile(metrics, sx, sy, new Point());
|
||||
addNode(sx, sy, NORTH);
|
||||
|
||||
// TODO: make more visually appealing path segments from start to
|
||||
// second tile, and penultimate to ultimate tile
|
||||
// TODO: make more visually appealing path segments from start to
|
||||
// second tile, and penultimate to ultimate tile
|
||||
|
||||
// add all remaining path nodes excepting the last one
|
||||
Point prev = new Point(ipos.x, ipos.y);
|
||||
@@ -111,8 +111,8 @@ public class TilePath extends LineSegmentPath
|
||||
dir = MisoUtil.getIsoDirection(prev.x, prev.y, tdestx, tdesty);
|
||||
}
|
||||
|
||||
// add the final destination path node
|
||||
addNode(spos.x, spos.y, dir);
|
||||
// add the final destination path node
|
||||
addNode(spos.x, spos.y, dir);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,7 +69,7 @@ public class BaseTileSet extends SwissArmyTileSet
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", passable=").append(StringUtil.toString(_passable));
|
||||
buf.append(", passable=").append(StringUtil.toString(_passable));
|
||||
}
|
||||
|
||||
/** Whether each tile is passable. */
|
||||
|
||||
@@ -86,16 +86,16 @@ public class MisoSceneMetrics
|
||||
slopeX = (float)tilehei / (float)tilewid;
|
||||
slopeY = -slopeX;
|
||||
|
||||
// calculate the edge length separating each fine coordinate
|
||||
finelen = tilelen / (float)finegran;
|
||||
// calculate the edge length separating each fine coordinate
|
||||
finelen = tilelen / (float)finegran;
|
||||
|
||||
// calculate the fine-coordinate x-axis line
|
||||
fineSlopeX = (float)tilehei / (float)tilewid;
|
||||
fineBX = -(fineSlopeX * (float)tilehwid);
|
||||
fineSlopeY = -fineSlopeX;
|
||||
// calculate the fine-coordinate x-axis line
|
||||
fineSlopeX = (float)tilehei / (float)tilewid;
|
||||
fineBX = -(fineSlopeX * (float)tilehwid);
|
||||
fineSlopeY = -fineSlopeX;
|
||||
|
||||
// calculate the fine coordinate dimensions
|
||||
finehwid = (int)((float)tilehwid / (float)finegran);
|
||||
finehhei = (int)((float)tilehhei / (float)finegran);
|
||||
// calculate the fine coordinate dimensions
|
||||
finehwid = (int)((float)tilehwid / (float)finegran);
|
||||
finehhei = (int)((float)tilehhei / (float)finegran);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.openal;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("narya.openal");
|
||||
new com.samskivert.util.Log("narya.openal");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.resource;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("resource");
|
||||
new com.samskivert.util.Log("resource");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user