Hymn to Beauty
C++ 3D Engine
ScriptManager Class Reference

Handles scripting. More...

#include <ScriptManager.hpp>

Public Member Functions

int BuildScript (ScriptFile *script)
 Build a script that can later be run. More...
 
void BuildAllScripts ()
 Build all scripts in the hymn. More...
 
void FillPropertyMap (Component::Script *script)
 Fetches the properties from the script and fills the map. More...
 
void FillFunctionVector (ScriptFile *scriptFile)
 Fetches the functions from the script and fills the scriptfiles vector. More...
 
void Update (World &world, float deltaTime)
 Update all script entities in the game world. More...
 
void RegisterUpdate (Entity *entity)
 Register an entity to recieve update callbacks. More...
 
void RegisterInput ()
 Register the input enum. More...
 
void SendMessage (Entity *recipient, Entity *sender, int type)
 Send a message to an entity. More...
 
Component::ScriptCreateScript ()
 Create script component. More...
 
int GetStringDeclarationID ()
 Used to get the string identifier used to check if a property is a string. More...
 
const std::vector< Component::Script * > & GetScripts () const
 Get all script components. More...
 
void ClearKilledComponents ()
 Remove all killed components. More...
 
void ExecuteScriptMethod (const Entity *entity, const std::string &method)
 Execute a method on a script. More...
 
const std::vector< Entity * > & GetUpdateEntities ()
 

Public Attributes

EntitycurrentEntity
 The entity currently being executed. More...
 

Friends

class Hub
 

Detailed Description

Handles scripting.

Member Function Documentation

◆ BuildAllScripts()

void ScriptManager::BuildAllScripts ( )

Build all scripts in the hymn.

◆ BuildScript()

int ScriptManager::BuildScript ( ScriptFile script)

Build a script that can later be run.

Parameters
scriptScript to build.
Returns
The result, < 0 means it failed.

◆ ClearKilledComponents()

void ScriptManager::ClearKilledComponents ( )

Remove all killed components.

◆ CreateScript()

Component::Script * ScriptManager::CreateScript ( )

Create script component.

Returns
The created component.

◆ ExecuteScriptMethod()

void ScriptManager::ExecuteScriptMethod ( const Entity entity,
const std::string &  method 
)

Execute a method on a script.

Parameters
entityTarget entity whose script will be run.
methodMethod to call.

◆ FillFunctionVector()

void ScriptManager::FillFunctionVector ( ScriptFile scriptFile)

Fetches the functions from the script and fills the scriptfiles vector.

Parameters
scriptFileThe scriptfile which vector to update.

◆ FillPropertyMap()

void ScriptManager::FillPropertyMap ( Component::Script script)

Fetches the properties from the script and fills the map.

Parameters
scriptThe script which map to update.

◆ GetScripts()

const std::vector< Component::Script * > & ScriptManager::GetScripts ( ) const

Get all script components.

Returns
All script components.

◆ GetStringDeclarationID()

int ScriptManager::GetStringDeclarationID ( )

Used to get the string identifier used to check if a property is a string.

Returns
The identifier of the string declaration.

◆ GetUpdateEntities()

const std::vector< Entity * > & ScriptManager::GetUpdateEntities ( )

Get the set of entities with a script component that accepts update events.

Returns
Entities with script updates.

◆ RegisterInput()

void ScriptManager::RegisterInput ( )

Register the input enum.

◆ RegisterUpdate()

void ScriptManager::RegisterUpdate ( Entity entity)

Register an entity to recieve update callbacks.

Parameters
entityEntity to register.
Todo:
Fix so registered entities can be removed.

◆ SendMessage()

void ScriptManager::SendMessage ( Entity recipient,
Entity sender,
int  type 
)

Send a message to an entity.

Parameters
recipientThe entity to receive the message.
senderThe entity that sent the message.
typeThe type of message to send.

◆ Update()

void ScriptManager::Update ( World world,
float  deltaTime 
)

Update all script entities in the game world.

Parameters
worldThe world to update.
deltaTimeTime since last frame (in seconds).

Friends And Related Function Documentation

◆ Hub

friend class Hub
friend

Member Data Documentation

◆ currentEntity

Entity* ScriptManager::currentEntity

The entity currently being executed.


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