done scaling
This commit is contained in:
@ -22,6 +22,7 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
||||
Entity entity;
|
||||
private List<Point> LocalListPointsIso = new ArrayList<Point>();
|
||||
private List<Point> LocalListPointsCartesian = new ArrayList<Point>();
|
||||
private float scaleIndex = 1;
|
||||
|
||||
public List<Point> getLocalListPointsIso() {
|
||||
return LocalListPointsIso;
|
||||
@ -37,6 +38,7 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
||||
|
||||
@Override
|
||||
public void drawing(Graphics2D g) {
|
||||
scaleIndex = entity.getScaleIndex();
|
||||
HitboxRectangle nowHitbox = (HitboxRectangle)entity.getHitbox();
|
||||
int x1,y1,x2,y2;
|
||||
if(nowHitbox.getListPointsIso().size() == 4) {
|
||||
@ -56,13 +58,13 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
||||
y1 = (int)listPointsIso.get(i % size).y;
|
||||
x2 = (int)listPointsIso.get((i+1) % size).x;
|
||||
y2 = (int)listPointsIso.get((i+1) % size).y;
|
||||
g.drawLine(x1, y1, x2, y2);
|
||||
g.drawLine((int)(x1*scaleIndex), (int)(y1*scaleIndex), (int)(x2*scaleIndex), (int)(y2*scaleIndex));
|
||||
}
|
||||
x1 = (int)listPointsIso.get(0).x;
|
||||
y1 = (int)listPointsIso.get(0).y;
|
||||
x2 = (int)listPointsIso.get(3).x;
|
||||
y2 = (int)listPointsIso.get(3).y;
|
||||
g.drawLine(x1, y1, x2, y2);
|
||||
g.drawLine((int)(x1*scaleIndex), (int)(y1*scaleIndex), (int)(x2*scaleIndex), (int)(y2*scaleIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -93,8 +95,8 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
currentIsoPoint.x = e.getX();
|
||||
currentIsoPoint.y = e.getY();
|
||||
currentIsoPoint.x = e.getX()/scaleIndex;
|
||||
currentIsoPoint.y = e.getY()/scaleIndex;
|
||||
HitboxRectangle nowHitbox = (HitboxRectangle)entity.getHitbox();
|
||||
if(entity!=null) {
|
||||
if(firstIsoPoint != null && nowHitbox.getListPointsIso().size() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user