Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. // ShimUnityWaveWorks.cpp : Defines the exported functions for the DLL application.
  2. //
  3.  
  4. #include "ShimUnityWaveWorks.h"
  5. #include "stdafx.h"
  6. #include "IUnityInterface.h"
  7. #include "IUnityGraphics.h"
  8. #include <stdio.h>
  9. #include <windows.h>
  10. #include <iostream>
  11.  
  12. extern "C" {
  13. static IUnityInterfaces* s_UnityInterfaces = NULL;
  14. static IUnityGraphics* s_Graphics = NULL;
  15. static UnityGfxRenderer s_RendererType = kUnityGfxRendererNull;
  16.  
  17. // Unity plugin load event
  18. extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
  19. UnityPluginLoad(IUnityInterfaces* unityInterfaces)
  20. {
  21. s_UnityInterfaces = unityInterfaces;
  22. s_Graphics = unityInterfaces->Get<IUnityGraphics>();
  23.  
  24. //s_Graphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent);
  25.  
  26. // Run OnGraphicsDeviceEvent(initialize) manually on plugin load
  27. // to not miss the event in case the graphics device is already initialized
  28. //OnGraphicsDeviceEvent(kUnityGfxDeviceEventInitialize);
  29.  
  30. logMessage("Load");
  31. }
  32.  
  33.  
  34. int Test(int t)
  35. {
  36. return t;
  37. }
  38.  
  39. // Unity plugin unload event
  40. extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
  41. UnityPluginUnload()
  42. {
  43. //s_Graphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent);
  44. logMessage("UnLoad");
  45. }
  46.  
  47.  
  48. void logMessage(const char* s)
  49. {
  50. const char* path = "D:\\Shim_Unity_WaveWorks.txt";
  51. FILE *f;
  52. fopen_s(&f, path, "at");
  53. if (!f) fopen_s(&f, path, "wt");
  54. fprintf(f, "Log: %s\n", s);
  55. fclose(f);
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement