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