BsScriptPlatformInfo.h 3.5 KB

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