Added getScreenCoords(), invalidateRect().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@785 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: IsoSceneView.java,v 1.77 2001/12/14 23:31:04 shaper Exp $
|
// $Id: IsoSceneView.java,v 1.78 2001/12/15 04:20:55 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
@@ -404,22 +404,26 @@ public class IsoSceneView implements SceneView
|
|||||||
int size = rects.size();
|
int size = rects.size();
|
||||||
for (int ii = 0; ii < size; ii++) {
|
for (int ii = 0; ii < size; ii++) {
|
||||||
Rectangle r = (Rectangle)rects.get(ii);
|
Rectangle r = (Rectangle)rects.get(ii);
|
||||||
|
invalidateRect(r);
|
||||||
// dirty the tiles impacted by this rectangle
|
|
||||||
Rectangle tileBounds = invalidateScreenRect(r);
|
|
||||||
|
|
||||||
// dirty any sprites or objects impacted by this rectangle
|
|
||||||
invalidateItems(tileBounds);
|
|
||||||
|
|
||||||
// save the rectangle for potential display later
|
|
||||||
_dirtyRects.add(r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public void invalidateRect (Rectangle rect)
|
||||||
|
{
|
||||||
|
// dirty the tiles impacted by this rectangle
|
||||||
|
Rectangle tileBounds = invalidateScreenRect(rect);
|
||||||
|
|
||||||
|
// dirty any sprites or objects impacted by this rectangle
|
||||||
|
invalidateItems(tileBounds);
|
||||||
|
|
||||||
|
// save the rectangle for potential display later
|
||||||
|
_dirtyRects.add(rect);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalidates the given rectangle in screen pixel coordinates in
|
* Invalidates the given rectangle in screen pixel coordinates in the
|
||||||
* the view. Returns a rectangle that bounds all tiles that were
|
* view. Returns a rectangle that bounds all tiles that were dirtied.
|
||||||
* dirtied.
|
|
||||||
*
|
*
|
||||||
* @param rect the dirty rectangle.
|
* @param rect the dirty rectangle.
|
||||||
*/
|
*/
|
||||||
@@ -611,6 +615,14 @@ public class IsoSceneView implements SceneView
|
|||||||
new TilePath(_model, sprite, points, x, y);
|
new TilePath(_model, sprite, points, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public Point getScreenCoords (int x, int y)
|
||||||
|
{
|
||||||
|
Point coords = new Point();
|
||||||
|
IsoUtil.fullToScreen(_model, x, y, coords);
|
||||||
|
return coords;
|
||||||
|
}
|
||||||
|
|
||||||
/** The stroke used to draw dirty rectangles. */
|
/** The stroke used to draw dirty rectangles. */
|
||||||
protected static final Stroke DIRTY_RECT_STROKE = new BasicStroke(2);
|
protected static final Stroke DIRTY_RECT_STROKE = new BasicStroke(2);
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
//
|
//
|
||||||
// $Id: SceneView.java,v 1.19 2001/11/18 04:09:22 mdb Exp $
|
// $Id: SceneView.java,v 1.20 2001/12/15 04:20:55 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Point;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.threerings.media.sprite.DirtyRectList;
|
import com.threerings.media.sprite.DirtyRectList;
|
||||||
@@ -17,8 +18,8 @@ import com.threerings.media.sprite.Path;
|
|||||||
public interface SceneView
|
public interface SceneView
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Invalidates a list of rectangles in screen pixel coordinates in
|
* Invalidate a list of rectangles in screen pixel coordinates in the
|
||||||
* the scene view for later repainting.
|
* scene view for later repainting.
|
||||||
*
|
*
|
||||||
* @param rects the list of {@link java.awt.Rectangle} objects.
|
* @param rects the list of {@link java.awt.Rectangle} objects.
|
||||||
*/
|
*/
|
||||||
@@ -50,4 +51,9 @@ public interface SceneView
|
|||||||
* @return the sprite's path, or null if no valid path exists.
|
* @return the sprite's path, or null if no valid path exists.
|
||||||
*/
|
*/
|
||||||
public Path getPath (MisoCharacterSprite sprite, int x, int y);
|
public Path getPath (MisoCharacterSprite sprite, int x, int y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns screen coordinates given the specified full coordinates.
|
||||||
|
*/
|
||||||
|
public Point getScreenCoords (int x, int y);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user