More import cleanups to go with r662, along with a little bit of foreaching, widening, etc.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@664 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2008-09-26 17:29:23 +00:00
parent b481c48791
commit b473318b12
48 changed files with 235 additions and 231 deletions
@@ -21,10 +21,11 @@
package com.threerings.cast; package com.threerings.cast;
import java.awt.Point;
import java.io.Serializable; import java.io.Serializable;
import java.awt.Point;
/** /**
* The action sequence class describes a particular character animation * The action sequence class describes a particular character animation
* sequence. An animation sequence consists of one or more frames of * sequence. An animation sequence consists of one or more frames of
@@ -21,13 +21,13 @@
package com.threerings.cast; package com.threerings.cast;
import java.awt.Point;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.awt.Point;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.samskivert.util.LRUHashMap; import com.samskivert.util.LRUHashMap;
@@ -21,7 +21,13 @@
package com.threerings.cast.bundle.tools; package com.threerings.cast.bundle.tools;
import java.awt.image.BufferedImage; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.zip.Deflater;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -43,6 +49,8 @@ import java.io.IOException;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.apache.commons.digester.Digester; import org.apache.commons.digester.Digester;
@@ -53,31 +53,26 @@ public abstract class AbstractMedia
} }
/** /**
* Called periodically by this media's manager to give it * Called periodically by this media's manager to give it a chance to do its thing.
* a chance to do its thing.
* *
* @param tickStamp a time stamp associated with this tick. * @param tickStamp a time stamp associated with this tick. <em>Note:</em> this is not obtained
* <em>Note:</em> this is not obtained from a call to {@link * from a call to {@link System#currentTimeMillis} and cannot be compared to timestamps
* System#currentTimeMillis} and cannot be compared to timestamps
* obtained there from. * obtained there from.
*/ */
public abstract void tick (long tickStamp); public abstract void tick (long tickStamp);
/** /**
* Called by the appropriate manager to request that the * Called by the appropriate manager to request that the media render itself with the given
* media render itself with the given graphics context. The * graphics context. The media may wish to inspect the clipping region that has been set on the
* media may wish to inspect the clipping region that has been set * graphics context to render itself more efficiently. This method will only be called after it
* on the graphics context to render itself more efficiently. This * has been established that this media's bounds intersect the clipping region.
* method will only be called after it has been established that this
* media's bounds intersect the clipping region.
*/ */
public abstract void paint (Graphics2D gfx); public abstract void paint (Graphics2D gfx);
/** /**
* Called when the appropriate media manager has been paused for some * Called when the appropriate media manager has been paused for some length of time and is
* length of time and is then unpaused. Media should adjust any time stamps * then unpaused. Media should adjust any time stamps that are maintained internally forward by
* that are maintained internally forward by the delta so that time * the delta so that time maintains the illusion of flowing smoothly forward.
* maintains the illusion of flowing smoothly forward.
*/ */
public void fastForward (long timeDelta) public void fastForward (long timeDelta)
{ {
@@ -176,12 +171,10 @@ public abstract class AbstractMedia
} }
/** /**
* Sets the render order associated with this media. Media * Sets the render order associated with this media. Media can be rendered in two layers; those
* can be rendered in two layers; those with negative render order and * with negative render order and those with positive render order. In the same layer, they
* those with positive render order. In the same layer, they * will be rendered according to their render order's cardinal value (least to greatest). Those
* will be rendered according to their render order's cardinal value * with the same render order value will be rendered in arbitrary order.
* (least to greatest). Those with the same render order value will be
* rendered in arbitrary order.
* *
* <p>This method may not be called during a tick. * <p>This method may not be called during a tick.
* *
@@ -207,8 +200,7 @@ public abstract class AbstractMedia
} }
/** /**
* Queues the supplied notification up to be dispatched to this * Queues the supplied notification up to be dispatched to this abstract media's observers.
* abstract media's observers.
*/ */
public void queueNotification (ObserverList.ObserverOp<Object> amop) public void queueNotification (ObserverList.ObserverOp<Object> amop)
{ {
@@ -216,15 +208,14 @@ public abstract class AbstractMedia
if (_mgr != null) { if (_mgr != null) {
_mgr.queueNotification(_observers, amop); _mgr.queueNotification(_observers, amop);
} else { } else {
log.warning("Have no manager, dropping notification " + log.warning("Have no manager, dropping notification", "media", this, "op", amop);
"[media=" + this + ", op=" + amop + "].");
} }
} }
} }
/** /**
* Called by the {@link AbstractMediaManager} when we are in a * Called by the {@link AbstractMediaManager} when we are in a {@link VirtualMediaPanel} that
* {@link VirtualMediaPanel} that just scrolled. * just scrolled.
*/ */
public void viewLocationDidChange (int dx, int dy) public void viewLocationDidChange (int dx, int dy)
{ {
@@ -254,24 +245,21 @@ public abstract class AbstractMedia
/** /**
* Called when the media has had its manager set. * Called when the media has had its manager set.
* Derived classes may override this method, but should be sure to * Derived classes may override this method, but should be sure to call
* call <code>super.init()</code>. * <code>super.init()</code>.
*/ */
protected void init () protected void init ()
{ {
} }
/** /**
* Prior to the first call to {@link #tick} on an abstract media, this * Prior to the first call to {@link #tick} on an abstract media, this method is called by the
* method is called by the {@link AbstractMediaManager}. It is called * {@link AbstractMediaManager}. It is called during the normal tick cycle, immediately prior
* during the normal tick cycle, immediately prior to the first call * to the first call to {@link #tick}.
* to {@link #tick}.
* *
* <p><em>Note:</em> It is imperative that * <p><em>Note:</em> It is imperative that <code>super.willStart()</code> is called by any
* <code>super.willStart()</code> is called by any entity that * entity that overrides this method because the {@link AbstractMediaManager} depends on the
* overrides this method because the {@link AbstractMediaManager} * setting of the {@link #_firstTick} value to know whether or not to call this method.
* depends on the setting of the {@link #_firstTick} value to know
* whether or not to call this method.
*/ */
protected void willStart (long tickStamp) protected void willStart (long tickStamp)
{ {
@@ -279,17 +267,15 @@ public abstract class AbstractMedia
} }
/** /**
* If this media's size or location are changing, it should create a new * If this media's size or location are changing, it should create a new rectangle from its old
* rectangle from its old bounds (new Rectangle(_bounds)), then effect the * bounds (new Rectangle(_bounds)), then effect the bounds changes and then call this method
* bounds changes and then call this method with the old bounds. This * with the old bounds. This method will either merge the new bounds with the old to create a
* method will either merge the new bounds with the old to create a single * single dirty rectangle or dirty them separately depending on which is more appropriate. It
* dirty rectangle or dirty them separately depending on which is more * will also behave properly if this media is not currently managed (not being rendered) by
* appropriate. It will also behave properly if this media is not currently * NOOPing.
* managed (not being rendered) by NOOPing.
* *
* <em>Do not</em> pass {@link #_bounds} to this method. The rectangle * <em>Do not</em> pass {@link #_bounds} to this method. The rectangle passed in will be
* passed in will be modified and then passed on to the region manager * modified and then passed on to the region manager which will modify it further.
* which will modify it further.
*/ */
protected void invalidateAfterChange (Rectangle obounds) protected void invalidateAfterChange (Rectangle obounds)
{ {
@@ -23,6 +23,9 @@ package com.threerings.media;
import java.applet.Applet; import java.applet.Applet;
import java.util.Iterator;
import java.util.Map;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@@ -627,7 +627,7 @@ public abstract class FrameManager
} }
} }
/** Used to effect periodic calls to {@link #tick}. */ /** Used to effect periodic calls to {@link FrameManager#tick}. */
protected class Ticker extends Thread protected class Ticker extends Thread
{ {
public Ticker () public Ticker ()
@@ -701,7 +701,7 @@ public abstract class FrameManager
_ticking = false; _ticking = false;
} }
/** Used to invoke the call to {@link #tick} on the AWT event queue thread. */ /** Used to invoke the call to {@link FrameManager#tick} on the AWT event queue thread. */
protected Runnable _awtTicker = new Runnable () { protected Runnable _awtTicker = new Runnable () {
public void run () { public void run () {
long elapsed = _timer.getElapsedMillis(); long elapsed = _timer.getElapsedMillis();
@@ -21,6 +21,8 @@
package com.threerings.media; package com.threerings.media;
import java.util.ArrayList;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@@ -21,10 +21,10 @@
package com.threerings.media.animation; package com.threerings.media.animation;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.awt.Rectangle;
import com.samskivert.swing.util.SwingUtil; import com.samskivert.swing.util.SwingUtil;
import static com.threerings.media.Log.log; import static com.threerings.media.Log.log;
@@ -21,11 +21,11 @@
package com.threerings.media.animation; package com.threerings.media.animation;
import java.util.ArrayList;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.ArrayList;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import static com.threerings.media.Log.log; import static com.threerings.media.Log.log;
@@ -21,7 +21,6 @@
package com.threerings.media.image; package com.threerings.media.image;
import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@@ -33,6 +32,8 @@ import java.io.Serializable;
import java.text.ParseException; import java.text.ParseException;
import java.awt.Color;
import com.samskivert.util.HashIntMap; import com.samskivert.util.HashIntMap;
import com.samskivert.util.RandomUtil; import com.samskivert.util.RandomUtil;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
@@ -21,6 +21,7 @@
package com.threerings.media.image; package com.threerings.media.image;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
@@ -21,6 +21,9 @@
package com.threerings.media.image; package com.threerings.media.image;
import java.util.Arrays;
import java.util.Iterator;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
@@ -39,9 +42,6 @@ import java.awt.image.IndexColorModel;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.util.Arrays;
import java.util.Iterator;
import com.samskivert.swing.Label; import com.samskivert.swing.Label;
/** /**
@@ -24,6 +24,7 @@ package com.threerings.media.sprite;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle; import java.awt.Rectangle;
import com.threerings.media.AbstractMedia;
import com.threerings.media.image.Mirage; import com.threerings.media.image.Mirage;
import com.threerings.media.util.MultiFrameImage; import com.threerings.media.util.MultiFrameImage;
import com.threerings.media.util.SingleFrameImageImpl; import com.threerings.media.util.SingleFrameImageImpl;
@@ -55,11 +56,10 @@ public class ImageSprite extends Sprite
public static final int TIME_SEQUENTIAL = 3; public static final int TIME_SEQUENTIAL = 3;
/** /**
* Constructs an image sprite without any associated frames and with * Constructs an image sprite without any associated frames and with an invalid default initial
* an invalid default initial location. The sprite should be populated * location. The sprite should be populated with a set of frames used to display it via a
* with a set of frames used to display it via a subsequent call to * subsequent call to {@link #setFrames}, and its location updated with
* {@link #setFrames}, and its location updated with {@link * {@link AbstractMedia#setLocation}.
* #setLocation}.
*/ */
public ImageSprite () public ImageSprite ()
{ {
@@ -81,8 +81,7 @@ public class ImageSprite extends Sprite
} }
/** /**
* Constructs an image sprite that will display the supplied single * Constructs an image sprite that will display the supplied single image when rendering itself.
* image when rendering itself.
*/ */
public ImageSprite (Mirage image) public ImageSprite (Mirage image)
{ {
@@ -94,22 +93,19 @@ public class ImageSprite extends Sprite
{ {
super.init(); super.init();
// now that we have our sprite manager, we can lay ourselves out // now that we have our sprite manager, we can lay ourselves out and initialize our frames
// and initialize our frames
layout(); layout();
} }
/** /**
* Returns true if the sprite's bounds contain the specified point, * Returns true if the sprite's bounds contain the specified point, and if there is a
* and if there is a non-transparent pixel in the sprite's image at * non-transparent pixel in the sprite's image at the specified point, false if not.
* the specified point, false if not.
*/ */
@Override @Override
public boolean hitTest (int x, int y) public boolean hitTest (int x, int y)
{ {
// first check to see that we're in the sprite's bounds and that // first check to see that we're in the sprite's bounds and that we've got a frame image
// we've got a frame image (if we've got no image, there's nothing // (if we've got no image, there's nothing to be hit)
// to be hit)
if (!super.hitTest(x, y) || _frames == null) { if (!super.hitTest(x, y) || _frames == null) {
return false; return false;
} }
@@ -136,9 +132,8 @@ public class ImageSprite extends Sprite
} }
/** /**
* Sets the number of frames per second desired for the sprite * Sets the number of frames per second desired for the sprite animation. This is only used
* animation. This is only used when the animation mode is * when the animation mode is <code>TIME_BASED</code>.
* <code>TIME_BASED</code>.
* *
* @param fps the desired frames per second. * @param fps the desired frames per second.
*/ */
@@ -163,13 +158,11 @@ public class ImageSprite extends Sprite
public void setFrames (MultiFrameImage frames) public void setFrames (MultiFrameImage frames)
{ {
if (frames == null) { if (frames == null) {
// Log.warning("Someone set up us the null frames! " + // log.warning("Someone set up us the null frames!", "sprite", this);
// "[sprite=" + this + "].");
return; return;
} }
// if these are the same frames we already had, no need to do a // if these are the same frames we already had, no need to do a bunch of pointless business
// bunch of pointless business
if (frames == _frames) { if (frames == _frames) {
return; return;
} }
@@ -181,8 +174,7 @@ public class ImageSprite extends Sprite
} }
/** /**
* Instructs this sprite to lay out its current frame and any * Instructs this sprite to lay out its current frame and any accoutrements.
* accoutrements.
*/ */
public void layout () public void layout ()
{ {
@@ -224,10 +216,9 @@ public class ImageSprite extends Sprite
} }
/** /**
* Must adjust the bounds to accomodate the our new frame. This * Must adjust the bounds to accommodate the our new frame. This includes changing the width
* includes changing the width and height to reflect the size of the * and height to reflect the size of the new frame and also updating the render origin (if
* new frame and also updating the render origin (if necessary) and * necessary) and calling {@link Sprite#updateRenderOrigin} to reflect those changes in the
* calling {@link #updateRenderOrigin} to reflect those changes in the
* sprite's bounds. * sprite's bounds.
* *
* @param frameIdx the index of our new frame. * @param frameIdx the index of our new frame.
@@ -21,6 +21,7 @@
package com.threerings.media.sprite; package com.threerings.media.sprite;
import com.threerings.media.FrameManager;
import com.threerings.media.util.Path; import com.threerings.media.util.Path;
/** /**
@@ -42,7 +43,7 @@ public interface PathObserver
* @param sprite the sprite that completed its path. * @param sprite the sprite that completed its path.
* @param path the path that was completed. * @param path the path that was completed.
* @param when the tick stamp of the media tick on which the path was * @param when the tick stamp of the media tick on which the path was
* completed (see {@link SpriteManager#tick}) (this may not be in the * completed (see {@link FrameManager#tick}) (this may not be in the
* same time domain as {@link System#currentTimeMillis}). * same time domain as {@link System#currentTimeMillis}).
*/ */
public void pathCompleted (Sprite sprite, Path path, long when); public void pathCompleted (Sprite sprite, Path path, long when);
@@ -34,20 +34,18 @@ import com.threerings.media.util.Path;
import com.threerings.media.util.Pathable; import com.threerings.media.util.Pathable;
/** /**
* The sprite class represents a single moveable object in an animated * The sprite class represents a single moveable object in an animated view. A sprite has a
* view. A sprite has a position and orientation within the view, and can * position and orientation within the view, and can be moved along a path.
* be moved along a path.
*/ */
public abstract class Sprite extends AbstractMedia public abstract class Sprite extends AbstractMedia
implements DirectionCodes, Pathable implements DirectionCodes, Pathable
{ {
/** /**
* Constructs a sprite with an initially invalid location. Because * Constructs a sprite with an initially invalid location. Because sprite derived classes
* sprite derived classes generally want to get in on the business * generally want to get in on the business when a sprite's location is set, it is not safe to
* when a sprite's location is set, it is not safe to do so in the * do so in the constructor because their derived methods will be called before their
* constructor because their derived methods will be called before * constructor has been called. Thus a sprite should be fully constructed and <em>then</em> its
* their constructor has been called. Thus a sprite should be fully * location should be set.
* constructed and <em>then</em> its location should be set.
*/ */
public Sprite () public Sprite ()
{ {
@@ -55,12 +53,11 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Constructs a sprite with the supplied dimensions. Because * Constructs a sprite with the supplied dimensions. Because sprite derived classes generally
* sprite derived classes generally want to get in on the business * want to get in on the business when a sprite's location is set, it is not safe to do so in
* when a sprite's location is set, it is not safe to do so in the * the constructor because their derived methods will be called before their constructor has
* constructor because their derived methods will be called before * been called. Thus a sprite should be fully constructed and <em>then</em> its location should
* their constructor has been called. Thus a sprite should be fully * be set.
* constructed and <em>then</em> its location should be set.
*/ */
public Sprite (int width, int height) public Sprite (int width, int height)
{ {
@@ -68,9 +65,8 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns the sprite's x position in screen coordinates. This is the * Returns the sprite's x position in screen coordinates. This is the x coordinate of the
* x coordinate of the sprite's origin, not the upper left of its * sprite's origin, not the upper left of its bounds.
* bounds.
*/ */
public int getX () public int getX ()
{ {
@@ -78,9 +74,8 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns the sprite's y position in screen coordinates. This is the * Returns the sprite's y position in screen coordinates. This is the y coordinate of the
* y coordinate of the sprite's origin, not the upper left of its * sprite's origin, not the upper left of its bounds.
* bounds.
*/ */
public int getY () public int getY ()
{ {
@@ -88,8 +83,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns the offset to the sprite's origin from the upper-left of * Returns the offset to the sprite's origin from the upper-left of the sprite's image.
* the sprite's image.
*/ */
public int getXOffset () public int getXOffset ()
{ {
@@ -97,8 +91,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns the offset to the sprite's origin from the upper-left of * Returns the offset to the sprite's origin from the upper-left of the sprite's image.
* the sprite's image.
*/ */
public int getYOffset () public int getYOffset ()
{ {
@@ -122,11 +115,10 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Sprites have an orientation in one of the eight cardinal * Sprites have an orientation in one of the eight cardinal directions: <code>NORTH</code>,
* directions: <code>NORTH</code>, <code>NORTHEAST</code>, etc. * <code>NORTHEAST</code>, etc. Derived classes can choose to override this member function and
* Derived classes can choose to override this member function and * select a different set of images based on their orientation, or they can ignore the
* select a different set of images based on their orientation, or * orientation information.
* they can ignore the orientation information.
* *
* @see DirectionCodes * @see DirectionCodes
*/ */
@@ -136,8 +128,8 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns the sprite's orientation as one of the eight cardinal * Returns the sprite's orientation as one of the eight cardinal directions:
* directions: <code>NORTH</code>, <code>NORTHEAST</code>, etc. * <code>NORTH</code>, <code>NORTHEAST</code>, etc.
* *
* @see DirectionCodes * @see DirectionCodes
*/ */
@@ -160,8 +152,7 @@ public abstract class Sprite extends AbstractMedia
_ox = x; _ox = x;
_oy = y; _oy = y;
// we need to update our draw position which is based on the size // we need to update our draw position which is based on the size of our current bounds
// of our current bounds
updateRenderOrigin(); updateRenderOrigin();
// this method will invalidate our old and new bounds efficiently // this method will invalidate our old and new bounds efficiently
@@ -187,8 +178,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns true if the sprite's bounds contain the specified point, * Returns true if the sprite's bounds contain the specified point, false if not.
* false if not.
*/ */
public boolean contains (int x, int y) public boolean contains (int x, int y)
{ {
@@ -196,8 +186,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns true if the sprite's bounds contain the specified point, * Returns true if the sprite's bounds contain the specified point, false if not.
* false if not.
*/ */
public boolean hitTest (int x, int y) public boolean hitTest (int x, int y)
{ {
@@ -205,8 +194,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns whether the sprite is inside the given shape in pixel * Returns whether the sprite is inside the given shape in pixel coordinates.
* coordinates.
*/ */
public boolean inside (Shape shape) public boolean inside (Shape shape)
{ {
@@ -214,8 +202,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns whether the sprite's drawn rectangle intersects the given * Returns whether the sprite's drawn rectangle intersects the given shape in pixel coordinates.
* shape in pixel coordinates.
*/ */
public boolean intersects (Shape shape) public boolean intersects (Shape shape)
{ {
@@ -223,8 +210,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns true if this sprite is currently following a path, false if * Returns true if this sprite is currently following a path, false if it is not.
* it is not.
*/ */
public boolean isMoving () public boolean isMoving ()
{ {
@@ -232,9 +218,9 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Set the sprite's active path and start moving it along its merry * Set the sprite's active path and start moving it along its merry way. If the sprite is
* way. If the sprite is already moving along a previous path the old * already moving along a previous path the old path will be lost and the new path will begin
* path will be lost and the new path will begin to be traversed. * to be traversed.
* *
* @param path the path to follow. * @param path the path to follow.
*/ */
@@ -266,8 +252,7 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Returns the path being followed by this sprite or null if the * Returns the path being followed by this sprite or null if the sprite is not following a path.
* sprite is not following a path.
*/ */
public Path getPath () public Path getPath ()
{ {
@@ -318,9 +303,8 @@ public abstract class Sprite extends AbstractMedia
_path.init(this, _pathStamp = tickStamp); _path.init(this, _pathStamp = tickStamp);
} }
// it's possible that as a result of init() the path completed and // it's possible that as a result of init() the path completed and removed itself with a
// removed itself with a call to pathCompleted(), so we have to be // call to pathCompleted(), so we have to be careful here
// careful here
return (_path == null) ? true : _path.tick(this, tickStamp); return (_path == null) ? true : _path.tick(this, tickStamp);
} }
@@ -334,8 +318,8 @@ public abstract class Sprite extends AbstractMedia
} }
/** /**
* Update the coordinates at which the sprite image is drawn to * Update the coordinates at which the sprite image is drawn to reflect the sprite's current
* reflect the sprite's current position. * position.
*/ */
protected void updateRenderOrigin () protected void updateRenderOrigin ()
{ {
@@ -21,13 +21,13 @@
package com.threerings.media.tile; package com.threerings.media.tile;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.io.IOException;
import java.io.ObjectInputStream;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
/** /**
+2 -1
View File
@@ -21,10 +21,11 @@
package com.threerings.media.tile; package com.threerings.media.tile;
import java.awt.Graphics2D;
import java.util.Arrays; import java.util.Arrays;
import java.awt.Graphics2D;
import com.threerings.media.image.Colorization; import com.threerings.media.image.Colorization;
import com.threerings.media.image.Mirage; import com.threerings.media.image.Mirage;
@@ -21,12 +21,13 @@
package com.threerings.media.tile; package com.threerings.media.tile;
import java.awt.Rectangle;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.awt.Rectangle;
import com.samskivert.util.ListUtil; import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
@@ -21,7 +21,7 @@
package com.threerings.media.tile.bundle; package com.threerings.media.tile.bundle;
import java.awt.image.BufferedImage; import java.util.Iterator;
import java.util.Iterator; import java.util.Iterator;
@@ -30,6 +30,8 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.awt.image.BufferedImage;
import com.samskivert.util.HashIntMap; import com.samskivert.util.HashIntMap;
import com.threerings.resource.FastImageIO; import com.threerings.resource.FastImageIO;
@@ -21,6 +21,11 @@
package com.threerings.media.util; package com.threerings.media.util;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import java.awt.Point; import java.awt.Point;
import java.util.ArrayList; import java.util.ArrayList;
@@ -21,12 +21,12 @@
package com.threerings.media.util; package com.threerings.media.util;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.util.Comparator; import java.util.Comparator;
import java.util.TreeSet; import java.util.TreeSet;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
/** /**
* Display mode related utilities. * Display mode related utilities.
*/ */
@@ -21,11 +21,11 @@
package com.threerings.media.util; package com.threerings.media.util;
import java.awt.Graphics2D;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.Graphics2D;
import static com.threerings.media.Log.log; import static com.threerings.media.Log.log;
/** /**
@@ -21,11 +21,12 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.awt.Graphics2D;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.awt.Graphics2D;
import com.samskivert.util.SortableArrayList; import com.samskivert.util.SortableArrayList;
import com.threerings.media.sprite.Sprite; import com.threerings.media.sprite.Sprite;
@@ -21,6 +21,8 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.util.HashMap;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
@@ -29,9 +31,6 @@ import java.awt.Polygon;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.util.HashMap;
import java.util.Iterator;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.samskivert.util.IntTuple; import com.samskivert.util.IntTuple;
@@ -119,8 +118,8 @@ public class ResolutionView extends JPanel
gfx.scale(0.25, 0.25); gfx.scale(0.25, 0.25);
// draw our block glyphs // draw our block glyphs
for (Iterator<BlockGlyph> iter = _blocks.values().iterator(); iter.hasNext(); ) { for (BlockGlyph blockGlyph : _blocks.values()) {
iter.next().paint(gfx); blockGlyph.paint(gfx);
} }
// draw the view bounds // draw the view bounds
@@ -21,14 +21,15 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.awt.Polygon;
import java.awt.Rectangle;
import com.samskivert.util.ArrayUtil; import com.samskivert.util.ArrayUtil;
import com.samskivert.util.IntMap; import com.samskivert.util.IntMap;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
@@ -21,6 +21,8 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.util.Collection;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.Color; import java.awt.Color;
import java.awt.Composite; import java.awt.Composite;
@@ -28,7 +30,6 @@ import java.awt.Font;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.Collection;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.UIManager; import javax.swing.UIManager;
@@ -21,10 +21,11 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.awt.Point;
import java.util.List; import java.util.List;
import java.awt.Point;
import com.threerings.util.DirectionCodes; import com.threerings.util.DirectionCodes;
import com.threerings.media.sprite.Sprite; import com.threerings.media.sprite.Sprite;
@@ -21,10 +21,11 @@
package com.threerings.miso.data; package com.threerings.miso.data;
import java.awt.Rectangle;
import java.util.List; import java.util.List;
import java.awt.Rectangle;
import com.samskivert.util.ArrayUtil; import com.samskivert.util.ArrayUtil;
import com.samskivert.util.IntListUtil; import com.samskivert.util.IntListUtil;
import com.samskivert.util.ListUtil; import com.samskivert.util.ListUtil;
@@ -21,11 +21,12 @@
package com.threerings.miso.data; package com.threerings.miso.data;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.awt.Rectangle;
import com.samskivert.util.ArrayUtil; import com.samskivert.util.ArrayUtil;
import com.samskivert.util.ListUtil; import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
@@ -21,6 +21,9 @@
package com.threerings.util; package com.threerings.util;
import java.util.ArrayList;
import java.util.LinkedList;
import java.awt.Component; import java.awt.Component;
import java.awt.KeyEventDispatcher; import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager; import java.awt.KeyboardFocusManager;
@@ -30,9 +33,6 @@ import java.awt.event.KeyListener;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener; import java.awt.event.WindowFocusListener;
import java.util.ArrayList;
import java.util.LinkedList;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JRootPane; import javax.swing.JRootPane;
import javax.swing.JTable; import javax.swing.JTable;
@@ -23,9 +23,8 @@ package com.threerings.cast;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
@@ -34,11 +33,13 @@ import javax.swing.JPanel;
import com.samskivert.swing.util.SwingUtil; import com.samskivert.swing.util.SwingUtil;
import com.threerings.media.image.ClientImageManager;
import com.threerings.resource.ResourceManager;
import com.threerings.util.DirectionCodes; import com.threerings.util.DirectionCodes;
import com.threerings.util.DirectionUtil; import com.threerings.util.DirectionUtil;
import com.threerings.resource.ResourceManager;
import com.threerings.media.image.ClientImageManager;
import com.threerings.cast.bundle.BundledComponentRepository; import com.threerings.cast.bundle.BundledComponentRepository;
/** /**
@@ -22,13 +22,15 @@
package com.threerings.cast.builder; package com.threerings.cast.builder;
import java.io.IOException; import java.io.IOException;
import javax.swing.JFrame; import javax.swing.JFrame;
import com.samskivert.swing.util.SwingUtil; import com.samskivert.swing.util.SwingUtil;
import com.threerings.media.image.ClientImageManager;
import com.threerings.resource.ResourceManager; import com.threerings.resource.ResourceManager;
import com.threerings.media.image.ClientImageManager;
import com.threerings.cast.CharacterManager; import com.threerings.cast.CharacterManager;
import com.threerings.cast.ComponentRepository; import com.threerings.cast.ComponentRepository;
import com.threerings.cast.bundle.BundledComponentRepository; import com.threerings.cast.bundle.BundledComponentRepository;
@@ -21,16 +21,19 @@
package com.threerings.cast.bundle; package com.threerings.cast.bundle;
import java.awt.Component;
import java.util.Iterator; import java.util.Iterator;
import com.threerings.cast.ComponentClass; import java.awt.Component;
import com.threerings.media.image.ClientImageManager;
import com.threerings.resource.ResourceManager;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import com.threerings.resource.ResourceManager;
import com.threerings.media.image.ClientImageManager;
import com.threerings.cast.ComponentClass;
public class BundledComponentRepositoryTest extends TestCase public class BundledComponentRepositoryTest extends TestCase
{ {
public BundledComponentRepositoryTest () public BundledComponentRepositoryTest ()
@@ -25,7 +25,6 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
@@ -25,7 +25,6 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
@@ -21,10 +21,13 @@
package com.threerings.media; package com.threerings.media;
import java.awt.image.BufferedImage; import java.io.File;
import javax.imageio.ImageIO; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.*; import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import com.threerings.resource.FastImageIO; import com.threerings.resource.FastImageIO;
@@ -22,14 +22,18 @@
package com.threerings.media; package com.threerings.media;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import javax.swing.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.samskivert.swing.HGroupLayout; import com.samskivert.swing.HGroupLayout;
import com.samskivert.swing.util.SwingUtil; import com.samskivert.swing.util.SwingUtil;
import com.threerings.resource.ResourceManager;
import com.threerings.media.image.ClientImageManager; import com.threerings.media.image.ClientImageManager;
import com.threerings.media.tile.TileManager; import com.threerings.media.tile.TileManager;
import com.threerings.resource.ResourceManager;
/** /**
* Does something extraordinary. * Does something extraordinary.
@@ -21,16 +21,18 @@
package com.threerings.media.tile.bundle; package com.threerings.media.tile.bundle;
import java.awt.Component;
import java.util.Iterator; import java.util.Iterator;
import com.threerings.media.image.ClientImageManager; import java.awt.Component;
import com.threerings.media.tile.TileSet;
import com.threerings.resource.ResourceManager;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import com.threerings.resource.ResourceManager;
import com.threerings.media.image.ClientImageManager;
import com.threerings.media.tile.TileSet;
public class BundledTileSetRepositoryTest extends TestCase public class BundledTileSetRepositoryTest extends TestCase
{ {
public BundledTileSetRepositoryTest () public BundledTileSetRepositoryTest ()
@@ -21,9 +21,10 @@
package com.threerings.media.tile.bundle.tools; package com.threerings.media.tile.bundle.tools;
import java.util.HashMap;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import com.samskivert.io.PersistenceException; import com.samskivert.io.PersistenceException;
import com.samskivert.test.TestUtil; import com.samskivert.test.TestUtil;
@@ -21,15 +21,16 @@
package com.threerings.media.tile.tools.xml; package com.threerings.media.tile.tools.xml;
import java.io.IOException;
import java.util.Iterator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import com.threerings.media.tile.TileSet; import java.io.IOException;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import com.threerings.media.tile.TileSet;
public class XMLTileSetParserTest extends TestCase public class XMLTileSetParserTest extends TestCase
{ {
public XMLTileSetParserTest () public XMLTileSetParserTest ()
@@ -26,12 +26,12 @@ import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import javax.swing.JFrame; import javax.swing.JFrame;
import com.threerings.media.FrameManager; import com.threerings.media.FrameManager;
import com.threerings.media.ManagedJFrame; import com.threerings.media.ManagedJFrame;
import com.threerings.media.MediaPanel; import com.threerings.media.MediaPanel;
import com.threerings.media.sprite.Sprite; import com.threerings.media.sprite.Sprite;
/** /**
@@ -21,15 +21,14 @@
package com.threerings.media.util; package com.threerings.media.util;
import java.io.File;
import java.io.IOException;
import java.awt.Color; import java.awt.Color;
import java.awt.Image; import java.awt.Image;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
@@ -21,11 +21,11 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.awt.Rectangle;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random; import java.util.Random;
import java.awt.Rectangle;
import com.samskivert.io.PersistenceException; import com.samskivert.io.PersistenceException;
import com.threerings.media.tile.NoSuchTileSetException; import com.threerings.media.tile.NoSuchTileSetException;
@@ -33,11 +33,11 @@ import com.threerings.media.tile.TileSet;
import com.threerings.media.tile.TileSetRepository; import com.threerings.media.tile.TileSetRepository;
import com.threerings.miso.data.MisoSceneModel; import com.threerings.miso.data.MisoSceneModel;
import com.threerings.miso.data.ObjectInfo;
import com.threerings.miso.tile.BaseTile; import com.threerings.miso.tile.BaseTile;
import com.threerings.miso.tile.BaseTileSet; import com.threerings.miso.tile.BaseTileSet;
import com.threerings.miso.util.MisoContext; import com.threerings.miso.util.MisoContext;
import com.threerings.miso.util.ObjectSet; import com.threerings.miso.util.ObjectSet;
import com.threerings.miso.data.ObjectInfo;
/** /**
* Provides an infinite array of tiles in which to scroll. * Provides an infinite array of tiles in which to scroll.
@@ -21,27 +21,30 @@
package com.threerings.miso.client; package com.threerings.miso.client;
import java.io.IOException;
import java.awt.DisplayMode; import java.awt.DisplayMode;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.io.IOException; import com.samskivert.util.Config;
import com.samskivert.swing.util.SwingUtil; import com.samskivert.swing.util.SwingUtil;
import com.samskivert.util.Config;
import com.threerings.resource.ResourceManager; import com.threerings.resource.ResourceManager;
import com.threerings.media.FrameManager; import com.threerings.media.FrameManager;
import com.threerings.media.image.ClientImageManager; import com.threerings.media.image.ClientImageManager;
import com.threerings.media.sprite.PathAdapter;
import com.threerings.media.sprite.Sprite;
import com.threerings.media.tile.bundle.BundledTileSetRepository;
import com.threerings.media.util.LinePath; import com.threerings.media.util.LinePath;
import com.threerings.media.util.Path; import com.threerings.media.util.Path;
import com.threerings.media.sprite.PathAdapter; import com.threerings.miso.MisoConfig;
import com.threerings.media.sprite.Sprite; import com.threerings.miso.tile.MisoTileManager;
import com.threerings.miso.util.MisoContext;
import com.threerings.media.tile.bundle.BundledTileSetRepository;
import com.threerings.cast.CharacterComponent; import com.threerings.cast.CharacterComponent;
import com.threerings.cast.CharacterDescriptor; import com.threerings.cast.CharacterDescriptor;
@@ -50,10 +53,6 @@ import com.threerings.cast.CharacterSprite;
import com.threerings.cast.NoSuchComponentException; import com.threerings.cast.NoSuchComponentException;
import com.threerings.cast.bundle.BundledComponentRepository; import com.threerings.cast.bundle.BundledComponentRepository;
import com.threerings.miso.MisoConfig;
import com.threerings.miso.tile.MisoTileManager;
import com.threerings.miso.util.MisoContext;
import static com.threerings.miso.Log.log; import static com.threerings.miso.Log.log;
/** /**
@@ -21,11 +21,12 @@
package com.threerings.miso.viewer; package com.threerings.miso.viewer;
import java.io.IOException;
import java.awt.DisplayMode; import java.awt.DisplayMode;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.io.IOException;
import com.samskivert.swing.util.SwingUtil; import com.samskivert.swing.util.SwingUtil;
@@ -35,14 +36,14 @@ import com.threerings.media.FrameManager;
import com.threerings.media.image.ClientImageManager; import com.threerings.media.image.ClientImageManager;
import com.threerings.media.tile.bundle.BundledTileSetRepository; import com.threerings.media.tile.bundle.BundledTileSetRepository;
import com.threerings.cast.CharacterManager;
import com.threerings.cast.bundle.BundledComponentRepository;
import com.threerings.miso.data.SimpleMisoSceneModel; import com.threerings.miso.data.SimpleMisoSceneModel;
import com.threerings.miso.tile.MisoTileManager; import com.threerings.miso.tile.MisoTileManager;
import com.threerings.miso.tools.xml.SimpleMisoSceneParser; import com.threerings.miso.tools.xml.SimpleMisoSceneParser;
import com.threerings.miso.util.MisoContext; import com.threerings.miso.util.MisoContext;
import com.threerings.cast.CharacterManager;
import com.threerings.cast.bundle.BundledComponentRepository;
import static com.threerings.miso.Log.log; import static com.threerings.miso.Log.log;
/** /**
@@ -27,17 +27,10 @@ import java.awt.event.MouseEvent;
import com.samskivert.util.RandomUtil; import com.samskivert.util.RandomUtil;
import com.threerings.cast.CharacterDescriptor;
import com.threerings.cast.CharacterManager;
import com.threerings.cast.CharacterSprite;
import com.threerings.cast.ComponentRepository;
import com.threerings.cast.util.CastUtil;
import com.threerings.media.sprite.PathObserver; import com.threerings.media.sprite.PathObserver;
import com.threerings.media.sprite.Sprite; import com.threerings.media.sprite.Sprite;
import com.threerings.media.sprite.SpriteManager; import com.threerings.media.sprite.SpriteManager;
import com.threerings.media.util.LineSegmentPath; import com.threerings.media.util.LineSegmentPath;
import com.threerings.media.util.Path; import com.threerings.media.util.Path;
import com.threerings.media.util.PerformanceMonitor; import com.threerings.media.util.PerformanceMonitor;
import com.threerings.media.util.PerformanceObserver; import com.threerings.media.util.PerformanceObserver;
@@ -47,6 +40,12 @@ import com.threerings.miso.client.MisoScenePanel;
import com.threerings.miso.data.MisoSceneModel; import com.threerings.miso.data.MisoSceneModel;
import com.threerings.miso.util.MisoContext; import com.threerings.miso.util.MisoContext;
import com.threerings.cast.CharacterDescriptor;
import com.threerings.cast.CharacterManager;
import com.threerings.cast.CharacterSprite;
import com.threerings.cast.ComponentRepository;
import com.threerings.cast.util.CastUtil;
import static com.threerings.miso.Log.log; import static com.threerings.miso.Log.log;
public class ViewerSceneViewPanel extends MisoScenePanel public class ViewerSceneViewPanel extends MisoScenePanel
@@ -25,7 +25,6 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;