ProtoZed  awesome branch
A simple but powerful game framework
Public Member Functions | Protected Member Functions | Friends | List of all members
PZ::Component Class Reference

Small reusable block of behavior. More...

Inheritance diagram for PZ::Component:
PZ::NonCopyable PZ::PropertyList PZ::EventHandler PZ::Position2D PZ::SceneNode PZ::SoundEmitter PZ::Sprite

Public Member Functions

virtual ~Component ()
 
virtual void Init ()
 Initializes the component.
 
virtual void Destroy ()
 Destroys the component.
 
virtual void Update (float deltaTime)
 Runs an update.
 
ApplicationGetApplication () const
 
EntityID GetOwnerID () const
 
MetaEntity GetOwnerEntity () const
 
EntityManagerGetManager () const
 
const TimestampGetTimestamp () const
 Gets the timestamp for when this component was last updated.
 
- Public Member Functions inherited from PZ::PropertyList
 PropertyList ()
 
virtual ~PropertyList ()
 
bool AddProperty (PropertyBase &prop)
 
bool RemoveProperty (const std::string &name)
 
void ClearProperties ()
 
bool HasProperty (const std::string &name) const
 
PropertyBaseGetProperty (const std::string &name)
 
const PropertyBaseGetProperty (const std::string &name) const
 
template<typename T >
Property< T > & GetProperty (const std::string &name)
 
template<typename T >
const Property< T > & GetProperty (const std::string &name) const
 
const PropertyMapGetAllProperties () const
 
- Public Member Functions inherited from PZ::EventHandler
 EventHandler ()
 
virtual ~EventHandler ()
 
bool SubscribeTo (EventHandler &handler)
 
bool UnsubscribeTo (EventHandler &handler)
 
template<class T , class EventT >
bool RegisterEvent (T *obj, void(T::*memFn)(EventT &))
 
template<class T , class EventT >
bool UnregisterEvent (T *obj, void(T::*memFn)(EventT &))
 
void HandleEvent (const Event &e)
 
void EmitEvent (const Event &e) const
 

Protected Member Functions

 Component ()
 Default constructor.
 
void UpdateTimestamp ()
 
virtual void PropertyUpdated (const PropertyBase &prop)
 
- Protected Member Functions inherited from PZ::NonCopyable
 NonCopyable ()
 

Friends

class EntityManager
 

Detailed Description

Small reusable block of behavior.

Constructor & Destructor Documentation

PZ::Component::Component ( )
inlineprotected

Default constructor.

Don't put any initialization logic inside the constructor (anything that will call GetManager() or GetOwnerID()). Use Init() instead.

virtual PZ::Component::~Component ( )
inlinevirtual

Member Function Documentation

virtual void PZ::Component::Destroy ( )
inlinevirtual

Destroys the component.

This is provided for consistency with Init(). It is okay to put destruction logic inside the destructor.

You should not call this method. It will be called by EntityManager.

Reimplemented in PZ::SceneNode.

Application& PZ::Component::GetApplication ( ) const
inline
EntityManager& PZ::Component::GetManager ( ) const
inline
MetaEntity PZ::Component::GetOwnerEntity ( ) const
inline
EntityID PZ::Component::GetOwnerID ( ) const
inline
const Timestamp& PZ::Component::GetTimestamp ( ) const
inline

Gets the timestamp for when this component was last updated.

This can be used to do an update only when the component has changed.

Returns
The timestamp.
virtual void PZ::Component::Init ( )
inlinevirtual

Initializes the component.

You should not call this method. It will be called by EntityManager.

Reimplemented in PZ::Position2D.

virtual void PZ::Component::PropertyUpdated ( const PropertyBase prop)
inlineprotectedvirtual

Reimplemented from PZ::PropertyList.

Reimplemented in PZ::Position2D.

virtual void PZ::Component::Update ( float  deltaTime)
inlinevirtual

Runs an update.

Parameters
deltaTimeTime since the last frame.
void PZ::Component::UpdateTimestamp ( )
inlineprotected

Friends And Related Function Documentation

friend class EntityManager
friend

The documentation for this class was generated from the following file: