BsScriptDebug.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "BsScriptEnginePrerequisites.h"
  3. #include "BsScriptObject.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Interop class between C++ & CLR for Debug.
  8. */
  9. class BS_SCR_BE_EXPORT ScriptDebug : public ScriptObject<ScriptDebug>
  10. {
  11. public:
  12. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Debug")
  13. /**
  14. * @brief Registers internal callbacks. Must be called on scripting system load.
  15. */
  16. static void startUp();
  17. /**
  18. * @brief Unregisters internal callbacks. Must be called on scripting system shutdown.
  19. */
  20. static void shutDown();
  21. private:
  22. ScriptDebug(MonoObject* instance);
  23. /**
  24. * @brief Triggered when a new entry is added to the debug log.
  25. */
  26. static void onLogEntryAdded(const LogEntry& entry);
  27. static HEvent mOnLogEntryAddedConn;
  28. /************************************************************************/
  29. /* CLR HOOKS */
  30. /************************************************************************/
  31. static void internal_log(MonoString* message);
  32. static void internal_logWarning(MonoString* message);
  33. static void internal_logError(MonoString* message);
  34. typedef void(__stdcall *OnAddedThunkDef) (UINT32, MonoString*, MonoException**);
  35. static OnAddedThunkDef onAddedThunk;
  36. };
  37. }