1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
15 /// A two dimensional vector.
17 public class Vector2 : global::System.IDisposable
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20 protected bool swigCMemOwn;
22 internal Vector2(global::System.IntPtr cPtr, bool cMemoryOwn)
24 swigCMemOwn = cMemoryOwn;
25 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector2 obj)
30 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33 //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam)
35 //A Flag to check who called Dispose(). (By User or DisposeQueue)
36 private bool isDisposeQueued = false;
37 //A Flat to check if it is already disposed.
38 protected bool disposed = false;
44 isDisposeQueued = true;
45 DisposeQueue.Instance.Add(this);
51 //Throw excpetion if Dispose() is called in separate thread.
52 if (!Window.IsInstalled())
54 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
59 Dispose(DisposeTypes.Implicit);
63 Dispose(DisposeTypes.Explicit);
64 System.GC.SuppressFinalize(this);
68 protected virtual void Dispose(DisposeTypes type)
75 if(type == DisposeTypes.Explicit)
78 //Release your own managed resources here.
79 //You should release all of your own disposable objects here.
82 //Release your own unmanaged resources here.
83 //You should not access any managed member here except static instance.
84 //because the execution order of Finalizes is non-deterministic.
86 if (swigCPtr.Handle != global::System.IntPtr.Zero)
91 NDalicPINVOKE.delete_Vector2(swigCPtr);
93 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
99 /// Addition operator.
101 /// <param name="arg1">First value</param>
102 /// <param name="arg2">Second value</param>
103 /// <returns>A vector containing the result of the addition</returns>
104 public static Vector2 operator +(Vector2 arg1, Vector2 arg2)
106 return arg1.Add(arg2);
110 /// Subtraction operator.
112 /// <param name="arg1">First value</param>
113 /// <param name="arg2">Second value</param>
114 /// <returns>A vector containing the result of the subtraction</returns>
115 public static Vector2 operator -(Vector2 arg1, Vector2 arg2)
117 return arg1.Subtract(arg2);
121 /// Unary negation operator.
123 /// <param name="arg1">Target Value</param>
124 /// <returns>A vector containg the negation</returns>
125 public static Vector2 operator -(Vector2 arg1)
127 return arg1.Subtract();
131 /// Multiplication operator.
133 /// <param name="arg1">First Value</param>
134 /// <param name="arg2">Second Value</param>
135 /// <returns>A vector containing the result of the multiplication</returns>
136 public static Vector2 operator *(Vector2 arg1, Vector2 arg2)
138 return arg1.Multiply(arg2);
142 /// Multiplication operator.
144 /// <param name="arg1">First Value</param>
145 /// <param name="arg2">The float value to scale the vector</param>
146 /// <returns>A vector containing the result of the scaling</returns>
147 public static Vector2 operator *(Vector2 arg1, float arg2)
149 return arg1.Multiply(arg2);
153 /// Division operator.
155 /// <param name="arg1">First Value</param>
156 /// <param name="arg2">Second Value</param>
157 /// <returns>A vector containing the result of the division</returns>
158 public static Vector2 operator /(Vector2 arg1, Vector2 arg2)
160 return arg1.Divide(arg2);
164 /// Division operator.
166 /// <param name="arg1">First Value</param>
167 /// <param name="arg2">The float value to scale the vector by</param>
168 /// <returns>A vector containing the result of the scaling</returns>
169 public static Vector2 operator /(Vector2 arg1, float arg2)
171 return arg1.Divide(arg2);
175 /// Array subscript operator overload.
177 /// <param name="index">Subscript index</param>
178 /// <returns>The float at the given index</returns>
179 public float this[uint index]
183 return ValueOfIndex(index);
187 internal static Vector2 GetVector2FromPtr(global::System.IntPtr cPtr)
189 Vector2 ret = new Vector2(cPtr, false);
190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 /// Default constructor, initializes the vector to 0.
197 public Vector2() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true)
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 /// <param name="x">x or width component</param>
206 /// <param name="y">y or height component</param>
207 public Vector2(float x, float y) : this(NDalicPINVOKE.new_Vector2__SWIG_1(x, y), true)
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213 /// Conversion constructor from an array of two floats.
215 /// <param name="array">Array of xy</param>
216 public Vector2(float[] array) : this(NDalicPINVOKE.new_Vector2__SWIG_2(array), true)
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224 /// <param name="vec3">Vector3 to create this vector from</param>
225 public Vector2(Vector3 vec3) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Vector3.getCPtr(vec3)), true)
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233 /// <param name="vec4">Vector4 to create this vector from</param>
234 public Vector2(Vector4 vec4) : this(NDalicPINVOKE.new_Vector2__SWIG_4(Vector4.getCPtr(vec4)), true)
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242 public static Vector2 One
246 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ONE_get();
247 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254 /// Vector representing the X axis
256 public static Vector2 XAxis
260 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_XAXIS_get();
261 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268 /// Vector representing the Y axis
270 public static Vector2 YAxis
274 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_YAXIS_get();
275 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 /// Vector representing the negative X axis
284 public static Vector2 NegativeXAxis
288 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_XAXIS_get();
289 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296 /// Vector representing the negative Y axis
298 public static Vector2 NegativeYAxis
302 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_YAXIS_get();
303 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 public static Vector2 Zero
316 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ZERO_get();
317 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323 internal Vector2 Assign(float[] array)
325 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_0(swigCPtr, array), false);
326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330 internal Vector2 Assign(Vector3 rhs)
332 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_1(swigCPtr, Vector3.getCPtr(rhs)), false);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337 internal Vector2 Assign(Vector4 rhs)
339 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_2(swigCPtr, Vector4.getCPtr(rhs)), false);
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344 internal Vector2 Add(Vector2 rhs)
346 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Add(swigCPtr, Vector2.getCPtr(rhs)), true);
347 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351 internal Vector2 AddAssign(Vector2 rhs)
353 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_AddAssign(swigCPtr, Vector2.getCPtr(rhs)), false);
354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358 internal Vector2 Subtract(Vector2 rhs)
360 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
361 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
365 internal Vector2 SubtractAssign(Vector2 rhs)
367 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_SubtractAssign(swigCPtr, Vector2.getCPtr(rhs)), false);
368 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
372 internal Vector2 Multiply(Vector2 rhs)
374 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379 internal Vector2 Multiply(float rhs)
381 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, rhs), true);
382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
386 internal Vector2 MultiplyAssign(Vector2 rhs)
388 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false);
389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393 internal Vector2 MultiplyAssign(float rhs)
395 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
396 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
400 internal Vector2 Divide(Vector2 rhs)
402 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407 internal Vector2 Divide(float rhs)
409 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, rhs), true);
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 internal Vector2 DivideAssign(Vector2 rhs)
416 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false);
417 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 internal Vector2 DivideAssign(float rhs)
423 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_1(swigCPtr, rhs), false);
424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428 internal Vector2 Subtract()
430 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
435 internal bool EqualTo(Vector2 rhs)
437 bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Vector2.getCPtr(rhs));
438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442 internal bool NotEqualTo(Vector2 rhs)
444 bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Vector2.getCPtr(rhs));
445 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
449 internal float ValueOfIndex(uint index)
451 float ret = NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
452 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 /// Returns the length of the vector.
459 /// <returns>The length of the vector</returns>
460 public float Length()
462 float ret = NDalicPINVOKE.Vector2_Length(swigCPtr);
463 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
468 /// Returns the length of the vector squared.<br>
469 /// This is more efficient than Length() for threshold
470 /// testing as it avoids the use of a square root.<br>
472 /// <returns>The length of the vector squared</returns>
473 public float LengthSquared()
475 float ret = NDalicPINVOKE.Vector2_LengthSquared(swigCPtr);
476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
481 /// Sets the vector to be unit length, whilst maintaining its direction.
483 public void Normalize()
485 NDalicPINVOKE.Vector2_Normalize(swigCPtr);
486 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
490 /// Clamps the vector between minimum and maximum vectors.
492 /// <param name="min">The minimum vector</param>
493 /// <param name="max">The maximum vector</param>
494 public void Clamp(Vector2 min, Vector2 max)
496 NDalicPINVOKE.Vector2_Clamp(swigCPtr, Vector2.getCPtr(min), Vector2.getCPtr(max));
497 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
500 internal SWIGTYPE_p_float AsFloat()
502 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_AsFloat__SWIG_0(swigCPtr);
503 SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
504 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
515 NDalicPINVOKE.Vector2_X_set(swigCPtr, value);
516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520 float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr);
521 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 NDalicPINVOKE.Vector2_Width_set(swigCPtr, value);
534 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
538 float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr);
539 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
551 NDalicPINVOKE.Vector2_Y_set(swigCPtr, value);
552 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
556 float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr);
557 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
569 NDalicPINVOKE.Vector2_Height_set(swigCPtr, value);
570 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
574 float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr);
575 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();