BsScriptPlatformInfo.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. #include "BsScriptEditorPrerequisites.h"
  3. #include "BsScriptObject.h"
  4. #include "BsPlatformInfo.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Base class for all C++/CLR interop objects dealing with specific
  9. * PlatformInfo implementations.
  10. */
  11. class BS_SCR_BED_EXPORT ScriptPlatformInfoBase : public ScriptObjectBase
  12. {
  13. public:
  14. /**
  15. * @brief Returns the internal native platform info object.
  16. */
  17. SPtr<PlatformInfo> getPlatformInfo() const { return mPlatformInfo; }
  18. protected:
  19. ScriptPlatformInfoBase(MonoObject* instance);
  20. virtual ~ScriptPlatformInfoBase() {}
  21. SPtr<PlatformInfo> mPlatformInfo;
  22. };
  23. /**
  24. * @brief Interop class between C++ & CLR for PlatformInfo.
  25. */
  26. class BS_SCR_BED_EXPORT ScriptPlatformInfo : public ScriptObject <ScriptPlatformInfo, ScriptPlatformInfoBase>
  27. {
  28. public:
  29. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "PlatformInfo")
  30. /**
  31. * @brief Creates a new managed platform info object that wraps the provided
  32. * native platform info.
  33. */
  34. static MonoObject* create(const SPtr<PlatformInfo>& platformInfo);
  35. private:
  36. ScriptPlatformInfo(MonoObject* instance);
  37. /************************************************************************/
  38. /* CLR HOOKS */
  39. /************************************************************************/
  40. static PlatformType internal_GetType(ScriptPlatformInfoBase* thisPtr);
  41. static MonoString* internal_GetDefines(ScriptPlatformInfoBase* thisPtr);
  42. static void internal_SetDefines(ScriptPlatformInfoBase* thisPtr, MonoString* value);
  43. };
  44. /**
  45. * @brief Interop class between C++ & CLR for WinPlatformInfo.
  46. */
  47. class BS_SCR_BED_EXPORT ScriptWinPlatformInfo : public ScriptObject <ScriptWinPlatformInfo, ScriptPlatformInfoBase>
  48. {
  49. public:
  50. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "WinPlatformInfo")
  51. /**
  52. * @brief Creates a new managed platform info object that wraps the provided
  53. * native platform info.
  54. */
  55. static MonoObject* create(const SPtr<WinPlatformInfo>& platformInfo);
  56. private:
  57. ScriptWinPlatformInfo(MonoObject* instance);
  58. /**
  59. * @brief Returns the internal native Windows platform info object.
  60. */
  61. SPtr<WinPlatformInfo> getWinPlatformInfo() const;
  62. /************************************************************************/
  63. /* CLR HOOKS */
  64. /************************************************************************/
  65. static bool internal_GetIs32Bit(ScriptWinPlatformInfo* thisPtr);
  66. static void internal_SetIs32Bit(ScriptWinPlatformInfo* thisPtr, bool value);
  67. static MonoObject* internal_GetIcon(ScriptWinPlatformInfo* thisPtr, int size);
  68. static void Internal_SetIcon(ScriptWinPlatformInfo* thisPtr, int size, ScriptTexture2D* texturePtr);
  69. };
  70. }