My Project
Loading...
Searching...
No Matches
ScriptManager Class Reference

Manages user scripts, including creation, deletion, initialization, starting, and updating. More...

#include <ScriptManager.hpp>

Public Member Functions

 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.

Detailed Description

Manages user scripts, including creation, deletion, initialization, starting, and updating.

To properly update and manage scripts:

  1. Register scripts with Initialize()
  2. Call StartAll() to invoke OnStart() on all scripts
  3. Call updateScripts() each frame to invoke Update(deltaTime) on all scripts

Constructor & Destructor Documentation

◆ ScriptManager()

ScriptManager::ScriptManager ( )
inline

Default constructor.

◆ ~ScriptManager()

ScriptManager::~ScriptManager ( )
inline

Destructor.

Member Function Documentation

◆ 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
scriptNameThe name of the script to create
projectNameThe 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
projectPathThe path of the project containing the script
scriptNameThe 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
deltatimeThe delta time since the last update (in seconds)

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