Added getHitSprites() which populates a list with the sprites that are
"hit" by a particular pixel as determined by Sprite.hitTest(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@898 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SpriteManager.java,v 1.19 2002/01/22 20:09:02 shaper Exp $
|
// $Id: SpriteManager.java,v 1.20 2002/01/31 01:04:13 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.sprite;
|
package com.threerings.media.sprite;
|
||||||
|
|
||||||
@@ -67,6 +67,28 @@ public class SpriteManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When an animated view is determining what entity in its view is
|
||||||
|
* under the mouse pointer, it may require a list of sprites that are
|
||||||
|
* "hit" by a particular pixel. The sprites' bounds are first checked
|
||||||
|
* and sprites with bounds that contain the supplied point are further
|
||||||
|
* checked for a non-transparent at the specified location.
|
||||||
|
*
|
||||||
|
* @param list the list to fill with any intersecting sprites.
|
||||||
|
* @param x the x (screen) coordinate to be checked.
|
||||||
|
* @param y the y (screen) coordinate to be checked.
|
||||||
|
*/
|
||||||
|
public void getHitSprites (List list, int x, int y)
|
||||||
|
{
|
||||||
|
int size = _sprites.size();
|
||||||
|
for (int ii = 0; ii < size; ii++) {
|
||||||
|
Sprite sprite = (Sprite)_sprites.get(ii);
|
||||||
|
if (sprite.hitTest(x, y)) {
|
||||||
|
list.add(sprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a sprite to the set of sprites managed by this manager.
|
* Add a sprite to the set of sprites managed by this manager.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user