Package ecs

Class Component

java.lang.Object
ecs.Component
All Implemented Interfaces:
Comparable<Component>
Direct Known Subclasses:
CharacterController, CollisionHandler, Dynamics, PointLight, PolygonCollider, SpriteAnimation, SpriteRenderer

public abstract class Component extends Object implements Comparable<Component>

Azurite

Abstract structure for ECS Components. It is highly recommended to use this when implementing any system that can/should be applied to a GameObject.
  • Field Details

    • gameObject

      public GameObject gameObject
      Parent GameObject
  • Constructor Details

  • Method Details

    • start

      public void start()
      Called once on Component initialization.
    • update

      public void update(float dt)
      Called once per frame for each Component
      Parameters:
      dt - Engine.deltaTime
    • debug

      public DebugPrimitive[] debug()
      Get an array of debug lines to be rendered in debug mode
      Returns:
      an array of lines to be rendered in debug mode
    • position

      protected org.joml.Vector2f position()
      Shortcut to get the current position of the parent gameobject.
      Returns:
      the current position of the parent gameobject
    • setPosition

      protected void setPosition(org.joml.Vector2f position)
      Shortcut to overwrite the current position of the parent gameobject.
    • compareTo

      public int compareTo(Component o)
      Specified by:
      compareTo in interface Comparable<Component>
    • remove

      public void remove()
      Called when component is removed from GameObject.