Klasse Bounds2D

java.lang.Object
com.sunworld.utility.Bounds2D

public final class Bounds2D extends Object
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.
  • 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

      public boolean intersects(Bounds2D other)
      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

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object