BsScriptGameObject.h 1.7 KB

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