BsScriptPlatformInfo.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEditorPrerequisites.h"
  5. #include "BsScriptObject.h"
  6. #include "BsPlatformInfo.h"
  7. namespace BansheeEngine
  8. {
  9. /**
  10. * @brief Base class for all C++/CLR interop objects dealing with specific
  11. * PlatformInfo implementations.
  12. */
  13. class BS_SCR_BED_EXPORT ScriptPlatformInfoBase : public ScriptObjectBase
  14. {
  15. public:
  16. /**
  17. * @brief Returns the internal native platform info object.
  18. */
  19. SPtr<PlatformInfo> getPlatformInfo() const { return mPlatformInfo; }
  20. protected:
  21. ScriptPlatformInfoBase(MonoObject* instance);
  22. virtual ~ScriptPlatformInfoBase() {}
  23. SPtr<PlatformInfo> mPlatformInfo;
  24. };
  25. /**
  26. * @brief Interop class between C++ & CLR for PlatformInfo.
  27. */
  28. class BS_SCR_BED_EXPORT ScriptPlatformInfo : public ScriptObject <ScriptPlatformInfo, ScriptPlatformInfoBase>
  29. {
  30. public:
  31. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "PlatformInfo")
  32. /**
  33. * @brief Creates a new managed platform info object that wraps the provided
  34. * native platform info.
  35. */
  36. static MonoObject* create(const SPtr<PlatformInfo>& platformInfo);
  37. private:
  38. ScriptPlatformInfo(MonoObject* instance);
  39. /************************************************************************/
  40. /* CLR HOOKS */
  41. /************************************************************************/
  42. static PlatformType internal_GetType(ScriptPlatformInfoBase* thisPtr);
  43. static MonoString* internal_GetDefines(ScriptPlatformInfoBase* thisPtr);
  44. static void internal_SetDefines(ScriptPlatformInfoBase* thisPtr, MonoString* value);
  45. static MonoObject* internal_GetMainScene(ScriptPlatformInfoBase* thisPtr);
  46. static void internal_SetMainScene(ScriptPlatformInfoBase* thisPtr, ScriptResourceRef* prefabRef);
  47. static bool internal_GetFullscreen(ScriptPlatformInfoBase* thisPtr);
  48. static void internal_SetFullscreen(ScriptPlatformInfoBase* thisPtr, bool fullscreen);
  49. static void internal_GetResolution(ScriptPlatformInfoBase* thisPtr, UINT32* width, UINT32* height);
  50. static void internal_SetResolution(ScriptPlatformInfoBase* thisPtr, UINT32 width, UINT32 height);
  51. static bool internal_GetDebug(ScriptPlatformInfoBase* thisPtr);
  52. static void internal_SetDebug(ScriptPlatformInfoBase* thisPtr, bool debug);
  53. };
  54. /**
  55. * @brief Interop class between C++ & CLR for WinPlatformInfo.
  56. */
  57. class BS_SCR_BED_EXPORT ScriptWinPlatformInfo : public ScriptObject <ScriptWinPlatformInfo, ScriptPlatformInfoBase>
  58. {
  59. public:
  60. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "WinPlatformInfo")
  61. /**
  62. * @brief Creates a new managed platform info object that wraps the provided
  63. * native platform info.
  64. */
  65. static MonoObject* create(const SPtr<WinPlatformInfo>& platformInfo);
  66. private:
  67. ScriptWinPlatformInfo(MonoObject* instance);
  68. /**
  69. * @brief Returns the internal native Windows platform info object.
  70. */
  71. SPtr<WinPlatformInfo> getWinPlatformInfo() const;
  72. /************************************************************************/
  73. /* CLR HOOKS */
  74. /************************************************************************/
  75. static MonoObject* internal_GetIcon(ScriptWinPlatformInfo* thisPtr);
  76. static void internal_SetIcon(ScriptWinPlatformInfo* thisPtr, ScriptResourceRef* textureRef);
  77. static MonoString* internal_GetTitleText(ScriptWinPlatformInfo* thisPtr);
  78. static void internal_SetTitleText(ScriptWinPlatformInfo* thisPtr, MonoString* text);
  79. };
  80. }