Revampola! Moved the code that handles viewport offset into the animated

panel; restructured things so everyone deals with "view" coordinates
rather than screen coordinates and the animated panel takes care of doing
the final translation before rendering.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1065 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-21 06:01:29 +00:00
parent 424f2da631
commit 137e9e9ea8
4 changed files with 90 additions and 80 deletions
@@ -1,5 +1,5 @@
//
// $Id: SpriteManager.java,v 1.24 2002/02/19 19:55:14 mdb Exp $
// $Id: SpriteManager.java,v 1.25 2002/02/21 06:01:29 mdb Exp $
package com.threerings.media.sprite;
@@ -35,21 +35,6 @@ 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;
}
/**
* Lets the sprite manager know that the view is about to scroll by
* the specified offsets. It can update the positions of its sprites
@@ -76,9 +61,6 @@ public class SpriteManager
}
dirty.add(ex, ey);
// translate the rectangle according to our viewport offset
dirty.translate(-_tx, -_ty);
// append it to the list
invalidRects.add(dirty);
}
@@ -92,7 +74,6 @@ public class SpriteManager
public void addDirtyRect (Rectangle rect)
{
// translate the rectangle according to our viewport offset
rect.translate(-_tx, -_ty);
_dirty.add(rect);
}
@@ -360,9 +341,6 @@ 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)