BsScriptVector.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 "Math/BsVector2.h"
  7. #include "Math/BsVector3.h"
  8. #include "Math/BsVector4.h"
  9. namespace bs
  10. {
  11. /** @addtogroup ScriptInteropEngine
  12. * @{
  13. */
  14. /** Interop class between C++ & CLR for Vector2. */
  15. class BS_SCR_BE_EXPORT ScriptVector2 : public ScriptObject <ScriptVector2>
  16. {
  17. public:
  18. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Vector2")
  19. /** Unboxes a boxed managed Vector2 struct and returns the native version of the structure. */
  20. static Vector2 unbox(MonoObject* obj);
  21. /** Boxes a native Vector2 struct and returns a managed object containing it. */
  22. static MonoObject* box(const Vector2& value);
  23. private:
  24. ScriptVector2(MonoObject* instance);
  25. };
  26. /** Interop class between C++ & CLR for Vector3. */
  27. class BS_SCR_BE_EXPORT ScriptVector3 : public ScriptObject <ScriptVector3>
  28. {
  29. public:
  30. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Vector3")
  31. /** Unboxes a boxed managed Vector3 struct and returns the native version of the structure. */
  32. static Vector3 unbox(MonoObject* obj);
  33. /** Boxes a native Vector3 struct and returns a managed object containing it. */
  34. static MonoObject* box(const Vector3& value);
  35. private:
  36. ScriptVector3(MonoObject* instance);
  37. };
  38. /** Interop class between C++ & CLR for Vector4. */
  39. class BS_SCR_BE_EXPORT ScriptVector4 : public ScriptObject <ScriptVector4>
  40. {
  41. public:
  42. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Vector4")
  43. /** Unboxes a boxed managed Vector4 struct and returns the native version of the structure. */
  44. static Vector4 unbox(MonoObject* obj);
  45. /** Boxes a native Vector4 struct and returns a managed object containing it. */
  46. static MonoObject* box(const Vector4& value);
  47. private:
  48. ScriptVector4(MonoObject* instance);
  49. };
  50. /** @} */
  51. }