ComponentManager Class Referenceabstract
#include <ComponentManager.h>
![](../class_component_manager.png)
# Public Member Functions | |
void | constructor () |
Class' constructor. | |
void | destroyAllComponents () |
Destroy all the manager's components. | |
virtual uint32 | getType ()=0 |
virtual void | enable () |
Enable the manager. | |
virtual void | disable () |
Disable the manager. | |
virtual Component | create (Entity owner, const ComponentSpec *componentSpec)=0 |
virtual void | purgeComponents () |
Force the purging of deleted components. | |
virtual bool | areComponentsVisual () |
# Static Public Member Functions | |
static Component | createComponent (Entity owner, const ComponentSpec *componentSpec) |
static void | destroyComponent (Entity owner, Component component) |
static Component | addComponent (Entity owner, const ComponentSpec *componentSpec) |
static void | removeComponent (Entity owner, Component component) |
static void | addComponents (Entity owner, ComponentSpec **componentSpecs, uint32 componentType) |
static void | removeComponents (Entity owner, uint32 componentType) |
static void | createComponents (Entity owner, ComponentSpec **componentSpecs) |
static void | destroyComponents (Entity owner) |
static Component | getComponentAtIndex (Entity owner, uint32 componentType, int16 componentIndex) |
static void | getComponents (Entity owner, uint32 componentType, VirtualList components) |
static bool | getComponentsOfClass (Entity owner, ClassPointer classPointer, VirtualList components, uint32 componentType) |
static uint16 | getComponentsCount (Entity owner, uint32 componentType) |
static void | propagateCommand (int32 command, Entity owner, uint32 componentType,...) |
static bool | calculateRightBox (Entity owner, RightBox *rightBox) |
# Protected Attributes | |
VirtualList | components |
List of components. | |
bool | locked |
Flag to prevent the manipulation of the components list. |
# Additional Inherited Members | |
![]() | |
void | constructor () |
Class' constructor. | |
void | destructor () |
Class' destructor. | |
void | addEventListener (ListenerObject listener, uint16 eventCode) |
void | removeEventListener (ListenerObject listener, uint16 eventCode) |
void | removeEventListeners (uint16 eventCode) |
void | removeAllEventListeners () |
Remove all listener objects. | |
bool | hasActiveEventListeners () |
void | fireEvent (uint16 eventCode) |
void | sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay) |
void | sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay) |
void | discardAllMessages () |
Discard all messages, both to be sent and to be received. | |
void | discardMessages (uint32 message) |
virtual bool | onEvent (ListenerObject eventFirer, uint16 eventCode) |
virtual bool | handleMessage (Telegram telegram) |
![]() | |
VirtualList | events |
List of registered events. | |
int8 | eventFirings |
Counter that keeps track of the number of fired events to prevent race conditions in nested firings. |
# Detailed Description
Class ComponentManager
Inherits from Object
Manages component instances.
Definition at line 38 of file ComponentManager.h.
# Member Function Documentation
# addComponent()
|
static |
Add a component to the specified owner.
- Parameters
-
owner Object to which the components attach to componentSpec Spec to initialize the new component
- Returns
- Added component
Definition at line 113 of file ComponentManager.c.
# addComponents()
|
static |
Add components to the specified owner.
- Parameters
-
owner Object to which the components attach to componentSpecs Specs to initialize the new components componentType Type of components to add
Definition at line 142 of file ComponentManager.c.
# areComponentsVisual()
|
virtual |
Retrieve information regarding if the components are visile.
- Returns
- True if the components managed are visual; false otherwise
Reimplemented in SpriteManager, and WireframeManager.
Definition at line 746 of file ComponentManager.c.
# calculateRightBox()
Compute the rightbox for the owner in base of its visual components.
- Parameters
-
owner Entity that the components attaches to rightBox Rightbox to configure
- Returns
- True if the owner has visual components; false otherwise
Definition at line 453 of file ComponentManager.c.
# constructor()
void ComponentManager::constructor | ( | ) |
Class' constructor.
Definition at line 639 of file ComponentManager.c.
# create()
|
pure virtual |
Create a component with the provided spec.
- Parameters
-
owner Object to which the component will attach to componentSpec Spec to use to initialize the component
- Returns
- Created component
# createComponent()
|
static |
Create a component with the specified owner.
- Parameters
-
owner Owner of the component (can be NULL) componentSpec Spec to initialize the new component
- Returns
- Created component
Definition at line 47 of file ComponentManager.c.
# createComponents()
|
static |
Create all the components from the specified specs array and attache to the provided owner.
- Parameters
-
owner Object to which the components attach to componentSpecs Specs to initialize the new components
Definition at line 203 of file ComponentManager.c.
# destroyAllComponents()
void ComponentManager::destroyAllComponents | ( | ) |
Destroy all the manager's components.
Definition at line 668 of file ComponentManager.c.
# destroyComponent()
Destroy a component from the specified owner.
- Parameters
-
owner Owner of the component (can be NULL), must match the component's owner component Component to destroy
Definition at line 73 of file ComponentManager.c.
# destroyComponents()
|
static |
Destroy all the components from the specified owner.
- Parameters
-
owner Object to which the components attach to
Definition at line 224 of file ComponentManager.c.
# disable()
|
virtual |
Disable the manager.
Reimplemented in BehaviorManager, BodyManager, ColliderManager, MutatorManager, SpriteManager, WireframeManager, and WireframeManager.
Definition at line 708 of file ComponentManager.c.
# enable()
|
virtual |
Enable the manager.
Reimplemented in BehaviorManager, BodyManager, ColliderManager, MutatorManager, SpriteManager, WireframeManager, and WireframeManager.
Definition at line 701 of file ComponentManager.c.
# getComponentAtIndex()
|
static |
Retrieve a component of the given type at the desired position.
- Parameters
-
owner Object to which the components attach to componentType Type of components to add componentIndex Component's index according to their order of creation
- Returns
- Component at the provided index position
Definition at line 258 of file ComponentManager.c.
# getComponents()
|
static |
Retrieve a list with the components of the provided type belonging to the provided owner.
- Parameters
-
owner Object to which the components attach to componentType Type of components to add components List to populate with the owner's compontents
Definition at line 290 of file ComponentManager.c.
# getComponentsCount()
Retrieve the number of components belonging to the provided owner.
- Parameters
-
owner Object to which the components attach to componentType Type of components to count
- Returns
- Number of components belonging to the provided owner
Definition at line 356 of file ComponentManager.c.
# getComponentsOfClass()
|
static |
Retrieve the linked list of components that are instances of the provided class.
- Parameters
-
owner Object to which the components attach to classPointer Pointer to the class to use as search criteria. Usage: typeofclass(ClassName) components Linked list to be filled with the components that meed the search criteria (it is externally allocated and must be externally deleted) componentType Type of components to retrieve
- Returns
- True if one or more components met the search criteria; false otherwise
Definition at line 317 of file ComponentManager.c.
# getType()
|
pure virtual |
Retrieve the compoment type that the manager manages.
- Returns
- Component type
Implemented in BehaviorManager, BodyManager, ColliderManager, MutatorManager, SpriteManager, and WireframeManager.
# propagateCommand()
|
static |
Propagate a command to the components of the provided type.
- Parameters
-
command Command to propagate to all the components of the provided tyep owner Owner of the components to command (all if NULL) componentType Type of components towards which to propagate the command ... Variable arguments list depending on the command
Definition at line 401 of file ComponentManager.c.
# purgeComponents()
|
virtual |
Force the purging of deleted components.
Reimplemented in SpriteManager.
Definition at line 715 of file ComponentManager.c.
# removeComponent()
Remove a component from the specified owner.
Definition at line 125 of file ComponentManager.c.
# removeComponents()
Remove components from the specified owner.
- Parameters
-
owner Object to which the components attach to componentType Type of components to remove
Definition at line 166 of file ComponentManager.c.
# Member Data Documentation
# components
|
protected |
List of components.
Definition at line 43 of file ComponentManager.h.
# locked
|
protected |
Flag to prevent the manipulation of the components list.
Definition at line 46 of file ComponentManager.h.
The documentation for this class was generated from the following files:
- VUEngine-Core/source/Component/ComponentManager.h
- VUEngine-Core/source/Component/ComponentManager.c