Split Sprite into Sprite and ImageSprite. Added LabelSprite. Cleaned up
directional constant usage. Added ability to render sprites in two distinct layers. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1132 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: IsoSceneView.java,v 1.101 2002/02/19 19:57:46 mdb Exp $
|
||||
// $Id: IsoSceneView.java,v 1.102 2002/03/16 03:15:05 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -188,7 +188,7 @@ public class IsoSceneView implements SceneView
|
||||
// drawDirtyRegions(gfx);
|
||||
|
||||
// render any animations
|
||||
_animmgr.renderAnimations(gfx);
|
||||
_animmgr.renderAnimations(gfx, AnimationManager.ALL);
|
||||
|
||||
// clear out the dirty tiles and rectangles
|
||||
clearDirtyRegions();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TilePath.java,v 1.3 2001/12/17 03:33:18 mdb Exp $
|
||||
// $Id: TilePath.java,v 1.4 2002/03/16 03:15:05 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -8,6 +8,8 @@ import java.util.List;
|
||||
|
||||
import com.threerings.media.sprite.*;
|
||||
|
||||
import com.threerings.util.DirectionCodes;
|
||||
|
||||
import com.threerings.miso.Log;
|
||||
import com.threerings.miso.scene.util.IsoUtil;
|
||||
|
||||
@@ -18,6 +20,7 @@ import com.threerings.miso.scene.util.IsoUtil;
|
||||
* tile coordinates are updated as the path is traversed.
|
||||
*/
|
||||
public class TilePath extends LineSegmentPath
|
||||
implements DirectionCodes
|
||||
{
|
||||
/**
|
||||
* Constructs a tile path.
|
||||
@@ -108,7 +111,7 @@ public class TilePath extends LineSegmentPath
|
||||
// add the starting path node
|
||||
int stx = sprite.getTileX(), sty = sprite.getTileY();
|
||||
int sx = sprite.getX(), sy = sprite.getY();
|
||||
addNode(stx, sty, sx, sy, Sprite.NORTH);
|
||||
addNode(stx, sty, sx, sy, NORTH);
|
||||
|
||||
// TODO: make more visually appealing path segments from start
|
||||
// to second tile, and penultimate to ultimate tile.
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
//
|
||||
// $Id: IsoUtil.java,v 1.21 2002/02/19 04:02:50 mdb Exp $
|
||||
// $Id: IsoUtil.java,v 1.22 2002/03/16 03:15:06 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Point;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.samskivert.swing.SmartPolygon;
|
||||
|
||||
@@ -11,14 +13,18 @@ import com.threerings.media.sprite.Sprite;
|
||||
import com.threerings.media.tile.ObjectTile;
|
||||
import com.threerings.media.util.MathUtil;
|
||||
|
||||
import com.threerings.util.DirectionCodes;
|
||||
|
||||
import com.threerings.miso.Log;
|
||||
import com.threerings.miso.scene.*;
|
||||
import com.threerings.miso.scene.IsoSceneViewModel;
|
||||
import com.threerings.miso.scene.MisoCharacterSprite;
|
||||
|
||||
/**
|
||||
* The <code>IsoUtil</code> class is a holding place for miscellaneous
|
||||
* isometric-display-related utility routines.
|
||||
*/
|
||||
public class IsoUtil
|
||||
implements DirectionCodes
|
||||
{
|
||||
/**
|
||||
* Sets the given character sprite's tile and fine coordinate
|
||||
@@ -190,7 +196,7 @@ public class IsoUtil
|
||||
|
||||
// compare tile coordinates to determine direction
|
||||
int dir = getIsoDirection(tax, tay, tbx, tby);
|
||||
if (dir != Sprite.NONE) return dir;
|
||||
if (dir != DirectionCodes.NONE) return dir;
|
||||
|
||||
// destination point is in the same tile as the
|
||||
// origination point, so consider fine coordinates
|
||||
@@ -206,7 +212,7 @@ public class IsoUtil
|
||||
dir = getIsoDirection(fax, fay, fbx, fby);
|
||||
|
||||
// arbitrarily return southwest if fine coords were also equivalent
|
||||
return (dir == -1) ? Sprite.SOUTHWEST : dir;
|
||||
return (dir == -1) ? SOUTHWEST : dir;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,28 +228,28 @@ public class IsoUtil
|
||||
* @param by the y-position of point B.
|
||||
*
|
||||
* @return the direction specified as one of the <code>Sprite</code>
|
||||
* class's direction constants, or <code>Sprite.NONE</code>
|
||||
* if point B is equivalent to point A.
|
||||
* class's direction constants, or <code>DirectionCodes.NONE</code> if
|
||||
* point B is equivalent to point A.
|
||||
*/
|
||||
public static int getIsoDirection (int ax, int ay, int bx, int by)
|
||||
{
|
||||
if (bx > ax) {
|
||||
if (by == ay) {
|
||||
return Sprite.SOUTH;
|
||||
return SOUTH;
|
||||
}
|
||||
return (by < ay) ? Sprite.SOUTHEAST : Sprite.SOUTHWEST;
|
||||
return (by < ay) ? SOUTHEAST : SOUTHWEST;
|
||||
|
||||
} else if (bx == ax) {
|
||||
if (by == ay) {
|
||||
return Sprite.NONE;
|
||||
return DirectionCodes.NONE;
|
||||
}
|
||||
return (by < ay) ? Sprite.EAST : Sprite.WEST;
|
||||
return (by < ay) ? EAST : WEST;
|
||||
|
||||
} else { // bx < ax
|
||||
if (by == ay) {
|
||||
return Sprite.NORTH;
|
||||
return NORTH;
|
||||
}
|
||||
return (by < ay) ? Sprite.NORTHEAST : Sprite.NORTHWEST;
|
||||
return (by < ay) ? NORTHEAST : NORTHWEST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user