NAP
Public Member Functions | List of all members
Component Class Referenceabstract

#include <component.h>

Public Member Functions

virtual void getDependentComponents (std::vector< rtti::TypeInfo > &components) const
 
virtual const rtti::TypeInfo getInstanceType () const =0
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual bool init (utility::ErrorState &errorState)
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Description

Resource part of a component. This represents the the static data that is deserialized from json. A run time counterpart is created after deserialization. Derived classes need to implement the DECLARE_COMPONENT macro, This macro tells the system what the run time counterpart of the resource is.

Inheritance diagram for Component:
[legend]
Collaboration diagram for Component:
[legend]

Member Function Documentation

◆ getDependentComponents()

virtual void getDependentComponents ( std::vector< rtti::TypeInfo > &  components) const
virtual

Populates a list of components this component depends on. Every component dependency, when found, is initialized before this component. A dependency is NOT a hard requirement. Serialization will not fail if the dependent component isn't declared in JSON. It only means that when a component is declared under the same entity, and that component is tagged as a dependency of this component, it is initialized before this component. It is your responsibility to return false on initialization if the dependency is a hard requirement and can't be found. To ensure the right order of initialization based on a hard requirement it is advised to use a nap::ComponentPtr instead.

Parameters
componentslist of component types this resource depends on.

Reimplemented in LightComponent, CameraController, PythonScriptComponent, RenderableMeshComponent, RotateComponent, Renderable3DTextComponent, RenderFrustumComponent, FirstPersonController, OrbitController, OrthoController, RenderGnomonComponent, RenderSkyBoxComponent, and CameraComponent.

◆ getInstanceType()

virtual const rtti::TypeInfo getInstanceType ( ) const
pure virtual

Get the type of ComponentInstance that should be created from this Component