Manages the AngelScript engine, a registry of script assets, and the live per-object script module instances.
More...
|
| | kScriptManager () |
| | Creates and initialises the AngelScript engine and shared context.
|
| virtual | ~kScriptManager () |
| | Destroys all instances and shuts down the engine (see destroy()).
|
| asIScriptEngine * | getEngine () |
| | Returns the underlying AngelScript engine (for binding setup).
|
| void | registerScriptAsset (const kString &uuid, const kString &sourcePath, kScriptSourceType type=K_SCRIPT_TEXT, const kString &bytecodePath="") |
| | Registers (or updates) a script asset.
|
| kScriptAsset * | getScriptAsset (const kString &uuid) |
| | Returns the asset for uuid, or nullptr if unregistered.
|
| void | unregisterScriptAsset (const kString &uuid) |
| | Removes a script asset from the registry.
|
| void | setBytecodePath (const kString &uuid, const kString &bytecodePath) |
| | Records the bytecode path for an already-registered asset.
|
| bool | compileToBytecode (const kString &scriptUuid, const kString &outPath, bool stripDebug=false) |
| | Compiles a registered asset's source to AngelScript bytecode.
|
| bool | compileFileToBytecode (const kString &sourcePath, const kString &outPath, bool stripDebug=false) |
| | Compiles a source file to bytecode without touching the registry.
|
| kScriptInstance * | createInstance (const kString &componentUuid, const kString &scriptUuid) |
| | Builds a private module instance for one object's script slot.
|
| kScriptInstance * | getInstance (const kString &componentUuid) |
| | Returns the instance for componentUuid, or nullptr.
|
| void | destroyInstance (const kString &componentUuid) |
| | Destroys one instance and discards its module.
|
| void | destroyAllInstances () |
| | Destroys every live instance (e.g. when Play stops).
|
| void | setActiveObject (kObject *obj) |
| | Sets the object scripts see as their owner during dispatch.
|
| kObject * | getActiveObject () const |
| | Returns the object set by setActiveObject().
|
| void | setDeltaTime (float dt) |
| | Sets the frame delta time exposed to scripts via host bindings.
|
| float | getDeltaTime () const |
| | Returns the current frame delta time.
|
| void | setFixedDeltaTime (float dt) |
| | Sets the fixed (physics) delta time exposed to scripts.
|
| float | getFixedDeltaTime () const |
| | Returns the current fixed delta time.
|
| bool | callEvent (kScriptInstance *inst, kScriptEvent evt) |
| | Invokes one lifecycle function on an instance, if it defines it.
|
| void | registerGlobalFunction (const kString &declaration, asSFuncPtr func) |
| | Registers a native C function callable from every script.
|
| void | destroy () |
| | Shuts down the engine and releases all resources.
|
Manages the AngelScript engine, a registry of script assets, and the live per-object script module instances.
Typical engine-side flow:
bool callEvent(kScriptInstance *inst, kScriptEvent evt)
Invokes one lifecycle function on an instance, if it defines it.
bool compileToBytecode(const kString &scriptUuid, const kString &outPath, bool stripDebug=false)
Compiles a registered asset's source to AngelScript bytecode.
void setActiveObject(kObject *obj)
Sets the object scripts see as their owner during dispatch.
Definition kscriptmanager.h:264
kScriptInstance * createInstance(const kString &componentUuid, const kString &scriptUuid)
Builds a private module instance for one object's script slot.
void registerScriptAsset(const kString &uuid, const kString &sourcePath, kScriptSourceType type=K_SCRIPT_TEXT, const kString &bytecodePath="")
Registers (or updates) a script asset.
kScriptManager()
Creates and initialises the AngelScript engine and shared context.
@ K_SCRIPT_START
void Start() — once, on the first frame.
Definition kscriptmanager.h:58
A live, per-object compiled script module.
Definition kscriptmanager.h:107