BsScriptVector.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEnginePrerequisites.h"
  5. #include "BsScriptObject.h"
  6. #include "BsVector2.h"
  7. #include "BsVector3.h"
  8. #include "BsVector4.h"
  9. namespace BansheeEngine
  10. {
  11. /**
  12. * @brief Interop class between C++ & CLR for Vector2.
  13. */
  14. class BS_SCR_BE_EXPORT ScriptVector2 : public ScriptObject <ScriptVector2>
  15. {
  16. public:
  17. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Vector2")
  18. /**
  19. * @brief Unboxes a boxed managed Vector2 struct and returns
  20. * the native version of the structure.
  21. */
  22. static Vector2 unbox(MonoObject* obj);
  23. /**
  24. * @brief Boxes a native Vector2 struct and returns
  25. * a managed object containing it.
  26. */
  27. static MonoObject* box(const Vector2& value);
  28. private:
  29. ScriptVector2(MonoObject* instance);
  30. };
  31. /**
  32. * @brief Interop class between C++ & CLR for Vector3.
  33. */
  34. class BS_SCR_BE_EXPORT ScriptVector3 : public ScriptObject <ScriptVector3>
  35. {
  36. public:
  37. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Vector3")
  38. /**
  39. * @brief Unboxes a boxed managed Vector3 struct and returns
  40. * the native version of the structure.
  41. */
  42. static Vector3 unbox(MonoObject* obj);
  43. /**
  44. * @brief Boxes a native Vector3 struct and returns
  45. * a managed object containing it.
  46. */
  47. static MonoObject* box(const Vector3& value);
  48. private:
  49. ScriptVector3(MonoObject* instance);
  50. };
  51. /**
  52. * @brief Interop class between C++ & CLR for Vector4.
  53. */
  54. class BS_SCR_BE_EXPORT ScriptVector4 : public ScriptObject <ScriptVector4>
  55. {
  56. public:
  57. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Vector4")
  58. /**
  59. * @brief Unboxes a boxed managed Vector4 struct and returns
  60. * the native version of the structure.
  61. */
  62. static Vector4 unbox(MonoObject* obj);
  63. /**
  64. * @brief Boxes a native Vector4 struct and returns
  65. * a managed object containing it.
  66. */
  67. static MonoObject* box(const Vector4& value);
  68. private:
  69. ScriptVector4(MonoObject* instance);
  70. };
  71. }