BsScriptVector.h 1.9 KB

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