Use smart polygons.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1033 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
//
|
//
|
||||||
// $Id: IsoUtil.java,v 1.20 2002/02/06 23:38:45 mdb Exp $
|
// $Id: IsoUtil.java,v 1.21 2002/02/19 04:02:50 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene.util;
|
package com.threerings.miso.scene.util;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
import com.samskivert.swing.SmartPolygon;
|
||||||
|
|
||||||
import com.threerings.media.sprite.Sprite;
|
import com.threerings.media.sprite.Sprite;
|
||||||
import com.threerings.media.tile.ObjectTile;
|
import com.threerings.media.tile.ObjectTile;
|
||||||
import com.threerings.media.util.MathUtil;
|
import com.threerings.media.util.MathUtil;
|
||||||
@@ -53,7 +55,7 @@ public class IsoUtil
|
|||||||
public static Polygon getObjectFootprint (
|
public static Polygon getObjectFootprint (
|
||||||
IsoSceneViewModel model, Polygon root, ObjectTile tile)
|
IsoSceneViewModel model, Polygon root, ObjectTile tile)
|
||||||
{
|
{
|
||||||
Polygon boundsPoly = new Polygon();
|
Polygon boundsPoly = new SmartPolygon();
|
||||||
Rectangle bounds = root.getBounds();
|
Rectangle bounds = root.getBounds();
|
||||||
|
|
||||||
int bwid = tile.getBaseWidth(), bhei = tile.getBaseHeight();
|
int bwid = tile.getBaseWidth(), bhei = tile.getBaseHeight();
|
||||||
@@ -113,7 +115,7 @@ public class IsoUtil
|
|||||||
int oox = bounds.x + model.tilehwid, ooy = bounds.y + model.tilehei;
|
int oox = bounds.x + model.tilehwid, ooy = bounds.y + model.tilehei;
|
||||||
int sx = oox - tox, sy = ooy - toy;
|
int sx = oox - tox, sy = ooy - toy;
|
||||||
|
|
||||||
Polygon boundsPoly = new Polygon();
|
Polygon boundsPoly = new SmartPolygon();
|
||||||
int rx = sx, ry = sy;
|
int rx = sx, ry = sy;
|
||||||
|
|
||||||
// top-left point
|
// top-left point
|
||||||
@@ -428,7 +430,7 @@ public class IsoUtil
|
|||||||
IsoUtil.tileToScreen(model, x, y, spos);
|
IsoUtil.tileToScreen(model, x, y, spos);
|
||||||
|
|
||||||
// create a polygon framing the tile
|
// create a polygon framing the tile
|
||||||
Polygon poly = new Polygon();
|
Polygon poly = new SmartPolygon();
|
||||||
poly.addPoint(spos.x, spos.y + model.tilehhei);
|
poly.addPoint(spos.x, spos.y + model.tilehhei);
|
||||||
poly.addPoint(spos.x + model.tilehwid, spos.y);
|
poly.addPoint(spos.x + model.tilehwid, spos.y);
|
||||||
poly.addPoint(spos.x + model.tilewid, spos.y + model.tilehhei);
|
poly.addPoint(spos.x + model.tilewid, spos.y + model.tilehhei);
|
||||||
|
|||||||
Reference in New Issue
Block a user