Made getBlock() public, added enumerateResolvedBlocks(), pressObject().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2934 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: MisoScenePanel.java,v 1.55 2004/01/11 08:26:18 mdb Exp $
|
||||
// $Id: MisoScenePanel.java,v 1.56 2004/01/11 12:22:05 mdb Exp $
|
||||
|
||||
package com.threerings.miso.client;
|
||||
|
||||
@@ -232,6 +232,25 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
return _hcoords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator over all resolved {@link SceneBlock} instances.
|
||||
*/
|
||||
public Iterator enumerateResolvedBlocks ()
|
||||
{
|
||||
return _blocks.values().iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resolved block that contains the specified tile
|
||||
* coordinate or null if no block is resolved for that coordinate.
|
||||
*/
|
||||
public SceneBlock getBlock (int tx, int ty)
|
||||
{
|
||||
int bx = MathUtil.floorDiv(tx, _metrics.blockwid);
|
||||
int by = MathUtil.floorDiv(ty, _metrics.blockhei);
|
||||
return (SceneBlock)_blocks.get(compose(bx, by));
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a path for the specified sprite to the specified tile
|
||||
* coordinates.
|
||||
@@ -378,6 +397,18 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmatically "click" a scene object. This results in a call to
|
||||
* {@link handleObjectPressed} with click coordinates in the center of
|
||||
* the object.
|
||||
*/
|
||||
public void pressObject (SceneObject scobj)
|
||||
{
|
||||
int px = scobj.bounds.x + scobj.bounds.width/2;
|
||||
int py = scobj.bounds.y + scobj.bounds.height/2;
|
||||
handleObjectPressed(scobj, px, py);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user presses the mouse button over a sprite.
|
||||
*/
|
||||
@@ -944,17 +975,6 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
// }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resolved block that contains the specified tile
|
||||
* coordinate or null if no block is resolved for that coordinate.
|
||||
*/
|
||||
protected SceneBlock getBlock (int tx, int ty)
|
||||
{
|
||||
int bx = MathUtil.floorDiv(tx, _metrics.blockwid);
|
||||
int by = MathUtil.floorDiv(ty, _metrics.blockhei);
|
||||
return (SceneBlock)_blocks.get(compose(bx, by));
|
||||
}
|
||||
|
||||
/**
|
||||
* Masks off the lower 16 bits of the supplied integers and composes
|
||||
* them into a single int.
|
||||
|
||||
Reference in New Issue
Block a user