Death, taxes and refactoring: seriously revamped the low-level media code

to handle scrolling in a much cleaner and happier way. There's now a
VirtualMediaPanel which operates in virtual coordinates and can be made to
"view" any location in those virtual coordinates. By changing the view,
the view can be scrolled and the view can be made to center on a pathable
(generally a sprite) which will cause it to scroll around as the pathable
moves around in the virtual coordinate space.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1475 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-06-18 22:25:33 +00:00
parent 4b29f806df
commit 7253a68c7c
10 changed files with 387 additions and 615 deletions
@@ -1,5 +1,5 @@
//
// $Id: RegionManager.java,v 1.2 2002/06/11 00:52:37 mdb Exp $
// $Id: RegionManager.java,v 1.3 2002/06/18 22:25:33 mdb Exp $
package com.threerings.media;
@@ -8,6 +8,8 @@ import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import com.samskivert.util.StringUtil;
/**
* Manages regions (rectangles) that are invalidated in the process of
* ticking animations and sprites and generally doing other display
@@ -20,7 +22,9 @@ public class RegionManager
*/
public void invalidateRegion (int x, int y, int width, int height)
{
_dirty.add(new Rectangle(x, y, width, height));
if (width != 0 && height != 0) {
addDirtyRegion(new Rectangle(x, y, width, height));
}
}
/**
@@ -30,7 +34,9 @@ public class RegionManager
*/
public void invalidateRegion (Rectangle rect)
{
_dirty.add((Rectangle)rect.clone());
if (rect.width != 0 && rect.height != 0) {
addDirtyRegion((Rectangle)rect.clone());
}
}
/**
@@ -41,7 +47,10 @@ public class RegionManager
*/
public void addDirtyRegion (Rectangle rect)
{
_dirty.add(rect);
if (rect.width != 0 && rect.height != 0) {
// Log.info("Invalidating " + StringUtil.toString(rect));
_dirty.add(rect);
}
}
/**