Fixed scene rendering issues and improved performance.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@517 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
//
|
||||
// $Id: CharacterManager.java,v 1.1 2001/10/15 23:53:43 shaper Exp $
|
||||
// $Id: CharacterManager.java,v 1.2 2001/10/22 18:21:41 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
@@ -59,6 +60,7 @@ public class CharacterManager
|
||||
|
||||
AmbulatorySprite sprite = new AmbulatorySprite(0, 0, anims);
|
||||
sprite.setFrameRate(info.frameRate);
|
||||
sprite.setOrigin(info.origin.x, info.origin.y);
|
||||
|
||||
return sprite;
|
||||
}
|
||||
@@ -87,11 +89,12 @@ public class CharacterManager
|
||||
public int tsid;
|
||||
public int frameCount;
|
||||
public int frameRate;
|
||||
public Point origin = new Point();
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
return "[tsid=" + tsid + ", frameCount=" + frameCount +
|
||||
", frameRate=" + frameRate + "]";
|
||||
", frameRate=" + frameRate + ", origin=" + origin + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: CharacterSprite.java,v 1.12 2001/10/15 23:53:43 shaper Exp $
|
||||
// $Id: CharacterSprite.java,v 1.13 2001/10/22 18:21:41 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -45,6 +45,32 @@ public class AmbulatorySprite extends Sprite implements Traverser
|
||||
setFrames(_anims[_orient]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the origin coordinates representing the "base" of the
|
||||
* sprite, which in most cases corresponds to the center of the
|
||||
* bottom of the sprite image.
|
||||
*/
|
||||
public void setOrigin (int x, int y)
|
||||
{
|
||||
_xorigin = x;
|
||||
_yorigin = y;
|
||||
|
||||
updateRenderOffset();
|
||||
updateRenderOrigin();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected void updateRenderOffset ()
|
||||
{
|
||||
super.updateRenderOffset();
|
||||
|
||||
if (_frame != null) {
|
||||
// our location is based on the character origin coordinates
|
||||
_rxoff = -_xorigin;
|
||||
_ryoff = -_yorigin;
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void cancelMove ()
|
||||
{
|
||||
@@ -91,4 +117,7 @@ public class AmbulatorySprite extends Sprite implements Traverser
|
||||
|
||||
/** The animation frames for the sprite facing each direction. */
|
||||
protected MultiFrameImage[] _anims;
|
||||
|
||||
/** The origin of the sprite. */
|
||||
protected int _xorigin, _yorigin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user