BsScriptPlatformInfo.h 3.5 KB

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