Add Scripting events to C++ api similar to C# ones
This commit is contained in:
@@ -156,6 +156,12 @@ Action Scripting::ScriptsLoaded;
|
|||||||
Action Scripting::ScriptsUnload;
|
Action Scripting::ScriptsUnload;
|
||||||
Action Scripting::ScriptsReloading;
|
Action Scripting::ScriptsReloading;
|
||||||
Action Scripting::ScriptsReloaded;
|
Action Scripting::ScriptsReloaded;
|
||||||
|
Action Scripting::Update;
|
||||||
|
Action Scripting::LateUpdate;
|
||||||
|
Action Scripting::FixedUpdate;
|
||||||
|
Action Scripting::LateFixedUpdate;
|
||||||
|
Action Scripting::Draw;
|
||||||
|
Action Scripting::Exit;
|
||||||
ThreadLocal<Scripting::IdsMappingTable*, PLATFORM_THREADS_LIMIT> Scripting::ObjectsLookupIdMapping;
|
ThreadLocal<Scripting::IdsMappingTable*, PLATFORM_THREADS_LIMIT> Scripting::ObjectsLookupIdMapping;
|
||||||
ScriptingService ScriptingServiceInstance;
|
ScriptingService ScriptingServiceInstance;
|
||||||
|
|
||||||
@@ -205,9 +211,9 @@ bool ScriptingService::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if COMPILE_WITHOUT_CSHARP
|
#if COMPILE_WITHOUT_CSHARP
|
||||||
#define INVOKE_EVENT(name)
|
#define INVOKE_EVENT(name) Scripting::name();
|
||||||
#else
|
#else
|
||||||
#define INVOKE_EVENT(name) \
|
#define INVOKE_EVENT(name) Scripting::name(); \
|
||||||
if (!_isEngineAssemblyLoaded) return; \
|
if (!_isEngineAssemblyLoaded) return; \
|
||||||
if (_method_##name == nullptr) \
|
if (_method_##name == nullptr) \
|
||||||
{ \
|
{ \
|
||||||
|
|||||||
@@ -44,6 +44,36 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
static Delegate<> ScriptsReloaded;
|
static Delegate<> ScriptsReloaded;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs on scripting update.
|
||||||
|
/// </summary>
|
||||||
|
static Delegate<> Update;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs on scripting late update.
|
||||||
|
/// </summary>
|
||||||
|
static Delegate<> LateUpdate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs on scripting fixed update.
|
||||||
|
/// </summary>
|
||||||
|
static Delegate<> FixedUpdate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs on scripting late fixed update.
|
||||||
|
/// </summary>
|
||||||
|
static Delegate<> LateFixedUpdate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs on scripting draw update. Called during frame rendering and can be used to invoke custom rendering with GPUDevice.
|
||||||
|
/// </summary>
|
||||||
|
static Delegate<> Draw;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when scripting engine is disposing. Engine is during closing and some services may be unavailable (eg. loading scenes). This may be called after the engine fatal error event.
|
||||||
|
/// </summary>
|
||||||
|
static Delegate<> Exit;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user