Package ecs
Class Component
java.lang.Object
ecs.Component
- All Implemented Interfaces:
Comparable<Component>
- Direct Known Subclasses:
CharacterController,CollisionHandler,Dynamics,PointLight,PolygonCollider,SpriteAnimation,SpriteRenderer
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.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdebug()Get an array of debug lines to be rendered in debug modeprotected org.joml.Vector2fposition()Shortcut to get the current position of the parent gameobject.voidremove()Called when component is removed from GameObject.protected voidsetPosition(org.joml.Vector2f position) Shortcut to overwrite the current position of the parent gameobject.voidstart()Called once on Component initialization.voidupdate(float dt) Called once per frame for each Component
-
Field Details
-
gameObject
Parent GameObject
-
-
Constructor Details
-
Component
-
Component
public Component()
-
-
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
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
- Specified by:
compareToin interfaceComparable<Component>
-
remove
public void remove()Called when component is removed from GameObject.
-