Blarg. Have to tell the sprite manager about the viewport offset when

we're using it to render sprites into a view that is being displayed in a
viewport that is smaller than the actual size of the view. Oh the
jockeying.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1041 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-19 07:41:36 +00:00
parent b01df00f3f
commit 958cb213d5
@@ -1,5 +1,5 @@
//
// $Id: SpriteManager.java,v 1.22 2002/02/19 03:58:37 mdb Exp $
// $Id: SpriteManager.java,v 1.23 2002/02/19 07:41:36 mdb Exp $
package com.threerings.media.sprite;
@@ -35,6 +35,21 @@ public class SpriteManager
_dirty = new ArrayList();
}
/**
* Specifies the viewport offset of the view into which the sprites
* are being rendered. This is an annoying hack, but the sprite
* manager needs to create dirty rectangles and communicate them to
* the animation manager who deals in untranslated coordinates,
* whereas the sprites remain in translated coordinates; but only the
* view itself knows what the translation should be, so it has to tell
* the sprite manager about it using this method.
*/
public void setViewportOffset (int tx, int ty)
{
_tx = tx;
_ty = ty;
}
/**
* Add a rectangle to the dirty rectangle list.
*
@@ -42,6 +57,8 @@ public class SpriteManager
*/
public void addDirtyRect (Rectangle rect)
{
// translate the rectangle according to our viewport offset
rect.translate(-_tx, -_ty);
_dirty.add(rect);
}
@@ -309,6 +326,9 @@ public class SpriteManager
/** The list of pending sprite notifications. */
protected ArrayList _notify;
/** Our viewport offset. */
protected int _tx, _ty;
protected static class SpriteComparator implements Comparator
{
public int compare (Object o1, Object o2)