BsScriptResourceRef.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include "BsScriptEnginePrerequisites.h"
  3. #include "BsScriptObject.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Interop class between C++ & CLR for ResourceRef.
  8. */
  9. class BS_SCR_BE_EXPORT ScriptResourceRef : public ScriptObject<ScriptResourceRef>
  10. {
  11. public:
  12. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ResourceRef`1")
  13. /**
  14. * @brief Creates a new managed ResourceRef for the provided resource type.
  15. *
  16. * @param typeId RTTI type ID of the resource to reference.
  17. */
  18. static MonoObject* create(UINT32 typeId);
  19. private:
  20. ScriptResourceRef(MonoObject* instance, const WeakResourceHandle<Resource>& resource);
  21. WeakResourceHandle<Resource> mResource;
  22. /************************************************************************/
  23. /* CLR HOOKS */
  24. /************************************************************************/
  25. static bool internal_IsLoaded(ScriptResourceRef* nativeInstance);
  26. static MonoObject* internal_GetResource(ScriptResourceRef* nativeInstance);
  27. };
  28. }