Package com.sunworld.utility
Klasse Bounds2D
java.lang.Object
com.sunworld.utility.Bounds2D
Repräsentiert ein 2-dimensionales Rechteck, definiert über einen Eckpunkt sowie Breite und Höhe.
Kann als Hitbox für Entities, Knöpfe etc. genutzt werden.
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungint
int
int
int
getWidth()
int
getX1()
int
getX2()
int
getY1()
int
getY2()
boolean
intersects
(Bounds2D other) Gibt zurück, ob dieses Bounds-Objekt und das als Parameter übergebene sich an irgendeinem Punkt überlappen.boolean
isInside
(int x, int y) void
move
(int x, int y) void
setPosition
(int x, int y) toString()
-
Felddetails
-
x1
private int x1 -
y1
private int y1 -
x2
private int x2 -
y2
private int y2 -
width
private final int width -
height
private final int height
-
-
Konstruktordetails
-
Bounds2D
public Bounds2D(int x, int y, int width, int height)
-
-
Methodendetails
-
isInside
public boolean isInside(int x, int y) -
move
public void move(int x, int y) -
setPosition
public void setPosition(int x, int y) -
getMiddleX
public int getMiddleX() -
getMiddleY
public int getMiddleY() -
getX1
public int getX1() -
getX2
public int getX2() -
getY1
public int getY1() -
getY2
public int getY2() -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
intersects
Gibt zurück, ob dieses Bounds-Objekt und das als Parameter übergebene sich an irgendeinem Punkt überlappen. Gibt auch true zurück, wenn die Überlappung genau am Rand stattfindet. -
toString
-