register callbacks.
This commit is contained in:
Binary file not shown.
@@ -36,25 +36,47 @@ extern "C"
|
|||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API FinalizeUDD()
|
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API FinalizeUDD()
|
||||||
{
|
{
|
||||||
if (g_manager)
|
if (!g_manager) return;
|
||||||
{
|
|
||||||
g_manager.reset();
|
|
||||||
|
|
||||||
std::queue<Message> empty;
|
g_manager.reset();
|
||||||
g_messages.swap(empty);
|
|
||||||
|
|
||||||
Debug::Finalize();
|
std::queue<Message> empty;
|
||||||
}
|
g_messages.swap(empty);
|
||||||
|
|
||||||
|
Debug::Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType event)
|
||||||
|
{
|
||||||
|
switch (event)
|
||||||
|
{
|
||||||
|
case kUnityGfxDeviceEventInitialize:
|
||||||
|
{
|
||||||
|
InitializeUDD();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnityGfxDeviceEventShutdown:
|
||||||
|
{
|
||||||
|
FinalizeUDD();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces)
|
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces)
|
||||||
{
|
{
|
||||||
g_unity = unityInterfaces;
|
g_unity = unityInterfaces;
|
||||||
InitializeUDD();
|
InitializeUDD();
|
||||||
|
|
||||||
|
auto unityGraphics = g_unity->Get<IUnityGraphics>();
|
||||||
|
unityGraphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UnityPluginUnload()
|
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UnityPluginUnload()
|
||||||
{
|
{
|
||||||
|
auto unityGraphics = g_unity->Get<IUnityGraphics>();
|
||||||
|
unityGraphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent);
|
||||||
|
|
||||||
FinalizeUDD();
|
FinalizeUDD();
|
||||||
g_unity = nullptr;
|
g_unity = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user