done scaling
This commit is contained in:
@ -2,23 +2,23 @@
|
|||||||
<objecttypes>
|
<objecttypes>
|
||||||
<objecttype color="#a0a0a4" name="misato">
|
<objecttype color="#a0a0a4" name="misato">
|
||||||
<property default="Solid" name="class" type="string"/>
|
<property default="Solid" name="class" type="string"/>
|
||||||
<property default="3 4 197 3 168 191 72 189 " name="drawbox" type="string"/>
|
<property default="0 1 197 0 187 167 74 190 " name="drawbox" type="string"/>
|
||||||
<property default="Circle -19 11 40" name="hitbox" type="string"/>
|
<property default="Circle -18 11 40" name="hitbox" type="string"/>
|
||||||
</objecttype>
|
</objecttype>
|
||||||
<objecttype color="#a0a0a4" name="starlight">
|
<objecttype color="#a0a0a4" name="starlight">
|
||||||
<property default="Solid" name="class" type="string"/>
|
<property default="Solid" name="class" type="string"/>
|
||||||
<property default="4 3 162 9 129 121 53 140 " name="drawbox" type="string"/>
|
<property default="4 3 162 9 129 121 53 140 " name="drawbox" type="string"/>
|
||||||
<property default="Circle 14 3 28" name="hitbox" type="string"/>
|
<property default="Circle 7 -2 28" name="hitbox" type="string"/>
|
||||||
</objecttype>
|
</objecttype>
|
||||||
<objecttype color="#a0a0a4" name="tavern">
|
<objecttype color="#a0a0a4" name="tavern">
|
||||||
<property default="Solid" name="class" type="string"/>
|
<property default="Solid" name="class" type="string"/>
|
||||||
<property default="93 47 303 55 245 301 90 286 " name="drawbox" type="string"/>
|
<property default="130 39 3977 65 4121 2479 117 2459 " name="drawbox" type="string"/>
|
||||||
<property default="Rectangle 4036 2332 271 201" name="hitbox" type="string"/>
|
<property default="Rectangle -32 42 2018 1992" name="hitbox" type="string"/>
|
||||||
</objecttype>
|
</objecttype>
|
||||||
<objecttype color="#a0a0a4" name="TopHome">
|
<objecttype color="#a0a0a4" name="TopHome">
|
||||||
<property default="Solid" name="class" type="string"/>
|
<property default="Solid" name="class" type="string"/>
|
||||||
<property default="3 2 252 1 253 605 6 608" name="drawbox" type="string"/>
|
<property default="4 14 1780 0 1785 2162 58 2182 " name="drawbox" type="string"/>
|
||||||
<property default="Rectangle 2212 1964 183 31" name="hitbox" type="string"/>
|
<property default="Rectangle -5 0 858 887" name="hitbox" type="string"/>
|
||||||
</objecttype>
|
</objecttype>
|
||||||
<objecttype color="000000" name="newtest">
|
<objecttype color="000000" name="newtest">
|
||||||
<property default="solid" name="class" type="string"/>
|
<property default="solid" name="class" type="string"/>
|
||||||
|
|||||||
BIN
res/маг_2.png
Normal file
BIN
res/маг_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@ -1,9 +1,9 @@
|
|||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
import java.awt.BasicStroke;
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.RenderingHints;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.event.MouseMotionListener;
|
import java.awt.event.MouseMotionListener;
|
||||||
@ -26,6 +26,7 @@ public class EditableCanvas extends JPanel implements MouseListener, MouseMotion
|
|||||||
ShapeRenderingFunction renderingFunction;
|
ShapeRenderingFunction renderingFunction;
|
||||||
Entity entity;
|
Entity entity;
|
||||||
BufferedImage image;
|
BufferedImage image;
|
||||||
|
private float scaleIndex = 1;
|
||||||
|
|
||||||
|
|
||||||
public EditableCanvas() {
|
public EditableCanvas() {
|
||||||
@ -83,18 +84,34 @@ public class EditableCanvas extends JPanel implements MouseListener, MouseMotion
|
|||||||
protected void paintComponent(Graphics g) {
|
protected void paintComponent(Graphics g) {
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
if(image!=null) {
|
if(image!=null) {
|
||||||
g.drawImage(image, 0, 0, this);
|
calculatedScaledIndex();
|
||||||
g.setColor(Color.darkGray);
|
g.drawImage(image, 0, 0, (int) (image.getWidth() * scaleIndex),
|
||||||
g.drawRect(0, 0, image.getWidth(), image.getHeight());
|
(int) (image.getHeight() * scaleIndex), this);
|
||||||
g.setColor(Color.RED);
|
|
||||||
g.fillOval(image.getWidth()/2, image.getHeight(), 2, 2);
|
|
||||||
g.setColor(Color.green);
|
g.setColor(Color.green);
|
||||||
}
|
}
|
||||||
if(entity != null) {
|
if(entity != null) {
|
||||||
drawing((Graphics2D)g);
|
drawing((Graphics2D)g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//нерабочая херня
|
||||||
|
public void calculatedScaledIndex() {
|
||||||
|
int imageWidth = image.getWidth(), imageHeight = image.getHeight();
|
||||||
|
float iconMaxWidth = this.getWidth();
|
||||||
|
float iconMaxHeight = this.getHeight();
|
||||||
|
float scaleFactorX = iconMaxWidth / imageWidth, scaleFactorY = iconMaxHeight / imageHeight;
|
||||||
|
scaleIndex = scaleFactorX < scaleFactorY ? scaleFactorX : scaleFactorY;
|
||||||
|
entity.setScaleIndex(scaleIndex);
|
||||||
|
System.out.println("imageWidth: "+imageWidth);
|
||||||
|
System.out.println("imageHeight: "+imageHeight);
|
||||||
|
System.out.println("iconMaxWidth: "+iconMaxWidth);
|
||||||
|
System.out.println("iconMaxHeight: "+iconMaxHeight);
|
||||||
|
|
||||||
|
System.out.println("scaleFactorX: "+scaleFactorX);
|
||||||
|
System.out.println("scaleFactorY: "+scaleFactorY);
|
||||||
|
System.out.println("scaleIndex: "+scaleIndex);
|
||||||
|
System.out.println("_____________________: ");
|
||||||
|
}
|
||||||
|
|
||||||
public void setEntity(Entity e) {
|
public void setEntity(Entity e) {
|
||||||
entity = e;
|
entity = e;
|
||||||
drawboxRectengleRenderFunct.setEntityInDrawboxRectengle(e);
|
drawboxRectengleRenderFunct.setEntityInDrawboxRectengle(e);
|
||||||
|
|||||||
@ -22,12 +22,15 @@ public class DrawboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
private List<EntityDrawboxChangedListener> listeners = new ArrayList<>();
|
private List<EntityDrawboxChangedListener> listeners = new ArrayList<>();
|
||||||
Entity entity;
|
Entity entity;
|
||||||
Logger logger = Logger.getLogger("gui.DrawboxRectangleEditor");
|
Logger logger = Logger.getLogger("gui.DrawboxRectangleEditor");
|
||||||
|
private float scaleIndex = 1;
|
||||||
|
|
||||||
public DrawboxRectengleRenderingFunction() {
|
public DrawboxRectengleRenderingFunction() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawing(Graphics2D g) {
|
public void drawing(Graphics2D g) {
|
||||||
|
scaleIndex = entity.getScaleIndex();
|
||||||
Drawbox drawbox = entity.getDrawbox();
|
Drawbox drawbox = entity.getDrawbox();
|
||||||
drawboxPoints = drawbox.getDrawboxlistPoints();
|
drawboxPoints = drawbox.getDrawboxlistPoints();
|
||||||
basePoints = drawbox.getbaseListPoints();
|
basePoints = drawbox.getbaseListPoints();
|
||||||
@ -39,13 +42,13 @@ public class DrawboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
|
|
||||||
if(drawboxPoints.size() >= 1 && drawboxPoints.size() < 4) {
|
if(drawboxPoints.size() >= 1 && drawboxPoints.size() < 4) {
|
||||||
Point lastPoint = drawboxPoints.get(drawboxPoints.size()-1);
|
Point lastPoint = drawboxPoints.get(drawboxPoints.size()-1);
|
||||||
g.drawLine((int)lastPoint.x, (int)lastPoint.y, (int)currentPoint.x, (int)currentPoint.y);
|
g.drawLine((int)(lastPoint.x*scaleIndex), (int)(lastPoint.y*scaleIndex), (int)(currentPoint.x*scaleIndex), (int)(currentPoint.y*scaleIndex));
|
||||||
for(int i = 0; i < drawboxPoints.size()-1;i++) {
|
for(int i = 0; i < drawboxPoints.size()-1;i++) {
|
||||||
int x1 = (int)drawboxPoints.get(i).x;
|
int x1 = (int)drawboxPoints.get(i).x;
|
||||||
int y1 = (int)drawboxPoints.get(i).y;
|
int y1 = (int)drawboxPoints.get(i).y;
|
||||||
int x2 = (int)drawboxPoints.get(i+1).x;
|
int x2 = (int)drawboxPoints.get(i+1).x;
|
||||||
int y2 = (int)drawboxPoints.get(i+1).y;
|
int y2 = (int)drawboxPoints.get(i+1).y;
|
||||||
g.drawLine(x1, y1, x2, y2);
|
g.drawLine((int)(x1*scaleIndex), (int)(y1*scaleIndex), (int)(x2*scaleIndex), (int)(y2*scaleIndex));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(int i = 0; i < drawboxPoints.size();i++) {
|
for(int i = 0; i < drawboxPoints.size();i++) {
|
||||||
@ -53,7 +56,7 @@ public class DrawboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
int y1 = (int)drawboxPoints.get(i % drawboxPoints.size()).y;
|
int y1 = (int)drawboxPoints.get(i % drawboxPoints.size()).y;
|
||||||
int x2 = (int)drawboxPoints.get((i+1) % drawboxPoints.size()).x;
|
int x2 = (int)drawboxPoints.get((i+1) % drawboxPoints.size()).x;
|
||||||
int y2 = (int)drawboxPoints.get((i+1) % drawboxPoints.size()).y;
|
int y2 = (int)drawboxPoints.get((i+1) % drawboxPoints.size()).y;
|
||||||
g.drawLine(x1, y1, x2, y2);
|
g.drawLine((int)(x1*scaleIndex), (int)(y1*scaleIndex), (int)(x2*scaleIndex), (int)(y2*scaleIndex));
|
||||||
}
|
}
|
||||||
// ОТРИСОВКА ОСНОВАНИЯ
|
// ОТРИСОВКА ОСНОВАНИЯ
|
||||||
g.setColor(Color.BLUE);
|
g.setColor(Color.BLUE);
|
||||||
@ -62,7 +65,7 @@ public class DrawboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
int y1 = (int)basePoints.get(i).y;
|
int y1 = (int)basePoints.get(i).y;
|
||||||
int x2 = (int)basePoints.get(i+1).x;
|
int x2 = (int)basePoints.get(i+1).x;
|
||||||
int y2 = (int)basePoints.get(i+1).y;
|
int y2 = (int)basePoints.get(i+1).y;
|
||||||
g.drawLine(x1, y1+3, x2, y2+3);
|
g.drawLine((int)(x1*scaleIndex), (int)(y1*scaleIndex), (int)(x2*scaleIndex), (int)(y2*scaleIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +74,7 @@ public class DrawboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
if(drawboxPoints.size() < 4) {
|
if(drawboxPoints.size() < 4) {
|
||||||
Point p = new Point(e.getX(), e.getY());
|
Point p = new Point(currentPoint.x, currentPoint.y);
|
||||||
drawboxPoints.add(p);
|
drawboxPoints.add(p);
|
||||||
if(drawboxPoints.size() == 4) {
|
if(drawboxPoints.size() == 4) {
|
||||||
sortingDrawboxPoints();
|
sortingDrawboxPoints();
|
||||||
@ -88,8 +91,8 @@ public class DrawboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
currentPoint.x = e.getX();
|
currentPoint.x = e.getX()/scaleIndex;
|
||||||
currentPoint.y = e.getY();
|
currentPoint.y = e.getY()/scaleIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Точки должны идти в определенном порядке:
|
/*Точки должны идти в определенном порядке:
|
||||||
|
|||||||
@ -16,37 +16,43 @@ public class HitboxCircleRenderingFunction implements ShapeRenderingFunction {
|
|||||||
Point currentIsoPoint = new Point(0,0);
|
Point currentIsoPoint = new Point(0,0);
|
||||||
int currentDiametrX=0;
|
int currentDiametrX=0;
|
||||||
Entity entity;
|
Entity entity;
|
||||||
|
private float scaleIndex = 1;
|
||||||
private List<EntityHitboxChangedListener> listeners = new ArrayList<>();
|
private List<EntityHitboxChangedListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
public void setEntityInHitboxCircle(Entity e) {
|
public void setEntityInHitboxCircle(Entity e) {
|
||||||
entity = e;
|
entity = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawing(Graphics2D g) {
|
public void drawing(Graphics2D g) {
|
||||||
|
scaleIndex = entity.getScaleIndex();
|
||||||
HitboxCircle nowHitbox = (HitboxCircle)entity.getHitbox();
|
HitboxCircle nowHitbox = (HitboxCircle)entity.getHitbox();
|
||||||
if(nowHitbox.getRadius()!=0) {
|
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*scaleIndex), (int)((nowHitbox.getCurrentRefPoint().y-(nowHitbox.getDiametrY()/2))*scaleIndex ), (int)(nowHitbox.getDiametrX()*scaleIndex ), (int)(nowHitbox.getDiametrY()*scaleIndex ));
|
||||||
// System.out.println("READY: diametrX = "+nowHitbox.getDiametrX()+ ". diametrY = "+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)));
|
// System.out.println("READY: coordX = "+(int)nowHitbox.getCurrentRefPoint().x+ ". coordY = "+(int)(nowHitbox.getCurrentRefPoint().y-(nowHitbox.getDiametrY()/2)));
|
||||||
|
|
||||||
}else if(firstIsoPoint != null) {
|
}else if(firstIsoPoint != null) {
|
||||||
currentDiametrX = Math.abs((int)firstIsoPoint.x-(int)currentIsoPoint.x);
|
currentDiametrX = Math.abs((int)(firstIsoPoint.x )-(int)(currentIsoPoint.x ));
|
||||||
// System.out.println("CURRENT: coordX = "+(int)firstIsoPoint.x+ ". coordX = "+(int)(firstIsoPoint.y-currentDiametrX/4));
|
// System.out.println("CURRENT: coordX = "+(int)firstIsoPoint.x+ ". coordX = "+(int)(firstIsoPoint.y-currentDiametrX/4));
|
||||||
// System.out.println("CURRENT: diametrX = "+currentDiametrX+ ". diametrY = "+currentDiametrX/2);
|
// System.out.println("CURRENT: diametrX = "+currentDiametrX+ ". diametrY = "+currentDiametrX/2);
|
||||||
g.drawOval((int)firstIsoPoint.x, (int)(firstIsoPoint.y-currentDiametrX/4), (int)currentDiametrX, (int)currentDiametrX/2);
|
g.drawOval((int)(firstIsoPoint.x*scaleIndex), (int)((firstIsoPoint.y - currentDiametrX/4)*scaleIndex), (int)(currentDiametrX*scaleIndex ), (int)(currentDiametrX/2*scaleIndex ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//это рисование. Во время рисования, нам необходимо наоборот делить текущие координаты которые мы нажимаем на scaleIndex.
|
||||||
|
//так мы получим актуальные данные в entity
|
||||||
|
//и уже они пусть обратно умножаются и в drawing отрисовывается все правильно.
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
HitboxCircle nowHitbox = (HitboxCircle)entity.getHitbox();
|
HitboxCircle nowHitbox = (HitboxCircle)entity.getHitbox();
|
||||||
if(nowHitbox.getRadius()==0 && firstIsoPoint == null) {
|
if(nowHitbox.getRadius()==0 && firstIsoPoint == null) {
|
||||||
firstIsoPoint = new Point(e.getX(), e.getY());
|
firstIsoPoint = new Point(currentIsoPoint.x, currentIsoPoint.y);
|
||||||
}else if(nowHitbox.getRadius()==0 && firstIsoPoint != null) {
|
}else if(nowHitbox.getRadius()==0 && firstIsoPoint != null) {
|
||||||
//Формула высчитывания радиуса из диаметров circle.
|
//Формула высчитывания радиуса из диаметров circle.
|
||||||
nowHitbox.getCurrentRefPoint().setXY(firstIsoPoint.x, firstIsoPoint.y);
|
nowHitbox.getCurrentRefPoint().setXY(firstIsoPoint.x, firstIsoPoint.y);
|
||||||
nowHitbox.setDiametrXY(Math.abs(firstIsoPoint.x-e.getX()),Math.abs((firstIsoPoint.x-e.getX())/2));
|
nowHitbox.setDiametrXY(Math.abs(firstIsoPoint.x-currentIsoPoint.x),Math.abs((firstIsoPoint.x-currentIsoPoint.x)/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);
|
float temp = (float)Math.sqrt(2);
|
||||||
nowHitbox.setRadius((nowHitbox.getDiametrY()/2)*temp);
|
nowHitbox.setRadius((nowHitbox.getDiametrY()/2)*temp);
|
||||||
@ -64,8 +70,8 @@ public class HitboxCircleRenderingFunction implements ShapeRenderingFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
currentIsoPoint.x = e.getX();
|
currentIsoPoint.x = e.getX()/scaleIndex;
|
||||||
currentIsoPoint.y = e.getY();
|
currentIsoPoint.y = e.getY()/scaleIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void functionClearHitboxJButton() {
|
public void functionClearHitboxJButton() {
|
||||||
|
|||||||
@ -22,6 +22,7 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
Entity entity;
|
Entity entity;
|
||||||
private List<Point> LocalListPointsIso = new ArrayList<Point>();
|
private List<Point> LocalListPointsIso = new ArrayList<Point>();
|
||||||
private List<Point> LocalListPointsCartesian = new ArrayList<Point>();
|
private List<Point> LocalListPointsCartesian = new ArrayList<Point>();
|
||||||
|
private float scaleIndex = 1;
|
||||||
|
|
||||||
public List<Point> getLocalListPointsIso() {
|
public List<Point> getLocalListPointsIso() {
|
||||||
return LocalListPointsIso;
|
return LocalListPointsIso;
|
||||||
@ -37,6 +38,7 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawing(Graphics2D g) {
|
public void drawing(Graphics2D g) {
|
||||||
|
scaleIndex = entity.getScaleIndex();
|
||||||
HitboxRectangle nowHitbox = (HitboxRectangle)entity.getHitbox();
|
HitboxRectangle nowHitbox = (HitboxRectangle)entity.getHitbox();
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
if(nowHitbox.getListPointsIso().size() == 4) {
|
if(nowHitbox.getListPointsIso().size() == 4) {
|
||||||
@ -56,13 +58,13 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
y1 = (int)listPointsIso.get(i % size).y;
|
y1 = (int)listPointsIso.get(i % size).y;
|
||||||
x2 = (int)listPointsIso.get((i+1) % size).x;
|
x2 = (int)listPointsIso.get((i+1) % size).x;
|
||||||
y2 = (int)listPointsIso.get((i+1) % size).y;
|
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;
|
x1 = (int)listPointsIso.get(0).x;
|
||||||
y1 = (int)listPointsIso.get(0).y;
|
y1 = (int)listPointsIso.get(0).y;
|
||||||
x2 = (int)listPointsIso.get(3).x;
|
x2 = (int)listPointsIso.get(3).x;
|
||||||
y2 = (int)listPointsIso.get(3).y;
|
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
|
@Override
|
||||||
@ -93,8 +95,8 @@ public class HitboxRectengleRenderingFunction implements ShapeRenderingFunction
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
currentIsoPoint.x = e.getX();
|
currentIsoPoint.x = e.getX()/scaleIndex;
|
||||||
currentIsoPoint.y = e.getY();
|
currentIsoPoint.y = e.getY()/scaleIndex;
|
||||||
HitboxRectangle nowHitbox = (HitboxRectangle)entity.getHitbox();
|
HitboxRectangle nowHitbox = (HitboxRectangle)entity.getHitbox();
|
||||||
if(entity!=null) {
|
if(entity!=null) {
|
||||||
if(firstIsoPoint != null && nowHitbox.getListPointsIso().size() == 0) {
|
if(firstIsoPoint != null && nowHitbox.getListPointsIso().size() == 0) {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ public class Entity {
|
|||||||
private BufferedImage thisImage;
|
private BufferedImage thisImage;
|
||||||
private int width = 0;
|
private int width = 0;
|
||||||
private int height = 0;
|
private int height = 0;
|
||||||
|
private float scaleIndex = 1;
|
||||||
|
|
||||||
public Entity(String name, String drawbox, String hitbox, BufferedImage sprite) {
|
public Entity(String name, String drawbox, String hitbox, BufferedImage sprite) {
|
||||||
thisName = new String(name);
|
thisName = new String(name);
|
||||||
@ -101,4 +102,11 @@ public class Entity {
|
|||||||
public void setHeight(int height) {
|
public void setHeight(int height) {
|
||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setScaleIndex(float index) {
|
||||||
|
scaleIndex = index;
|
||||||
|
}
|
||||||
|
public float getScaleIndex() {
|
||||||
|
return scaleIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user