working on parsing ReferencePoint into CurrentIsoPoint
This commit is contained in:
@ -26,10 +26,15 @@ public class HitboxCircleRenderingFunction implements ShapeRenderingFunction {
|
||||
public void drawing(Graphics2D g) {
|
||||
HitboxCircle nowHitbox = (HitboxCircle)entity.getHitbox();
|
||||
if(nowHitbox.getRadius()!=0) {
|
||||
g.drawOval((int)nowHitbox.getCurrentRefPoint().x, (int)(nowHitbox.getCurrentRefPoint().y-(nowHitbox.getDiametrY()/2)), (int)nowHitbox.getDiametrX(), (int)(nowHitbox.getDiametrY()));
|
||||
g.drawOval((int)nowHitbox.getCurrentRefPoint().x, (int)(nowHitbox.getCurrentRefPoint().y-(nowHitbox.getDiametrY()/2)), (int)nowHitbox.getDiametrX(), (int)(nowHitbox.getDiametrY()));
|
||||
System.out.println("READY: diametrX = "+nowHitbox.getDiametrX()+ ". diametrY = "+nowHitbox.getDiametrY());
|
||||
System.out.println("READY: coordX = "+(int)nowHitbox.getCurrentRefPoint().x+ ". coordY = "+(int)(nowHitbox.getCurrentRefPoint().y-(nowHitbox.getDiametrY()/2)));
|
||||
|
||||
}else if(firstIsoPoint != null) {
|
||||
currentDiametrX = Math.abs((int)firstIsoPoint.x-(int)currentIsoPoint.x);
|
||||
g.drawOval((int)firstIsoPoint.x, (int)(firstIsoPoint.y-currentDiametrX/4), currentDiametrX, currentDiametrX/2);
|
||||
System.out.println("CURRENT: coordX = "+(int)firstIsoPoint.x+ ". coordX = "+(int)(firstIsoPoint.y-currentDiametrX/4));
|
||||
System.out.println("CURRENT: diametrX = "+currentDiametrX+ ". diametrY = "+currentDiametrX/2);
|
||||
g.drawOval((int)firstIsoPoint.x, (int)(firstIsoPoint.y-currentDiametrX/4), (int)currentDiametrX, (int)currentDiametrX/2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,13 +47,17 @@ public class HitboxCircleRenderingFunction implements ShapeRenderingFunction {
|
||||
//Формула высчитывания радиуса из диаметров circle.
|
||||
nowHitbox.getCurrentRefPoint().setXY(firstIsoPoint.x, firstIsoPoint.y);
|
||||
nowHitbox.setDiametrXY(Math.abs(firstIsoPoint.x-e.getX()),Math.abs((firstIsoPoint.x-e.getX())/2));
|
||||
System.out.println("X = "+nowHitbox.getDiametrX()+ "Y = "+nowHitbox.getDiametrY());
|
||||
System.out.println("X = "+nowHitbox.getDiametrX()+ ". Y = "+nowHitbox.getDiametrY());
|
||||
float temp = (float)Math.sqrt(2);
|
||||
nowHitbox.setRadius((nowHitbox.getDiametrY()/2)*temp);
|
||||
// высчитываем в параметры хитбокссеркла нужный радиус и текущую реф поинт.
|
||||
// Не забываем высчитать реф поинт хитбокса относительно текущей.
|
||||
// после чего вызываем listPointsToString и нотифай, который отправляет данные на сохранение
|
||||
notifySubscribers();
|
||||
//возвращаем локальные данные текущего рисования хитбокса в нулевые значения.
|
||||
//необходимо, что бы при переходе в новый обьект, при создании хитбокса, очистился кэш канваса.
|
||||
firstIsoPoint = null;
|
||||
currentDiametrX = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user