java.lang.Object
dev.prozilla.pine.core.rendering.shape.Shape
dev.prozilla.pine.core.rendering.shape.Rect
All Implemented Interfaces:
Cloneable<Shape>, ColoredDrawable, Drawable, TexturedDrawable
Direct Known Subclasses:
RoundedRect

public class Rect extends Shape
Generates a rectangular shape.
  • Field Details

  • Constructor Details

  • Method Details

    • generateVertices

      protected float[] generateVertices()
      Description copied from class: Shape
      Generates the vertex array for this shape.

      Odd elements define the x-component of the vertex and even elements define the y-component.

      Every three vertices (or six elements) define a triangle.

      Specified by:
      generateVertices in class Shape
      Returns:
      The array of vertices.
    • generateUVs

      protected float[] generateUVs()
      Description copied from class: Shape
      Generates the UV array for this shape.

      Odd elements define the x-component of the texture coordinate and even elements define the y-component.

      Specified by:
      generateUVs in class Shape
      Returns:
      The array of texture coordinates.
    • getX

      public float getX()
    • getY

      public float getY()
    • setX

      public void setX(float x)
    • setY

      public void setY(float y)
    • setPosition

      public void setPosition(Vector2f position)
    • getWidth

      public float getWidth()
      Returns the width of this rectangle.
      Returns:
      The width of this rectangle.
    • getHeight

      public float getHeight()
      Returns the height of this rectangle.
      Returns:
      The height of this rectangle.
    • setWidth

      public void setWidth(float width)
      Sets the width of this rectangle.
      Parameters:
      width - The new width
    • setHeight

      public void setHeight(float height)
      Sets the height of this rectangle.
      Parameters:
      height - The new height
    • setSize

      public void setSize(Vector2f size)
      Sets the size of this rectangle.
      Parameters:
      size - The new size
    • setAnchor

      public void setAnchor(GridAlignment anchor)
      Sets the anchor point of this rectangle.
      Parameters:
      anchor - The new anchor point
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(Shape shape)
      Description copied from interface: Cloneable
      Checks if the given object is equal to this object.
      Parameters:
      shape - Other object
      Returns:
      true if both objects are equal.
    • equals

      public boolean equals(Rect rect)
    • clone

      public Rect clone()
      Description copied from interface: Cloneable
      Returns a new object that is equal to this object.
      Specified by:
      clone in interface Cloneable<Shape>
      Specified by:
      clone in class Shape
      Returns:
      Clone of this object