Class TriangleRendererComponent

java.lang.Object
technology.sola.engine.graphics.components.TriangleRendererComponent
All Implemented Interfaces:
technology.sola.ecs.Component

@NullMarked public class TriangleRendererComponent extends Object implements technology.sola.ecs.Component
TriangleRendererComponent is a Component containing data for rendering 2d triangles.
  • Constructor Details

    • TriangleRendererComponent

      public TriangleRendererComponent(Color color)
      Creates a "unit triangle" renderer with uniform side lengths of 1.
      Parameters:
      color - the Color of the triangle
    • TriangleRendererComponent

      public TriangleRendererComponent(Color color, Triangle triangle)
      Creates a TriangleRendererComponent of desired color that is filled.
      Parameters:
      color - the Color of the triangle
      triangle - the shape of the triangle to be rendered
    • TriangleRendererComponent

      public TriangleRendererComponent(Color color, boolean isFilled, Triangle triangle)
      Creates a TriangleRendererComponent of desired color that is either filled or not filled.
      Parameters:
      color - the Color of the triangle
      isFilled - whether the triangle should be filled or not
      triangle - the shape of the triangle to be rendered
  • Method Details

    • getColor

      public Color getColor()
      Returns:
      the Color of the triangle
    • isFilled

      public boolean isFilled()
      Returns:
      true if the triangle should be filled when rendered
    • setColor

      public void setColor(Color color)
      Sets the Color for rendering.
      Parameters:
      color - the new color
    • setFilled

      public void setFilled(boolean filled)
      Sets whether the triangle should be filled or not.
      Parameters:
      filled - the new filled status
    • getTriangle

      public Triangle getTriangle()
      Returns:
      the shape of the triangle to be rendered