BsScriptDebug.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEnginePrerequisites.h"
  5. #include "BsScriptObject.h"
  6. namespace BansheeEngine
  7. {
  8. /**
  9. * @brief Interop class between C++ & CLR for Debug.
  10. */
  11. class BS_SCR_BE_EXPORT ScriptDebug : public ScriptObject<ScriptDebug>
  12. {
  13. public:
  14. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Debug")
  15. /**
  16. * @brief Registers internal callbacks. Must be called on scripting system load.
  17. */
  18. static void startUp();
  19. /**
  20. * @brief Unregisters internal callbacks. Must be called on scripting system shutdown.
  21. */
  22. static void shutDown();
  23. private:
  24. ScriptDebug(MonoObject* instance);
  25. /**
  26. * @brief Triggered when a new entry is added to the debug log.
  27. */
  28. static void onLogEntryAdded(const LogEntry& entry);
  29. static HEvent mOnLogEntryAddedConn;
  30. /************************************************************************/
  31. /* CLR HOOKS */
  32. /************************************************************************/
  33. static void internal_log(MonoString* message);
  34. static void internal_logWarning(MonoString* message);
  35. static void internal_logError(MonoString* message);
  36. static void internal_logMessage(MonoString* message, UINT32 type);
  37. static void internal_clear();
  38. static void internal_clearType(UINT32 type);
  39. static MonoArray* internal_getMessages();
  40. typedef void(__stdcall *OnAddedThunkDef) (UINT32, MonoString*, MonoException**);
  41. static OnAddedThunkDef onAddedThunk;
  42. };
  43. }