BsScriptGameObject.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #include "BsScriptEnginePrerequisites.h"
  3. #include "BsScriptObject.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Base class for all GameObject interop classes.
  8. */
  9. class BS_SCR_BE_EXPORT ScriptGameObjectBase : public PersistentScriptObjectBase
  10. {
  11. public:
  12. ScriptGameObjectBase(MonoObject* instance);
  13. virtual ~ScriptGameObjectBase() { }
  14. /**
  15. * @brief Returns the internal native GameObject handle.
  16. */
  17. virtual HGameObject getNativeHandle() const = 0;
  18. /**
  19. * @brief Sets the internal native GameObject handle.
  20. */
  21. virtual void setNativeHandle(const HGameObject& gameObject) = 0;
  22. /**
  23. * @copydoc ScriptObjectBase::beginRefresh
  24. */
  25. virtual ScriptObjectBackup beginRefresh() override;
  26. /**
  27. * @copydoc ScriptObjectBase::endRefresh
  28. */
  29. virtual void endRefresh(const ScriptObjectBackup& backupData) override;
  30. protected:
  31. bool mRefreshInProgress;
  32. };
  33. /**
  34. * @brief Interop class between C++ & CLR for GameObject.
  35. */
  36. class BS_SCR_BE_EXPORT ScriptGameObject : public ScriptObject<ScriptGameObject, ScriptGameObjectBase>
  37. {
  38. public:
  39. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GameObject")
  40. private:
  41. ScriptGameObject(MonoObject* instance);
  42. /************************************************************************/
  43. /* CLR HOOKS */
  44. /************************************************************************/
  45. static UINT64 internal_getInstanceId(ScriptGameObject* nativeInstance);
  46. };
  47. }