diff --git a/src/java/com/threerings/media/sprite/SpriteManager.java b/src/java/com/threerings/media/sprite/SpriteManager.java index 70d348b58..dde2507f0 100644 --- a/src/java/com/threerings/media/sprite/SpriteManager.java +++ b/src/java/com/threerings/media/sprite/SpriteManager.java @@ -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)