X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FVector2.cs;h=7c7b8c8df2fb0476d7d92b87a36638d1d3a9d3bb;hb=46b8a31f5c1c75a22b648ca394a4de8a50898513;hp=a58fb03a60f3c1d51fb24bb4dcb7c5bb90246a21;hpb=d51a7242c3ee7e9a4e57bbd5f8644df391253b81;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/Vector2.cs b/src/Tizen.NUI/src/public/Vector2.cs index a58fb03..7c7b8c8 100755 --- a/src/Tizen.NUI/src/public/Vector2.cs +++ b/src/Tizen.NUI/src/public/Vector2.cs @@ -25,104 +25,250 @@ namespace Tizen.NUI /// /// 3 [TypeConverter(typeof(Vector2TypeConverter))] - public class Vector2 : global::System.IDisposable + public class Vector2 : Disposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; /// /// swigCMemOwn. /// /// 3 protected bool swigCMemOwn; + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + /// + /// The default constructor initializes the vector to 0. + /// + /// 3 + public Vector2() : this(Interop.Vector2.new_Vector2__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// The constructor. + /// + /// The x or width component. + /// The y or height component. + /// 3 + public Vector2(float x, float y) : this(Interop.Vector2.new_Vector2__SWIG_1(x, y), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// The conversion constructor from an array of two floats. + /// + /// The array of xy. + /// 3 + public Vector2(float[] array) : this(Interop.Vector2.new_Vector2__SWIG_2(array), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// The constructor. + /// + /// Vector3 to create this vector from. + /// 3 + public Vector2(Vector3 vec3) : this(Interop.Vector2.new_Vector2__SWIG_3(Vector3.getCPtr(vec3)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// The constructor. + /// + /// Vector4 to create this vector from. + /// 3 + public Vector2(Vector4 vec4) : this(Interop.Vector2.new_Vector2__SWIG_4(Vector4.getCPtr(vec4)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + internal Vector2(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector2 obj) + /// + /// (1.0f,1.0f). + /// + /// 3 + public static Vector2 One { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + get + { + global::System.IntPtr cPtr = Interop.Vector2.Vector2_ONE_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } } - //A Flag to check who called Dispose(). (By User or DisposeQueue) - private bool isDisposeQueued = false; + /// + /// The vector representing the x-axis. + /// + /// 3 + public static Vector2 XAxis + { + get + { + global::System.IntPtr cPtr = Interop.Vector2.Vector2_XAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } /// - /// A Flat to check if it is already disposed. + /// The vector representing the y-axis. /// /// 3 - protected bool disposed = false; + public static Vector2 YAxis + { + get + { + global::System.IntPtr cPtr = Interop.Vector2.Vector2_YAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } /// - /// Destructor. + /// The vector representing the negative x-axis. /// /// 3 - ~Vector2() + public static Vector2 NegativeXAxis { - if(!isDisposeQueued) + get { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); + global::System.IntPtr cPtr = Interop.Vector2.Vector2_NEGATIVE_XAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } } /// - /// Dispose. + /// The vector representing the negative y-axis. /// /// 3 - public void Dispose() + public static Vector2 NegativeYAxis { - //Throw excpetion if Dispose() is called in separate thread. - if (!Window.IsInstalled()) + get { - throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + global::System.IntPtr cPtr = Interop.Vector2.Vector2_NEGATIVE_YAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - if (isDisposeQueued) + /// + /// (0.0f, 0.0f). + /// + /// 3 + public static Vector2 Zero + { + get { - Dispose(DisposeTypes.Implicit); + global::System.IntPtr cPtr = Interop.Vector2.Vector2_ZERO_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - else + } + + /// + /// The x component. + /// + /// 3 + public float X + { + set { - Dispose(DisposeTypes.Explicit); - System.GC.SuppressFinalize(this); + Interop.Vector2.Vector2_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = Interop.Vector2.Vector2_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } } /// - /// Dispose. + /// The width. /// - /// The dispose type /// 3 - protected virtual void Dispose(DisposeTypes type) + public float Width { - if (disposed) + set { - return; + Interop.Vector2.Vector2_Width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = Interop.Vector2.Vector2_Width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + } - if(type == DisposeTypes.Explicit) + /// + /// The y component. + /// + /// 3 + public float Y + { + set { - //Called by User - //Release your own managed resources here. - //You should release all of your own disposable objects here. + Interop.Vector2.Vector2_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + get + { + float ret = Interop.Vector2.Vector2_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } - //Release your own unmanaged resources here. - //You should not access any managed member here except static instance. - //because the execution order of Finalizes is non-deterministic. + /// + /// The height. + /// + /// 3 + public float Height + { + set + { + Interop.Vector2.Vector2_Height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = Interop.Vector2.Vector2_Height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } - if (swigCPtr.Handle != global::System.IntPtr.Zero) + /// + /// The array subscript operator overload. + /// + /// The subscript index. + /// The float at the given index. + /// 3 + public float this[uint index] + { + get { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicPINVOKE.delete_Vector2(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + return ValueOfIndex(index); } - disposed = true; } /// @@ -209,436 +355,239 @@ namespace Tizen.NUI } /// - /// The array subscript operator overload. + /// Determines whether the specified object is equal to the current object. /// - /// The subscript index. - /// The float at the given index. - /// 3 - public float this[uint index] + /// The object to compare with the current object. + /// true if the specified object is equal to the current object; otherwise, false. + public override bool Equals(System.Object obj) { - get + Vector2 vector2 = obj as Vector2; + bool equal = false; + if (X == vector2?.X && Y == vector2?.Y) { - return ValueOfIndex(index); + equal = true; } - } - - internal static Vector2 GetVector2FromPtr(global::System.IntPtr cPtr) - { - Vector2 ret = new Vector2(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return equal; } /// - /// The default constructor initializes the vector to 0. + /// Gets the the hash code of this Vector2. /// - /// 3 - public Vector2() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) + /// The Hash Code. + /// 6 + public override int GetHashCode() { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return swigCPtr.Handle.GetHashCode(); } /// - /// The constructor. + /// Returns the length of the vector. /// - /// The x or width component. - /// The y or height component. + /// The length of the vector. /// 3 - public Vector2(float x, float y) : this(NDalicPINVOKE.new_Vector2__SWIG_1(x, y), true) + public float Length() { + float ret = Interop.Vector2.Vector2_Length(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// The conversion constructor from an array of two floats. + /// Returns the length of the vector squared.
+ /// This is more efficient than Length() for threshold + /// testing as it avoids the use of a square root.
///
- /// The array of xy. + /// The length of the vector squared /// 3 - public Vector2(float[] array) : this(NDalicPINVOKE.new_Vector2__SWIG_2(array), true) + public float LengthSquared() { + float ret = Interop.Vector2.Vector2_LengthSquared(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// The constructor. + /// Sets the vector to be the unit length, whilst maintaining its direction. /// - /// Vector3 to create this vector from. /// 3 - public Vector2(Vector3 vec3) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Vector3.getCPtr(vec3)), true) + public void Normalize() { + Interop.Vector2.Vector2_Normalize(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// - /// The constructor. + /// Clamps the vector between minimum and maximum vectors. /// - /// Vector4 to create this vector from. + /// The minimum vector. + /// The maximum vector. /// 3 - public Vector2(Vector4 vec4) : this(NDalicPINVOKE.new_Vector2__SWIG_4(Vector4.getCPtr(vec4)), true) + public void Clamp(Vector2 min, Vector2 max) { + Interop.Vector2.Vector2_Clamp(swigCPtr, Vector2.getCPtr(min), Vector2.getCPtr(max)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// (1.0f,1.0f). - /// - /// 3 - public static Vector2 One + internal static Vector2 GetVector2FromPtr(global::System.IntPtr cPtr) { - get - { - global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ONE_get(); - Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + Vector2 ret = new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - /// - /// The vector representing the x-axis. - /// - /// 3 - public static Vector2 XAxis + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector2 obj) { - get - { - global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_XAXIS_get(); - Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - /// - /// The vector representing the y-axis. - /// - /// 3 - public static Vector2 YAxis + internal SWIGTYPE_p_float AsFloat() { - get - { - global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_YAXIS_get(); - Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + global::System.IntPtr cPtr = Interop.Vector2.Vector2_AsFloat__SWIG_0(swigCPtr); + SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// The vector representing the negative x-axis. + /// Dispose. /// + /// The dispose type /// 3 - public static Vector2 NegativeXAxis + protected override void Dispose(DisposeTypes type) { - get + if (disposed) { - global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_XAXIS_get(); - Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return; } - } - /// - /// The vector representing the negative y-axis. - /// - /// 3 - public static Vector2 NegativeYAxis - { - get - { - global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_YAXIS_get(); - Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. - /// - /// (0.0f, 0.0f). - /// - /// 3 - public static Vector2 Zero - { - get + if (swigCPtr.Handle != global::System.IntPtr.Zero) { - global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ZERO_get(); - Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + if (swigCMemOwn) + { + swigCMemOwn = false; + Interop.Vector2.delete_Vector2(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } + base.Dispose(type); } private Vector2 Add(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Add(swigCPtr, Vector2.getCPtr(rhs)), true); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_Add(swigCPtr, Vector2.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 AddAssign(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_AddAssign(swigCPtr, Vector2.getCPtr(rhs)), false); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_AddAssign(swigCPtr, Vector2.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 Subtract(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_Subtract__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 SubtractAssign(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_SubtractAssign(swigCPtr, Vector2.getCPtr(rhs)), false); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_SubtractAssign(swigCPtr, Vector2.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 Multiply(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_Multiply__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 Multiply(float rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, rhs), true); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_Multiply__SWIG_1(swigCPtr, rhs), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 MultiplyAssign(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_MultiplyAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 MultiplyAssign(float rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_1(swigCPtr, rhs), false); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_MultiplyAssign__SWIG_1(swigCPtr, rhs), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 Divide(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_Divide__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 Divide(float rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, rhs), true); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_Divide__SWIG_1(swigCPtr, rhs), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 DivideAssign(Vector2 rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_DivideAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 DivideAssign(float rhs) { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_1(swigCPtr, rhs), false); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_DivideAssign__SWIG_1(swigCPtr, rhs), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private Vector2 Subtract() { - Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true); + Vector2 ret = new Vector2(Interop.Vector2.Vector2_Subtract__SWIG_1(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private bool EqualTo(Vector2 rhs) { - bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Vector2.getCPtr(rhs)); + bool ret = Interop.Vector2.Vector2_EqualTo(swigCPtr, Vector2.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private bool NotEqualTo(Vector2 rhs) { - bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Vector2.getCPtr(rhs)); + bool ret = Interop.Vector2.Vector2_NotEqualTo(swigCPtr, Vector2.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private float ValueOfIndex(uint index) { - float ret = NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// Determines whether the specified object is equal to the current object. - /// - /// The object to compare with the current object. - /// true if the specified object is equal to the current object; otherwise, false. - public override bool Equals(System.Object obj) - { - Vector2 vector2 = obj as Vector2; - bool equal = false; - if (X == vector2?.X && Y == vector2?.Y) - { - equal = true; - } - return equal; - } - - /// - /// Gets the the hash code of this Vector2. - /// - /// The Hash Code. - /// 5 - public override int GetHashCode() - { - return X.GetHashCode(); - } - - /// - /// Returns the length of the vector. - /// - /// The length of the vector. - /// 3 - public float Length() - { - float ret = NDalicPINVOKE.Vector2_Length(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// Returns the length of the vector squared.
- /// This is more efficient than Length() for threshold - /// testing as it avoids the use of a square root.
- ///
- /// The length of the vector squared - /// 3 - public float LengthSquared() - { - float ret = NDalicPINVOKE.Vector2_LengthSquared(swigCPtr); + float ret = Interop.Vector2.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - /// - /// Sets the vector to be the unit length, whilst maintaining its direction. - /// - /// 3 - public void Normalize() - { - NDalicPINVOKE.Vector2_Normalize(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - /// - /// Clamps the vector between minimum and maximum vectors. - /// - /// The minimum vector. - /// The maximum vector. - /// 3 - public void Clamp(Vector2 min, Vector2 max) - { - NDalicPINVOKE.Vector2_Clamp(swigCPtr, Vector2.getCPtr(min), Vector2.getCPtr(max)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal SWIGTYPE_p_float AsFloat() - { - global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_AsFloat__SWIG_0(swigCPtr); - SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// The x component. - /// - /// 3 - public float X - { - set - { - NDalicPINVOKE.Vector2_X_set(swigCPtr, value); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - get - { - float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - - /// - /// The width. - /// - /// 3 - public float Width - { - set - { - NDalicPINVOKE.Vector2_Width_set(swigCPtr, value); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - get - { - float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - - /// - /// The y component. - /// - /// 3 - public float Y - { - set - { - NDalicPINVOKE.Vector2_Y_set(swigCPtr, value); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - get - { - float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - - /// - /// The height. - /// - /// 3 - public float Height - { - set - { - NDalicPINVOKE.Vector2_Height_set(swigCPtr, value); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - get - { - float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - } } \ No newline at end of file