xyginext  0.2.0
Second generation of xygine game creation framework
Protected Member Functions | Friends | List of all members
xy::Director Class Referenceabstract

Abstract Base Class for Directors. A director is an 'observer' of the scene to which it belongs, and has the ability to command, or direct entities within it. While Directors do not exist within the world, they can receive both external events, such as player input, and system messages emitted from the scene. Based on this input the Director can then use a CommandSystem (one of which is automatically added to the scene when a Director is first added, if it does not exist) to send commands to entities within the scene. For example a Director may take player input, process it then send movement commands to a player entity. It may also be used to implement gameplay rules by using the events it has observed to decide when new enemies should be spawned, where a player should restart and so on. More...

#include <Director.hpp>

Protected Member Functions

virtual void handleMessage (const Message &)=0
 Implement to handle system messages.
 
virtual void handleEvent (const sf::Event &)
 Implement to handle Events.
 
virtual void process (float)
 Implement to process time based data.
 
template<typename T >
T * postMessage (Message::ID id)
 
void sendCommand (const Command &)
 Sends a Command to the Scene. More...
 
ScenegetScene ()
 Returns a reference to this Director's parent Scene.
 

Friends

class Scene
 

Detailed Description

Abstract Base Class for Directors. A director is an 'observer' of the scene to which it belongs, and has the ability to command, or direct entities within it. While Directors do not exist within the world, they can receive both external events, such as player input, and system messages emitted from the scene. Based on this input the Director can then use a CommandSystem (one of which is automatically added to the scene when a Director is first added, if it does not exist) to send commands to entities within the scene. For example a Director may take player input, process it then send movement commands to a player entity. It may also be used to implement gameplay rules by using the events it has observed to decide when new enemies should be spawned, where a player should restart and so on.

Member Function Documentation

◆ sendCommand()

void xy::Director::sendCommand ( const Command )
protected

Sends a Command to the Scene.

See also
CommandSystem