Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ShimUnityWaveWorks.cpp : Defines the exported functions for the DLL application.
- //
- #include "ShimUnityWaveWorks.h"
- #include "stdafx.h"
- #include "IUnityInterface.h"
- #include "IUnityGraphics.h"
- #include <stdio.h>
- #include <windows.h>
- #include <iostream>
- extern "C" {
- static IUnityInterfaces* s_UnityInterfaces = NULL;
- static IUnityGraphics* s_Graphics = NULL;
- static UnityGfxRenderer s_RendererType = kUnityGfxRendererNull;
- // Unity plugin load event
- extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
- UnityPluginLoad(IUnityInterfaces* unityInterfaces)
- {
- s_UnityInterfaces = unityInterfaces;
- s_Graphics = unityInterfaces->Get<IUnityGraphics>();
- //s_Graphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent);
- // Run OnGraphicsDeviceEvent(initialize) manually on plugin load
- // to not miss the event in case the graphics device is already initialized
- //OnGraphicsDeviceEvent(kUnityGfxDeviceEventInitialize);
- logMessage("Load");
- }
- int Test(int t)
- {
- return t;
- }
- // Unity plugin unload event
- extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
- UnityPluginUnload()
- {
- //s_Graphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent);
- logMessage("UnLoad");
- }
- void logMessage(const char* s)
- {
- const char* path = "D:\\Shim_Unity_WaveWorks.txt";
- FILE *f;
- fopen_s(&f, path, "at");
- if (!f) fopen_s(&f, path, "wt");
- fprintf(f, "Log: %s\n", s);
- fclose(f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement