Fix issues with the core cs types.

This commit is contained in:
Relintai 2023-06-01 14:30:06 +02:00
parent 9863e95b02
commit 98a4b63096
8 changed files with 97 additions and 74 deletions

View File

@ -47,10 +47,6 @@ namespace Godot
Row3[3] = 1; Row3[3] = 1;
} }
public Projection() {
set_identity();
}
public Projection(Vector4 Row0, Vector4 Row1, Vector4 Row2, Vector4 Row3) { public Projection(Vector4 Row0, Vector4 Row1, Vector4 Row2, Vector4 Row3) {
this.Row0 = Row0; this.Row0 = Row0;
this.Row1 = Row1; this.Row1 = Row1;

View File

@ -9,21 +9,21 @@ using System.Runtime.InteropServices;
namespace Godot namespace Godot
{ {
/// <summary> /// <summary>
/// 2D axis-aligned bounding box. Rect2I consists of a position, a size, and /// 2D axis-aligned bounding box. Rect2i consists of a position, a size, and
/// several utility functions. It is typically used for fast overlap tests. /// several utility functions. It is typically used for fast overlap tests.
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Rect2I : IEquatable<Rect2I> public struct Rect2i : IEquatable<Rect2i>
{ {
private Vector2I _position; private Vector2i _position;
private Vector2I _size; private Vector2i _size;
/// <summary> /// <summary>
/// Beginning corner. Typically has values lower than <see cref="End"/>. /// Beginning corner. Typically has values lower than <see cref="End"/>.
/// </summary> /// </summary>
/// <value>Directly uses a private field.</value> /// <value>Directly uses a private field.</value>
public Vector2I Position public Vector2i Position
{ {
get { return _position; } get { return _position; }
set { _position = value; } set { _position = value; }
@ -34,58 +34,58 @@ namespace Godot
/// If the size is negative, you can use <see cref="Abs"/> to fix it. /// If the size is negative, you can use <see cref="Abs"/> to fix it.
/// </summary> /// </summary>
/// <value>Directly uses a private field.</value> /// <value>Directly uses a private field.</value>
public Vector2I Size public Vector2i Size
{ {
get { return _size; } get { return _size; }
set { _size = value; } set { _size = value; }
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2I"/> from a position and size. /// Constructs a <see cref="Rect2i"/> from a position and size.
/// </summary> /// </summary>
/// <param name="position">The position.</param> /// <param name="position">The position.</param>
/// <param name="size">The size.</param> /// <param name="size">The size.</param>
public Rect2I(Vector2I position, Vector2I size) public Rect2i(Vector2i position, Vector2i size)
{ {
_position = position; _position = position;
_size = size; _size = size;
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2I"/> from a position, width, and height. /// Constructs a <see cref="Rect2i"/> from a position, width, and height.
/// </summary> /// </summary>
/// <param name="position">The position.</param> /// <param name="position">The position.</param>
/// <param name="width">The width.</param> /// <param name="width">The width.</param>
/// <param name="height">The height.</param> /// <param name="height">The height.</param>
public Rect2I(Vector2I position, real_t width, real_t height) public Rect2i(Vector2i position, real_t width, real_t height)
{ {
_position = position; _position = position;
_size = new Vector2I(width, height); _size = new Vector2i(width, height);
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2I"/> from x, y, and size. /// Constructs a <see cref="Rect2i"/> from x, y, and size.
/// </summary> /// </summary>
/// <param name="x">The position's X coordinate.</param> /// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param> /// <param name="y">The position's Y coordinate.</param>
/// <param name="size">The size.</param> /// <param name="size">The size.</param>
public Rect2I(real_t x, real_t y, Vector2I size) public Rect2i(real_t x, real_t y, Vector2i size)
{ {
_position = new Vector2I(x, y); _position = new Vector2i(x, y);
_size = size; _size = size;
} }
/// <summary> /// <summary>
/// Constructs a <see cref="Rect2I"/> from x, y, width, and height. /// Constructs a <see cref="Rect2i"/> from x, y, width, and height.
/// </summary> /// </summary>
/// <param name="x">The position's X coordinate.</param> /// <param name="x">The position's X coordinate.</param>
/// <param name="y">The position's Y coordinate.</param> /// <param name="y">The position's Y coordinate.</param>
/// <param name="width">The width.</param> /// <param name="width">The width.</param>
/// <param name="height">The height.</param> /// <param name="height">The height.</param>
public Rect2I(real_t x, real_t y, real_t width, real_t height) public Rect2i(real_t x, real_t y, real_t width, real_t height)
{ {
_position = new Vector2I(x, y); _position = new Vector2i(x, y);
_size = new Vector2I(width, height); _size = new Vector2i(width, height);
} }
/// <summary> /// <summary>
@ -95,9 +95,9 @@ namespace Godot
/// <returns>Whether or not the rect and the other object are exactly equal.</returns> /// <returns>Whether or not the rect and the other object are exactly equal.</returns>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj is Rect2I) if (obj is Rect2i)
{ {
return Equals((Rect2I)obj); return Equals((Rect2i)obj);
} }
return false; return false;
@ -108,13 +108,13 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other rect to compare.</param> /// <param name="other">The other rect to compare.</param>
/// <returns>Whether or not the rects are exactly equal.</returns> /// <returns>Whether or not the rects are exactly equal.</returns>
public bool Equals(Rect2I other) public bool Equals(Rect2i other)
{ {
return _position.Equals(other._position) && _size.Equals(other._size); return _position.Equals(other._position) && _size.Equals(other._size);
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Rect2I"/>. /// Serves as the hash function for <see cref="Rect2i"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this rect.</returns> /// <returns>A hash code for this rect.</returns>
public override int GetHashCode() public override int GetHashCode()
@ -123,7 +123,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Rect2I"/> to a string. /// Converts this <see cref="Rect2i"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this rect.</returns> /// <returns>A string representation of this rect.</returns>
public override string ToString() public override string ToString()
@ -136,7 +136,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Rect2I"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Rect2i"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this rect.</returns> /// <returns>A string representation of this rect.</returns>
public string ToString(string format) public string ToString(string format)

View File

@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
namespace Godot namespace Godot
{ {
public sealed partial class StringName : IDisposable public sealed partial class StringName : IDisposable, IEquatable<StringName>
{ {
private bool _disposed = false; private bool _disposed = false;
@ -94,11 +94,31 @@ namespace Godot
return godot_icall_StringName_operator_String(StringName.GetPtr(left), StringName.GetPtr(right)); return godot_icall_StringName_operator_String(StringName.GetPtr(left), StringName.GetPtr(right));
} }
public static bool operator !=(Rect2 left, Rect2 right) public static bool operator !=(StringName left, StringName right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
public override bool Equals(object obj)
{
if (obj is StringName)
{
return Equals((StringName)obj);
}
return false;
}
public bool Equals(StringName other)
{
return godot_icall_StringName_operator_String(StringName.GetPtr(left), StringName.GetPtr(right));
}
public override int GetHashCode()
{
return (int)ptr;
}
[MethodImpl(MethodImplOptions.InternalCall)] [MethodImpl(MethodImplOptions.InternalCall)]
private static extern IntPtr godot_icall_StringName_Ctor(); private static extern IntPtr godot_icall_StringName_Ctor();

View File

@ -1,7 +1,7 @@
#if REAL_T_IS_DOUBLE #if REAL_T_IS_DOUBLE
using int = System.Double; using real_t = System.Double;
#else #else
using int = System.Single; using real_t = System.Single;
#endif #endif
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -13,7 +13,7 @@ namespace Godot
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Vector2I : IEquatable<Vector2I> public struct Vector2i : IEquatable<Vector2i>
{ {
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
@ -27,21 +27,21 @@ namespace Godot
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector2I"/> with the given components. /// Constructs a new <see cref="Vector2i"/> with the given components.
/// </summary> /// </summary>
/// <param name="x">The vector's X component.</param> /// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param> /// <param name="y">The vector's Y component.</param>
public Vector2I(int x, int y) public Vector2i(int x, int y)
{ {
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector2I"/> from an existing <see cref="Vector2I"/>. /// Constructs a new <see cref="Vector2i"/> from an existing <see cref="Vector2i"/>.
/// </summary> /// </summary>
/// <param name="v">The existing <see cref="Vector2I"/>.</param> /// <param name="v">The existing <see cref="Vector2i"/>.</param>
public Vector2I(Vector2I v) public Vector2i(Vector2i v)
{ {
x = v.x; x = v.x;
y = v.y; y = v.y;
@ -57,9 +57,9 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns> /// <returns>Whether or not the vector and the object are equal.</returns>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj is Vector2I) if (obj is Vector2i)
{ {
return Equals((Vector2I)obj); return Equals((Vector2i)obj);
} }
return false; return false;
} }
@ -71,13 +71,13 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other vector.</param> /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are exactly equal.</returns> /// <returns>Whether or not the vectors are exactly equal.</returns>
public bool Equals(Vector2I other) public bool Equals(Vector2i other)
{ {
return x == other.x && y == other.y; return x == other.x && y == other.y;
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Vector2I"/>. /// Serves as the hash function for <see cref="Vector2i"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override int GetHashCode() public override int GetHashCode()
@ -86,7 +86,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector2I"/> to a string. /// Converts this <see cref="Vector2i"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override string ToString() public override string ToString()
@ -95,7 +95,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector2I"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Vector2i"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public string ToString(string format) public string ToString(string format)

View File

@ -1,7 +1,7 @@
#if REAL_T_IS_DOUBLE #if REAL_T_IS_DOUBLE
using int = System.Double; using real_t = System.Double;
#else #else
using int = System.Single; using real_t = System.Single;
#endif #endif
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -13,7 +13,7 @@ namespace Godot
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Vector3I : IEquatable<Vector3I> public struct Vector3i : IEquatable<Vector3i>
{ {
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
@ -31,12 +31,12 @@ namespace Godot
public int z; public int z;
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector3I"/> with the given components. /// Constructs a new <see cref="Vector3i"/> with the given components.
/// </summary> /// </summary>
/// <param name="x">The vector's X component.</param> /// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param> /// <param name="y">The vector's Y component.</param>
/// <param name="z">The vector's Z component.</param> /// <param name="z">The vector's Z component.</param>
public Vector3I(int x, int y, int z) public Vector3i(int x, int y, int z)
{ {
this.x = x; this.x = x;
this.y = y; this.y = y;
@ -44,10 +44,10 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector3I"/> from an existing <see cref="Vector3I"/>. /// Constructs a new <see cref="Vector3i"/> from an existing <see cref="Vector3i"/>.
/// </summary> /// </summary>
/// <param name="v">The existing <see cref="Vector3I"/>.</param> /// <param name="v">The existing <see cref="Vector3i"/>.</param>
public Vector3I(Vector3I v) public Vector3i(Vector3i v)
{ {
x = v.x; x = v.x;
y = v.y; y = v.y;
@ -64,9 +64,9 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns> /// <returns>Whether or not the vector and the object are equal.</returns>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj is Vector3I) if (obj is Vector3i)
{ {
return Equals((Vector3I)obj); return Equals((Vector3i)obj);
} }
return false; return false;
@ -79,13 +79,13 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other vector.</param> /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are exactly equal.</returns> /// <returns>Whether or not the vectors are exactly equal.</returns>
public bool Equals(Vector3I other) public bool Equals(Vector3i other)
{ {
return x == other.x && y == other.y && z == other.z; return x == other.x && y == other.y && z == other.z;
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Vector3I"/>. /// Serves as the hash function for <see cref="Vector3i"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override int GetHashCode() public override int GetHashCode()
@ -94,7 +94,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector3I"/> to a string. /// Converts this <see cref="Vector3i"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override string ToString() public override string ToString()
@ -103,7 +103,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector3I"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Vector3i"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public string ToString(string format) public string ToString(string format)

View File

@ -112,7 +112,7 @@ namespace Godot
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public string ToString(string format) public string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format), {w.ToString(format)})"; return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}, {w.ToString(format)})";
} }
} }
} }

View File

@ -1,7 +1,7 @@
#if REAL_T_IS_DOUBLE #if REAL_T_IS_DOUBLE
using int = System.Double; using real_t = System.Double;
#else #else
using int = System.Single; using real_t = System.Single;
#endif #endif
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -13,7 +13,7 @@ namespace Godot
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Vector4I : IEquatable<Vector4I> public struct Vector4i : IEquatable<Vector4i>
{ {
/// <summary> /// <summary>
/// The vector's X component. Also accessible by using the index position <c>[0]</c>. /// The vector's X component. Also accessible by using the index position <c>[0]</c>.
@ -33,12 +33,12 @@ namespace Godot
public int w; public int w;
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector4I"/> with the given components. /// Constructs a new <see cref="Vector4i"/> with the given components.
/// </summary> /// </summary>
/// <param name="x">The vector's X component.</param> /// <param name="x">The vector's X component.</param>
/// <param name="y">The vector's Y component.</param> /// <param name="y">The vector's Y component.</param>
/// <param name="z">The vector's Z component.</param> /// <param name="z">The vector's Z component.</param>
public Vector4I(int x, int y, int z, int w) public Vector4i(int x, int y, int z, int w)
{ {
this.x = x; this.x = x;
this.y = y; this.y = y;
@ -47,10 +47,10 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Constructs a new <see cref="Vector4I"/> from an existing <see cref="Vector4I"/>. /// Constructs a new <see cref="Vector4i"/> from an existing <see cref="Vector4i"/>.
/// </summary> /// </summary>
/// <param name="v">The existing <see cref="Vector4I"/>.</param> /// <param name="v">The existing <see cref="Vector4i"/>.</param>
public Vector4I(Vector4I v) public Vector4i(Vector4i v)
{ {
x = v.x; x = v.x;
y = v.y; y = v.y;
@ -68,9 +68,9 @@ namespace Godot
/// <returns>Whether or not the vector and the object are equal.</returns> /// <returns>Whether or not the vector and the object are equal.</returns>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj is Vector4I) if (obj is Vector4i)
{ {
return Equals((Vector4I)obj); return Equals((Vector4i)obj);
} }
return false; return false;
@ -83,13 +83,13 @@ namespace Godot
/// </summary> /// </summary>
/// <param name="other">The other vector.</param> /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are exactly equal.</returns> /// <returns>Whether or not the vectors are exactly equal.</returns>
public bool Equals(Vector4I other) public bool Equals(Vector4i other)
{ {
return x == other.x && y == other.y && z == other.z && w == other.w; return x == other.x && y == other.y && z == other.z && w == other.w;
} }
/// <summary> /// <summary>
/// Serves as the hash function for <see cref="Vector4I"/>. /// Serves as the hash function for <see cref="Vector4i"/>.
/// </summary> /// </summary>
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override int GetHashCode() public override int GetHashCode()
@ -98,7 +98,7 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector4I"/> to a string. /// Converts this <see cref="Vector4i"/> to a string.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public override string ToString() public override string ToString()
@ -107,12 +107,12 @@ namespace Godot
} }
/// <summary> /// <summary>
/// Converts this <see cref="Vector4I"/> to a string with the given <paramref name="format"/>. /// Converts this <see cref="Vector4i"/> to a string with the given <paramref name="format"/>.
/// </summary> /// </summary>
/// <returns>A string representation of this vector.</returns> /// <returns>A string representation of this vector.</returns>
public string ToString(string format) public string ToString(string format)
{ {
return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format), {w.ToString(format)})"; return $"({x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}, {w.ToString(format)})";
} }
} }
} }

View File

@ -42,18 +42,25 @@
<Compile Include="Core\Mathf.cs" /> <Compile Include="Core\Mathf.cs" />
<Compile Include="Core\MathfEx.cs" /> <Compile Include="Core\MathfEx.cs" />
<Compile Include="Core\NodePath.cs" /> <Compile Include="Core\NodePath.cs" />
<Compile Include="Core\StringName.cs" />
<Compile Include="Core\Object.base.cs" /> <Compile Include="Core\Object.base.cs" />
<Compile Include="Core\Plane.cs" /> <Compile Include="Core\Plane.cs" />
<Compile Include="Core\Quaternion.cs" /> <Compile Include="Core\Quaternion.cs" />
<Compile Include="Core\Rect2.cs" /> <Compile Include="Core\Rect2.cs" />
<Compile Include="Core\Rect2i.cs" />
<Compile Include="Core\RID.cs" /> <Compile Include="Core\RID.cs" />
<Compile Include="Core\SignalAwaiter.cs" /> <Compile Include="Core\SignalAwaiter.cs" />
<Compile Include="Core\StringExtensions.cs" /> <Compile Include="Core\StringExtensions.cs" />
<Compile Include="Core\Transform.cs" /> <Compile Include="Core\Transform.cs" />
<Compile Include="Core\Transform2D.cs" /> <Compile Include="Core\Transform2D.cs" />
<Compile Include="Core\Projection.cs" />
<Compile Include="Core\UnhandledExceptionArgs.cs" /> <Compile Include="Core\UnhandledExceptionArgs.cs" />
<Compile Include="Core\Vector2.cs" /> <Compile Include="Core\Vector2.cs" />
<Compile Include="Core\Vector2i.cs" />
<Compile Include="Core\Vector3.cs" /> <Compile Include="Core\Vector3.cs" />
<Compile Include="Core\Vector3i.cs" />
<Compile Include="Core\Vector4.cs" />
<Compile Include="Core\Vector4i.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<!-- <!--