Class Shaper.RectangleShape

java.lang.Object
ActiverseUtils.Shaper.RectangleShape
Enclosing class:
Shaper

public static class Shaper.RectangleShape extends Object
Represents a rectangle shape configuration. Used to store rectangle properties for actors.
Version:
1.4.1
Author:
Knivier
  • Constructor Details

    • RectangleShape

      public RectangleShape(int width, int height)
      Creates a rectangle shape with the specified dimensions.
      Parameters:
      width - The width of the rectangle
      height - The height of the rectangle
  • Method Details

    • withFillColor

      public Shaper.RectangleShape withFillColor(Color color)
      Sets the fill color of the rectangle.
      Parameters:
      color - The color to fill the rectangle with
      Returns:
      This RectangleShape instance for method chaining
    • withOutlineColor

      public Shaper.RectangleShape withOutlineColor(Color color)
      Sets the outline color of the rectangle.
      Parameters:
      color - The color for the rectangle outline
      Returns:
      This RectangleShape instance for method chaining
    • withOutlineWidth

      public Shaper.RectangleShape withOutlineWidth(int width)
      Sets the outline width of the rectangle.
      Parameters:
      width - The width of the outline in pixels
      Returns:
      This RectangleShape instance for method chaining
    • getWidth

      public int getWidth()
      Gets the width of the rectangle.
      Returns:
      The width
    • getHeight

      public int getHeight()
      Gets the height of the rectangle.
      Returns:
      The height
    • getFillColor

      public Color getFillColor()
      Gets the fill color.
      Returns:
      The fill color
    • getOutlineColor

      public Color getOutlineColor()
      Gets the outline color.
      Returns:
      The outline color, or null if not set
    • getOutlineWidth

      public int getOutlineWidth()
      Gets the outline width.
      Returns:
      The outline width
    • paint

      public void paint(Graphics g, int x, int y)
      Paints the rectangle on the given graphics context at the specified position.
      Parameters:
      g - The graphics context to draw on
      x - The x-coordinate of the rectangle
      y - The y-coordinate of the rectangle
    • getBoundingBox

      public Rectangle getBoundingBox(int x, int y)
      Creates a bounding box rectangle for collision detection.
      Parameters:
      x - The x-coordinate of the rectangle
      y - The y-coordinate of the rectangle
      Returns:
      A Rectangle representing the bounding box