BsScriptPlatformInfo.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 "Build/BsPlatformInfo.h"
  7. namespace bs
  8. {
  9. /** @addtogroup ScriptInteropEditor
  10. * @{
  11. */
  12. /** Base class for all C++/CLR interop objects dealing with specific PlatformInfo implementations. */
  13. class BS_SCR_BED_EXPORT ScriptPlatformInfoBase : public ScriptObjectBase
  14. {
  15. public:
  16. /** Returns the internal native platform info object. */
  17. SPtr<PlatformInfo> getPlatformInfo() const { return mPlatformInfo; }
  18. protected:
  19. ScriptPlatformInfoBase(MonoObject* instance);
  20. virtual ~ScriptPlatformInfoBase() {}
  21. SPtr<PlatformInfo> mPlatformInfo;
  22. };
  23. /** Interop class between C++ & CLR for PlatformInfo. */
  24. class BS_SCR_BED_EXPORT ScriptPlatformInfo : public ScriptObject <ScriptPlatformInfo, ScriptPlatformInfoBase>
  25. {
  26. public:
  27. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "PlatformInfo")
  28. /** Creates a new managed platform info object that wraps the provided native platform info. */
  29. static MonoObject* create(const SPtr<PlatformInfo>& platformInfo);
  30. private:
  31. ScriptPlatformInfo(MonoObject* instance);
  32. /************************************************************************/
  33. /* CLR HOOKS */
  34. /************************************************************************/
  35. static PlatformType internal_GetType(ScriptPlatformInfoBase* thisPtr);
  36. static MonoString* internal_GetDefines(ScriptPlatformInfoBase* thisPtr);
  37. static void internal_SetDefines(ScriptPlatformInfoBase* thisPtr, MonoString* value);
  38. static MonoObject* internal_GetMainScene(ScriptPlatformInfoBase* thisPtr);
  39. static void internal_SetMainScene(ScriptPlatformInfoBase* thisPtr, ScriptResourceRef* prefabRef);
  40. static bool internal_GetFullscreen(ScriptPlatformInfoBase* thisPtr);
  41. static void internal_SetFullscreen(ScriptPlatformInfoBase* thisPtr, bool fullscreen);
  42. static void internal_GetResolution(ScriptPlatformInfoBase* thisPtr, UINT32* width, UINT32* height);
  43. static void internal_SetResolution(ScriptPlatformInfoBase* thisPtr, UINT32 width, UINT32 height);
  44. static bool internal_GetDebug(ScriptPlatformInfoBase* thisPtr);
  45. static void internal_SetDebug(ScriptPlatformInfoBase* thisPtr, bool debug);
  46. };
  47. /** Interop class between C++ & CLR for WinPlatformInfo. */
  48. class BS_SCR_BED_EXPORT ScriptWinPlatformInfo : public ScriptObject <ScriptWinPlatformInfo, ScriptPlatformInfoBase>
  49. {
  50. public:
  51. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "WinPlatformInfo")
  52. /** Creates a new managed platform info object that wraps the provided native platform info. */
  53. static MonoObject* create(const SPtr<WinPlatformInfo>& platformInfo);
  54. private:
  55. ScriptWinPlatformInfo(MonoObject* instance);
  56. /** Returns the internal native Windows platform info object. */
  57. SPtr<WinPlatformInfo> getWinPlatformInfo() const;
  58. /************************************************************************/
  59. /* CLR HOOKS */
  60. /************************************************************************/
  61. static MonoObject* internal_GetIcon(ScriptWinPlatformInfo* thisPtr);
  62. static void internal_SetIcon(ScriptWinPlatformInfo* thisPtr, ScriptResourceRef* textureRef);
  63. static MonoString* internal_GetTitleText(ScriptWinPlatformInfo* thisPtr);
  64. static void internal_SetTitleText(ScriptWinPlatformInfo* thisPtr, MonoString* text);
  65. };
  66. /** @} */
  67. }