2
0

BsScriptDebug.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. static void internal_logMessage(MonoString* message, UINT32 type);
  35. static void internal_clear();
  36. static void internal_clearType(UINT32 type);
  37. static MonoArray* internal_getMessages();
  38. typedef void(__stdcall *OnAddedThunkDef) (UINT32, MonoString*, MonoException**);
  39. static OnAddedThunkDef onAddedThunk;
  40. };
  41. }