BsScriptPlatformInfo.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. static MonoObject* internal_GetMainScene(ScriptPlatformInfoBase* thisPtr);
  44. static void internal_SetMainScene(ScriptPlatformInfoBase* thisPtr, ScriptPrefab* prefabPtr);
  45. static bool internal_GetFullscreen(ScriptPlatformInfoBase* thisPtr);
  46. static void internal_SetFullscreen(ScriptPlatformInfoBase* thisPtr, bool fullscreen);
  47. static void internal_GetResolution(ScriptPlatformInfoBase* thisPtr, UINT32* width, UINT32* height);
  48. static void internal_SetResolution(ScriptPlatformInfoBase* thisPtr, UINT32 width, UINT32 height);
  49. };
  50. /**
  51. * @brief Interop class between C++ & CLR for WinPlatformInfo.
  52. */
  53. class BS_SCR_BED_EXPORT ScriptWinPlatformInfo : public ScriptObject <ScriptWinPlatformInfo, ScriptPlatformInfoBase>
  54. {
  55. public:
  56. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "WinPlatformInfo")
  57. /**
  58. * @brief Creates a new managed platform info object that wraps the provided
  59. * native platform info.
  60. */
  61. static MonoObject* create(const SPtr<WinPlatformInfo>& platformInfo);
  62. private:
  63. ScriptWinPlatformInfo(MonoObject* instance);
  64. /**
  65. * @brief Returns the internal native Windows platform info object.
  66. */
  67. SPtr<WinPlatformInfo> getWinPlatformInfo() const;
  68. /************************************************************************/
  69. /* CLR HOOKS */
  70. /************************************************************************/
  71. static MonoObject* internal_GetIcon(ScriptWinPlatformInfo* thisPtr, int size);
  72. static void internal_SetIcon(ScriptWinPlatformInfo* thisPtr, int size, ScriptTexture2D* texturePtr);
  73. static MonoObject* internal_GetTaskbarIcon(ScriptWinPlatformInfo* thisPtr);
  74. static void internal_SetTaskbarIcon(ScriptWinPlatformInfo* thisPtr, ScriptTexture2D* texturePtr);
  75. static MonoString* internal_GetTitleText(ScriptWinPlatformInfo* thisPtr);
  76. static void internal_SetTitleText(ScriptWinPlatformInfo* thisPtr, MonoString* text);
  77. };
  78. }