Manages user scripts, including creation, deletion, initialization, starting, and updating.
More...
#include <ScriptManager.hpp>
|
| | ScriptManager () |
| | Default constructor.
|
| | ~ScriptManager () |
| | Destructor.
|
| void | createScript (std::string scriptName, std::string projectName) |
| | Creates a new script with the given name, generating the required header and cpp files.
|
| void | DeleteScript (const std::string &projectPath, const std::string &scriptName) |
| | Deletes a script by name, optionally removing the corresponding .cpp and .hpp files.
|
| void | Restart () |
| | Restarts all scripts, typically by reinitializing or clearing existing state.
|
| void | StartAll () |
| | Calls OnStart() on all registered scripts.
|
| void | Initialize () |
| | Initializes the ScriptManager by creating instances of all registered scripts.
|
| void | updateScripts (float deltatime) |
| | Updates all scripts by calling Update(deltaTime) on each.
|
| std::vector< std::unique_ptr< UserScript > > & | GetScripts () |
| | Returns a reference to the vector of scripts.
|
Manages user scripts, including creation, deletion, initialization, starting, and updating.
To properly update and manage scripts:
- Register scripts with Initialize()
- Call StartAll() to invoke OnStart() on all scripts
- Call updateScripts() each frame to invoke Update(deltaTime) on all scripts
◆ ScriptManager()
| ScriptManager::ScriptManager |
( |
| ) |
|
|
inline |
◆ ~ScriptManager()
| ScriptManager::~ScriptManager |
( |
| ) |
|
|
inline |
◆ createScript()
| void ScriptManager::createScript |
( |
std::string | scriptName, |
|
|
std::string | projectName ) |
Creates a new script with the given name, generating the required header and cpp files.
- Parameters
-
| scriptName | The name of the script to create |
| projectName | The name of the project in which to create the script |
◆ DeleteScript()
| void ScriptManager::DeleteScript |
( |
const std::string & | projectPath, |
|
|
const std::string & | scriptName ) |
Deletes a script by name, optionally removing the corresponding .cpp and .hpp files.
- Parameters
-
| projectPath | The path of the project containing the script |
| scriptName | The name of the script to delete |
◆ GetScripts()
| std::vector< std::unique_ptr< UserScript > > & ScriptManager::GetScripts |
( |
| ) |
|
|
inline |
Returns a reference to the vector of scripts.
- Returns
- Reference to the internal vector of unique_ptr<UserScript>
◆ Initialize()
| void ScriptManager::Initialize |
( |
| ) |
|
Initializes the ScriptManager by creating instances of all registered scripts.
◆ Restart()
| void ScriptManager::Restart |
( |
| ) |
|
Restarts all scripts, typically by reinitializing or clearing existing state.
◆ StartAll()
| void ScriptManager::StartAll |
( |
| ) |
|
Calls OnStart() on all registered scripts.
◆ updateScripts()
| void ScriptManager::updateScripts |
( |
float | deltatime | ) |
|
Updates all scripts by calling Update(deltaTime) on each.
- Parameters
-
| deltatime | The delta time since the last update (in seconds) |
The documentation for this class was generated from the following file: