Hymn to Beauty
C++ 3D Engine
Component::Script Class Reference

Component controlled by a script. More...

#include <Script.hpp>

Inheritance diagram for Component::Script:
Component::SuperComponent

Public Member Functions

 Script ()
 Create new script. More...
 
 ~Script () final
 Destructor. More...
 
void Serialize (Json::Value &node, bool load) override
 Save or load component values to/from JSON. More...
 
void AddToPropertyMap (const std::string &name, int type, int size, void *data)
 Add a property to the propertyMap. More...
 
void CopyDataFromPropertyMap (const std::string &name, void *target)
 Copy the data from a property in the map. More...
 
void * GetDataFromPropertyMap (const std::string &name)
 Get the pointer to the data of a property in the map. More...
 
bool IsInPropertyMap (const std::string &name, const int type)
 Is the property in the map? More...
 
void ClearPropertyMap ()
 Clears the property map. More...
 
- Public Member Functions inherited from Component::SuperComponent
 SuperComponent ()
 Create new SuperComponent. More...
 
virtual ~SuperComponent ()
 Destructor. More...
 
void Kill ()
 Kill the component, will be removed at the end of the frame. More...
 
bool IsKilled () const
 Get whether component has been killed. More...
 

Public Attributes

bool initialized = false
 Whether the script component has been initialized. More...
 
ScriptFilescriptFile = nullptr
 The script file. More...
 
asIScriptObject * instance = nullptr
 The instance of the script class. More...
 
- Public Attributes inherited from Component::SuperComponent
Entityentity = nullptr
 Pointer to which entity this component corresponds. More...
 

Detailed Description

Component controlled by a script.

Constructor & Destructor Documentation

◆ Script()

Script::Script ( )

Create new script.

◆ ~Script()

Script::~Script ( )
final

Destructor.

Member Function Documentation

◆ AddToPropertyMap()

void Script::AddToPropertyMap ( const std::string &  name,
int  type,
int  size,
void *  data 
)

Add a property to the propertyMap.

Parameters
nameThe name of the property.
typeThe asTypeID of the property.
sizeThe size in number of bytes of the property.
dataA pointer to the data to store.

◆ ClearPropertyMap()

void Script::ClearPropertyMap ( )

Clears the property map.

◆ CopyDataFromPropertyMap()

void Script::CopyDataFromPropertyMap ( const std::string &  name,
void *  target 
)

Copy the data from a property in the map.

Parameters
nameThe name of the property.
targetA pointer that points where to copy the data.

◆ GetDataFromPropertyMap()

void * Script::GetDataFromPropertyMap ( const std::string &  name)

Get the pointer to the data of a property in the map.

Parameters
nameThe name of the property.
Returns
A pointer to the data of the property.

◆ IsInPropertyMap()

bool Script::IsInPropertyMap ( const std::string &  name,
const int  type 
)

Is the property in the map?

Parameters
nameThe name of the property.
typeThe asTypeID of the property.
Returns
Is there a property with the provided name and type in propertyMap.

◆ Serialize()

void Script::Serialize ( Json::Value &  node,
bool  load 
)
overridevirtual

Save or load component values to/from JSON.

Parameters
nodeThe JSON node to save to or load from.
loadWhether to load (otherwise saves).

Implements Component::SuperComponent.

Member Data Documentation

◆ initialized

bool Component::Script::initialized = false

Whether the script component has been initialized.

◆ instance

asIScriptObject* Component::Script::instance = nullptr

The instance of the script class.

◆ scriptFile

ScriptFile* Component::Script::scriptFile = nullptr

The script file.


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