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:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LinePath.java,v 1.8 2002/06/12 01:11:55 mdb Exp $
|
||||
// $Id: LinePath.java,v 1.9 2002/06/18 22:25:33 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
@@ -46,28 +46,6 @@ public class LinePath implements Path
|
||||
_duration = duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructs this path to adjust itself when the view scrolls, or not.
|
||||
* If the path scrolls with the view, it will adjust its starting and
|
||||
* ending positions by the amount scrolled by the view so that they
|
||||
* remain fixed relative to the scrolled view. If it doesn't they will
|
||||
* remain the same regardless of whether the view scrolls.
|
||||
*/
|
||||
public void setScrollsWithView (boolean scrollsWithView)
|
||||
{
|
||||
_scrollsWithView = scrollsWithView;
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void viewWillScroll (int dx, int dy)
|
||||
{
|
||||
// adjust our source and dest points if we're tracking the view
|
||||
if (_scrollsWithView) {
|
||||
_source.translate(-dx, -dy);
|
||||
_dest.translate(-dx, -dy);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void init (Pathable pable, long timestamp)
|
||||
{
|
||||
@@ -153,9 +131,4 @@ public class LinePath implements Path
|
||||
|
||||
/** The duration that we're to spend following the path. */
|
||||
protected long _duration;
|
||||
|
||||
/** Whether or not we scroll along with the view (which we accomplish
|
||||
* by scrolling our start and end positions when the view scrolls) or
|
||||
* if we should leave our coordinates alone. */
|
||||
protected boolean _scrollsWithView = true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LineSegmentPath.java,v 1.24 2002/06/12 23:33:03 ray Exp $
|
||||
// $Id: LineSegmentPath.java,v 1.25 2002/06/18 22:25:33 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
@@ -156,18 +156,6 @@ public class LineSegmentPath
|
||||
setVelocity(distance/millis);
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void viewWillScroll (int dx, int dy)
|
||||
{
|
||||
// adjust the coordinates of our path nodes
|
||||
int ncount = _nodes.size();
|
||||
for (int ii = 0; ii < ncount; ii++) {
|
||||
PathNode node = (PathNode)_nodes.get(ii);
|
||||
node.loc.x -= dx;
|
||||
node.loc.y -= dy;
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void init (Pathable pable, long timestamp)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Path.java,v 1.7 2002/05/31 03:38:03 mdb Exp $
|
||||
// $Id: Path.java,v 1.8 2002/06/18 22:25:33 mdb Exp $
|
||||
|
||||
package com.threerings.media.util;
|
||||
|
||||
@@ -48,13 +48,6 @@ public interface Path
|
||||
*/
|
||||
public void fastForward (long timeDelta);
|
||||
|
||||
/**
|
||||
* Called when the view that contains the pathable following this path
|
||||
* is scrolling by the specified amount. Gives the path an opportunity
|
||||
* to adjust its internal coordinates by the scrolled amount.
|
||||
*/
|
||||
public void viewWillScroll (int dx, int dy);
|
||||
|
||||
/**
|
||||
* Paint this path on the screen (used for debugging purposes only).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user