Class Shaper.RectangleShape
java.lang.Object
ActiverseUtils.Shaper.RectangleShape
- Enclosing class:
Shaper
Represents a rectangle shape configuration.
Used to store rectangle properties for actors.
- Version:
- 1.4.1
- Author:
- Knivier
-
Constructor Summary
ConstructorsConstructorDescriptionRectangleShape(int width, int height) Creates a rectangle shape with the specified dimensions. -
Method Summary
Modifier and TypeMethodDescriptiongetBoundingBox(int x, int y) Creates a bounding box rectangle for collision detection.Gets the fill color.intGets the height of the rectangle.Gets the outline color.intGets the outline width.intgetWidth()Gets the width of the rectangle.voidPaints the rectangle on the given graphics context at the specified position.withFillColor(Color color) Sets the fill color of the rectangle.withOutlineColor(Color color) Sets the outline color of the rectangle.withOutlineWidth(int width) Sets the outline width of the rectangle.
-
Constructor Details
-
RectangleShape
public RectangleShape(int width, int height) Creates a rectangle shape with the specified dimensions.- Parameters:
width- The width of the rectangleheight- The height of the rectangle
-
-
Method Details
-
withFillColor
Sets the fill color of the rectangle.- Parameters:
color- The color to fill the rectangle with- Returns:
- This RectangleShape instance for method chaining
-
withOutlineColor
Sets the outline color of the rectangle.- Parameters:
color- The color for the rectangle outline- Returns:
- This RectangleShape instance for method chaining
-
withOutlineWidth
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
-
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
Paints the rectangle on the given graphics context at the specified position.- Parameters:
g- The graphics context to draw onx- The x-coordinate of the rectangley- The y-coordinate of the rectangle
-
getBoundingBox
Creates a bounding box rectangle for collision detection.- Parameters:
x- The x-coordinate of the rectangley- The y-coordinate of the rectangle- Returns:
- A Rectangle representing the bounding box
-