API Entities and Components - Krystian-L-Lis/Stage GitHub Wiki

#API #EntitiesAndComponents

I_RawComponent

Type: Interface
Extends: I_Debug, __System.IQueryInterface
Description:
Alias for __System.IQueryInterface. It can be cast to other interfaces.


I_Component

Type: Interface
Extends: I_Debug
Description:
Represents a component interface with metadata.

Members

Entity

Type: Property
Accessors: Get
Description: Returns the parent entity.
Signature: PROPERTY Entity: I_Entity


Raw

Type: Property
Accessors: Get
Description: Returns the raw I_RawComponent pointer.
Signature: PROPERTY Raw: I_RawComponent


Component

Type: Function Block
Implements: I_Component
Description:
Allows registration of a function block implementing I_RawComponent. The framework automatically adds this function block to the entity's scope.

Members

FB_Init

Description: Initializes the Component with the raw component reference.
Signature:

METHOD FB_Init : BOOL
VAR_INPUT
    bInitRetains : BOOL;
    bInCopyCode  : BOOL;
    iComponent   : I_RawComponent; // Raw component to register
END_VAR

Entity

Type: Property
Accessors: Get
From: I_Component
Description: Returns the parent entity.
Signature: PROPERTY Entity: I_Entity


Raw

Type: Property
Accessors: Get
From: I_Component
Description: Returns the raw I_Component pointer.
Signature: PROPERTY Raw: I_Component


GetNextEntity

Type: Function
Description:
Retrieves the next I_Entity relative to the input, or the first entity if input is null.
Returns:

  • Ok – Success. Replaces iEntity with the next or first entity.
  • Err.InvRef – Invalid reference.
  • Err.Itf0 – Null input; no entity found.
  • Err.End – End of collection reached.

Signature:

FUNCTION GetNextEntity : Result
VAR_INPUT
    iEntity : REFERENCE TO I_Entity;
END_VAR

GetPrevEntity

Type: Function
Description:
Retrieves the previous I_Entity relative to the input, or the last entity if input is null.
Returns:

  • Ok – Success. Replaces iEntity with the previous or last entity.
  • Err.InvRef – Invalid reference.
  • Err.Itf0 – Null input; no entity found.
  • Err.End – Start of collection reached.

Signature:

FUNCTION GetPrevEntity : Result
VAR_INPUT
    iEntity : REFERENCE TO I_Entity;
END_VAR

GetOwnerFromRaw

Type: Function
Description:
Finds the owning entity of a given component. Costly.
Returns:

  • Ok – Owning entity successfully found.
  • Err.Itf0 – Null input.
  • Err.InvRef – Invalid output reference.
  • Err.NotFound – No owning entity found; iOut is null.

Signature:

FUNCTION GetOwnerFromRaw : Result
VAR_INPUT
    iIn  : I_RawComponent;
    iOut : REFERENCE TO I_Entity;
END_VAR

I_Entity

Type: Interface
Extends: I_Debug
Description:
Represents a registered entity within the Entity-Component system.

Members

GetNextComp

Type: Method
Description:
Retrieves the next component or the first if the input is null.
Returns:

  • Ok – Success. Updates iOut.
  • Err.InvRef – Invalid reference.
  • Err.ItfEq – Component does not belong to entity.
  • Err.NotFound – No components found.
  • Err.End – End of component list.

Signature:

METHOD GetNextComp : Result
VAR_INPUT
    iOut : REFERENCE TO I_Component;
END_VAR

GetPrevComp

Type: Method
Description:
Retrieves the previous component or the last if the input is null.
Returns:

  • Ok – Success. Updates iOut.
  • Err.InvRef – Invalid reference.
  • Err.ItfEq – Component does not belong to entity.
  • Err.NotFound – No components found.
  • Err.End – Start of component list.

Signature:

METHOD GetPrevComp : Result
VAR_INPUT
    iOut : REFERENCE TO I_Component;
END_VAR

Size

Type: Property
Accessors: Get
Description:
Returns the number of components managed by the entity.
Signature: PROPERTY Size : UDINT


EntityStart

Type: Function Block
Implements: I_Entity
Description:
Marks the start of an entity scope. Nested scopes are supported. Components are registered in the innermost scope.

Members

GetNextComp

Type: Method
From: I_Entity
Description:
Retrieves the next component or the first if the input is null.
Returns:

  • Ok – Success. Updates iOut.
  • Err.InvRef – Invalid reference.
  • Err.ItfEq – Component does not belong to entity.
  • Err.NotFound – No components found.
  • Err.End – End of component list.

Signature:

METHOD GetNextComp : Result
VAR_INPUT
    iOut : REFERENCE TO I_Component;
END_VAR

GetPrevComp

Type: Method
From: I_Entity
Description:
Retrieves the previous component or the last if the input is null.
Returns:

  • Ok – Success. Updates iOut.
  • Err.InvRef – Invalid reference.
  • Err.ItfEq – Component does not belong to entity.
  • Err.NotFound – No components found.
  • Err.End – Start of component list.

Signature:

METHOD GetPrevComp : Result
VAR_INPUT
    iOut : REFERENCE TO I_Component;
END_VAR

Size

Type: Property
Accessors: Get
From: I_Entity
Description:
Returns the number of components managed by the entity.
Signature: PROPERTY Size : UDINT


EntityEnd

Type: Function Block
Implements: I_Debug
Description:
Marks the end of an entity scope. No new components may be registered beyond this point.


EntityExtend

Type: Function Block
Implements: I_Debug
Description:
Reopens an entity scope to allow further modifications.

Members

FB_Init

Type: Method
Description: Initializes the function block with the entity to extend.
Signature:

METHOD FB_Init : BOOL
VAR_INPUT
    bInitRetains : BOOL;
    bInCopyCode  : BOOL;
    iEntity      : I_Entity;
END_VAR
⚠️ **GitHub.com Fallback** ⚠️