summaryrefslogtreecommitdiff
path: root/modules/mono/glue
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/glue')
-rw-r--r--modules/mono/glue/cs_files/Array.cs5
-rw-r--r--modules/mono/glue/cs_files/Dictionary.cs5
-rw-r--r--modules/mono/glue/cs_files/GD.cs5
-rw-r--r--modules/mono/glue/cs_files/ObjectExtensions.cs17
-rw-r--r--modules/mono/glue/cs_files/Transform.cs13
-rw-r--r--modules/mono/glue/cs_files/Transform2D.cs21
-rwxr-xr-xmodules/mono/glue/cs_files/VERSION.txt2
-rw-r--r--modules/mono/glue/cs_files/Vector2.cs39
-rw-r--r--modules/mono/glue/cs_files/Vector3.cs41
9 files changed, 92 insertions, 56 deletions
diff --git a/modules/mono/glue/cs_files/Array.cs b/modules/mono/glue/cs_files/Array.cs
index 51f57daef4..1ec4d7d20a 100644
--- a/modules/mono/glue/cs_files/Array.cs
+++ b/modules/mono/glue/cs_files/Array.cs
@@ -331,5 +331,10 @@ namespace Godot
{
return GetEnumerator();
}
+
+ internal IntPtr GetPtr()
+ {
+ return objectArray.GetPtr();
+ }
}
}
diff --git a/modules/mono/glue/cs_files/Dictionary.cs b/modules/mono/glue/cs_files/Dictionary.cs
index 57a1960ad9..30d17c2a59 100644
--- a/modules/mono/glue/cs_files/Dictionary.cs
+++ b/modules/mono/glue/cs_files/Dictionary.cs
@@ -397,5 +397,10 @@ namespace Godot
{
return GetEnumerator();
}
+
+ internal IntPtr GetPtr()
+ {
+ return objectDict.GetPtr();
+ }
}
}
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs
index 43de9156f2..0a5d703f27 100644
--- a/modules/mono/glue/cs_files/GD.cs
+++ b/modules/mono/glue/cs_files/GD.cs
@@ -192,10 +192,5 @@ namespace Godot
{
return NativeCalls.godot_icall_Godot_var2str(var);
}
-
- public static WeakRef WeakRef(Object obj)
- {
- return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj));
- }
}
}
diff --git a/modules/mono/glue/cs_files/ObjectExtensions.cs b/modules/mono/glue/cs_files/ObjectExtensions.cs
new file mode 100644
index 0000000000..5c9e6609f4
--- /dev/null
+++ b/modules/mono/glue/cs_files/ObjectExtensions.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace Godot
+{
+ public partial class Object
+ {
+ public static bool IsInstanceValid(Object instance)
+ {
+ return instance != null && instance.NativeInstance != IntPtr.Zero;
+ }
+
+ public static WeakRef WeakRef(Object obj)
+ {
+ return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj));
+ }
+ }
+}
diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs
index d1b247a552..e432d5b52c 100644
--- a/modules/mono/glue/cs_files/Transform.cs
+++ b/modules/mono/glue/cs_files/Transform.cs
@@ -102,7 +102,18 @@ namespace Godot
basis[0, 2] * vInv.x + basis[1, 2] * vInv.y + basis[2, 2] * vInv.z
);
}
-
+
+ // Constants
+ private static readonly Transform _identity = new Transform(Basis.Identity, Vector3.Zero);
+ private static readonly Transform _flipX = new Transform(new Basis(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)), Vector3.Zero);
+ private static readonly Transform _flipY = new Transform(new Basis(new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)), Vector3.Zero);
+ private static readonly Transform _flipZ = new Transform(new Basis(new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, -1)), Vector3.Zero);
+
+ public static Transform Identity { get { return _identity; } }
+ public static Transform FlipX { get { return _flipX; } }
+ public static Transform FlipY { get { return _flipY; } }
+ public static Transform FlipZ { get { return _flipZ; } }
+
// Constructors
public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin)
{
diff --git a/modules/mono/glue/cs_files/Transform2D.cs b/modules/mono/glue/cs_files/Transform2D.cs
index ff5259178b..8d30833066 100644
--- a/modules/mono/glue/cs_files/Transform2D.cs
+++ b/modules/mono/glue/cs_files/Transform2D.cs
@@ -11,22 +11,10 @@ namespace Godot
[StructLayout(LayoutKind.Sequential)]
public struct Transform2D : IEquatable<Transform2D>
{
- private static readonly Transform2D identity = new Transform2D
- (
- new Vector2(1f, 0f),
- new Vector2(0f, 1f),
- new Vector2(0f, 0f)
- );
-
public Vector2 x;
public Vector2 y;
public Vector2 o;
- public static Transform2D Identity
- {
- get { return identity; }
- }
-
public Vector2 Origin
{
get { return o; }
@@ -264,6 +252,15 @@ namespace Godot
Vector2 vInv = v - o;
return new Vector2(x.Dot(vInv), y.Dot(vInv));
}
+
+ // Constants
+ private static readonly Transform2D _identity = new Transform2D(new Vector2(1f, 0f), new Vector2(0f, 1f), Vector2.Zero);
+ private static readonly Transform2D _flipX = new Transform2D(new Vector2(-1f, 0f), new Vector2(0f, 1f), Vector2.Zero);
+ private static readonly Transform2D _flipY = new Transform2D(new Vector2(1f, 0f), new Vector2(0f, -1f), Vector2.Zero);
+
+ public static Transform2D Identity { get { return _identity; } }
+ public static Transform2D FlipX { get { return _flipX; } }
+ public static Transform2D FlipY { get { return _flipY; } }
// Constructors
public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 origin)
diff --git a/modules/mono/glue/cs_files/VERSION.txt b/modules/mono/glue/cs_files/VERSION.txt
index 7f8f011eb7..ec635144f6 100755
--- a/modules/mono/glue/cs_files/VERSION.txt
+++ b/modules/mono/glue/cs_files/VERSION.txt
@@ -1 +1 @@
-7
+9
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs
index c274364895..14c8de6986 100644
--- a/modules/mono/glue/cs_files/Vector2.cs
+++ b/modules/mono/glue/cs_files/Vector2.cs
@@ -231,24 +231,27 @@ namespace Godot
{
return new Vector2(y, -x);
}
-
- private static readonly Vector2 zero = new Vector2 (0, 0);
- private static readonly Vector2 one = new Vector2 (1, 1);
- private static readonly Vector2 negOne = new Vector2 (-1, -1);
-
- private static readonly Vector2 up = new Vector2 (0, 1);
- private static readonly Vector2 down = new Vector2 (0, -1);
- private static readonly Vector2 right = new Vector2 (1, 0);
- private static readonly Vector2 left = new Vector2 (-1, 0);
-
- public static Vector2 Zero { get { return zero; } }
- public static Vector2 One { get { return one; } }
- public static Vector2 NegOne { get { return negOne; } }
-
- public static Vector2 Up { get { return up; } }
- public static Vector2 Down { get { return down; } }
- public static Vector2 Right { get { return right; } }
- public static Vector2 Left { get { return left; } }
+
+ // Constants
+ private static readonly Vector2 _zero = new Vector2(0, 0);
+ private static readonly Vector2 _one = new Vector2(1, 1);
+ private static readonly Vector2 _negOne = new Vector2(-1, -1);
+ private static readonly Vector2 _inf = new Vector2(Mathf.Inf, Mathf.Inf);
+
+ private static readonly Vector2 _up = new Vector2(0, -1);
+ private static readonly Vector2 _down = new Vector2(0, 1);
+ private static readonly Vector2 _right = new Vector2(1, 0);
+ private static readonly Vector2 _left = new Vector2(-1, 0);
+
+ public static Vector2 Zero { get { return _zero; } }
+ public static Vector2 NegOne { get { return _negOne; } }
+ public static Vector2 One { get { return _one; } }
+ public static Vector2 Inf { get { return _inf; } }
+
+ public static Vector2 Up { get { return _up; } }
+ public static Vector2 Down { get { return _down; } }
+ public static Vector2 Right { get { return _right; } }
+ public static Vector2 Left { get { return _left; } }
// Constructors
public Vector2(real_t x, real_t y)
diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs
index 085a4f0043..861d9c54d9 100644
--- a/modules/mono/glue/cs_files/Vector3.cs
+++ b/modules/mono/glue/cs_files/Vector3.cs
@@ -272,27 +272,30 @@ namespace Godot
);
}
- private static readonly Vector3 zero = new Vector3 (0, 0, 0);
- private static readonly Vector3 one = new Vector3 (1, 1, 1);
- private static readonly Vector3 negOne = new Vector3 (-1, -1, -1);
+ // Constants
+ private static readonly Vector3 _zero = new Vector3(0, 0, 0);
+ private static readonly Vector3 _one = new Vector3(1, 1, 1);
+ private static readonly Vector3 _negOne = new Vector3(-1, -1, -1);
+ private static readonly Vector3 _inf = new Vector3(Mathf.Inf, Mathf.Inf, Mathf.Inf);
- private static readonly Vector3 up = new Vector3 (0, 1, 0);
- private static readonly Vector3 down = new Vector3 (0, -1, 0);
- private static readonly Vector3 right = new Vector3 (1, 0, 0);
- private static readonly Vector3 left = new Vector3 (-1, 0, 0);
- private static readonly Vector3 forward = new Vector3 (0, 0, -1);
- private static readonly Vector3 back = new Vector3 (0, 0, 1);
-
- public static Vector3 Zero { get { return zero; } }
- public static Vector3 One { get { return one; } }
- public static Vector3 NegOne { get { return negOne; } }
+ private static readonly Vector3 _up = new Vector3(0, 1, 0);
+ private static readonly Vector3 _down = new Vector3(0, -1, 0);
+ private static readonly Vector3 _right = new Vector3(1, 0, 0);
+ private static readonly Vector3 _left = new Vector3(-1, 0, 0);
+ private static readonly Vector3 _forward = new Vector3(0, 0, -1);
+ private static readonly Vector3 _back = new Vector3(0, 0, 1);
+
+ public static Vector3 Zero { get { return _zero; } }
+ public static Vector3 One { get { return _one; } }
+ public static Vector3 NegOne { get { return _negOne; } }
+ public static Vector3 Inf { get { return _inf; } }
- public static Vector3 Up { get { return up; } }
- public static Vector3 Down { get { return down; } }
- public static Vector3 Right { get { return right; } }
- public static Vector3 Left { get { return left; } }
- public static Vector3 Forward { get { return forward; } }
- public static Vector3 Back { get { return back; } }
+ public static Vector3 Up { get { return _up; } }
+ public static Vector3 Down { get { return _down; } }
+ public static Vector3 Right { get { return _right; } }
+ public static Vector3 Left { get { return _left; } }
+ public static Vector3 Forward { get { return _forward; } }
+ public static Vector3 Back { get { return _back; } }
// Constructors
public Vector3(real_t x, real_t y, real_t z)