BsScriptDebug.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 bs
  7. {
  8. /** @addtogroup ScriptInteropEngine
  9. * @{
  10. */
  11. /** Interop class between C++ & CLR for Debug. */
  12. class BS_SCR_BE_EXPORT ScriptDebug : public ScriptObject<ScriptDebug>
  13. {
  14. public:
  15. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Debug")
  16. /** Registers internal callbacks. Must be called on scripting system load. */
  17. static void startUp();
  18. /** Unregisters internal callbacks. Must be called on scripting system shutdown. */
  19. static void shutDown();
  20. private:
  21. ScriptDebug(MonoObject* instance);
  22. /** Triggered when a new entry is added to the debug log. */
  23. static void onLogEntryAdded(const LogEntry& entry);
  24. static HEvent mOnLogEntryAddedConn;
  25. /************************************************************************/
  26. /* CLR HOOKS */
  27. /************************************************************************/
  28. static void internal_log(MonoString* message);
  29. static void internal_logWarning(MonoString* message);
  30. static void internal_logError(MonoString* message);
  31. static void internal_logMessage(MonoString* message, UINT32 type);
  32. static void internal_clear();
  33. static void internal_clearType(UINT32 type);
  34. static MonoArray* internal_getMessages();
  35. typedef void(BS_THUNKCALL *OnAddedThunkDef) (UINT32, MonoString*, MonoException**);
  36. static OnAddedThunkDef onAddedThunk;
  37. };
  38. /** @} */
  39. }