Implement own vector types to releive the System.Numerics dependency.
This commit is contained in:
parent
9838540a8f
commit
c26dcfe3f3
@ -1,4 +1,3 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace Quik
|
||||
{
|
||||
@ -363,13 +362,13 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// The vertices that make up the polygon.
|
||||
/// </summary>
|
||||
public Vector2[] Polygon { get; }
|
||||
public QuikVec2[] Polygon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a draw polygon command.
|
||||
/// </summary>
|
||||
/// <param name="polygon">The polygon to draw.</param>
|
||||
public QuikCommandPolygon(Vector2[] polygon)
|
||||
public QuikCommandPolygon(QuikVec2[] polygon)
|
||||
{
|
||||
Polygon = polygon;
|
||||
}
|
||||
@ -392,14 +391,14 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// The baseline start position of the character.
|
||||
/// </summary>
|
||||
public Vector2 Position { get; }
|
||||
public QuikVec2 Position { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a put character command.
|
||||
/// </summary>
|
||||
/// <param name="character">The character to put.</param>
|
||||
/// <param name="position">The baseline start position of the character.</param>
|
||||
public QuikCommandPutChar(int character, Vector2 position)
|
||||
public QuikCommandPutChar(int character, QuikVec2 position)
|
||||
{
|
||||
Character = character;
|
||||
Position = position;
|
||||
@ -410,7 +409,7 @@ namespace Quik
|
||||
/// </summary>
|
||||
/// <param name="character">The character to put.</param>
|
||||
/// <param name="position">The baseline start position of the character.</param>
|
||||
public QuikCommandPutChar(char character, Vector2 position) : this((int) character, position)
|
||||
public QuikCommandPutChar(char character, QuikVec2 position) : this((int) character, position)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -431,14 +430,14 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// The baseline start position of the text.
|
||||
/// </summary>
|
||||
public Vector2 Position { get; }
|
||||
public QuikVec2 Position { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a put text command.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to put.</param>
|
||||
/// <param name="position">The baseline start position of the text.</param>
|
||||
public QuikCommandPutText(string text, Vector2 position)
|
||||
public QuikCommandPutText(string text, QuikVec2 position)
|
||||
{
|
||||
Text = text;
|
||||
Position = position;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Quik
|
||||
{
|
||||
@ -29,8 +28,8 @@ namespace Quik
|
||||
public void Triangle(params QuikTriangle[] triangles) => Commands.Enqueue(new QuikCommandTriangles(triangles));
|
||||
public void Triangle(IEnumerable<QuikTriangle> triangles) =>
|
||||
Commands.Enqueue(new QuikCommandTriangles(triangles.ToArray()));
|
||||
public void Polygon(params Vector2[] polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon));
|
||||
public void Polygon(IEnumerable<Vector2> polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon.ToArray()));
|
||||
public void Polygon(params QuikVec2[] polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon));
|
||||
public void Polygon(IEnumerable<QuikVec2> polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon.ToArray()));
|
||||
public void StencilClear() => Commands.Enqueue(new QuikCommandStencilClear());
|
||||
public void StencilBegin() => Commands.Enqueue(new QuikCommandStencilBegin());
|
||||
public void StencilEnd() => Commands.Enqueue(new QuikCommandStencilEnd());
|
||||
|
@ -1,7 +1,37 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace Quik
|
||||
{
|
||||
/// <summary>
|
||||
/// A 2 dimensional Vector.
|
||||
/// </summary>
|
||||
public struct QuikVec2
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A RGBA color value.
|
||||
/// </summary>
|
||||
public struct QuikColor
|
||||
{
|
||||
/// <summary>
|
||||
/// Red channel.
|
||||
/// </summary>
|
||||
public byte R;
|
||||
/// <summary>
|
||||
/// Green channel.
|
||||
/// </summary>
|
||||
public byte G;
|
||||
/// <summary>
|
||||
/// Blue channel.
|
||||
/// </summary>
|
||||
public byte B;
|
||||
/// <summary>
|
||||
/// Alpha channel.
|
||||
/// </summary>
|
||||
public byte A;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A bezier curve segment.
|
||||
/// </summary>
|
||||
@ -10,22 +40,22 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// Segment start point.
|
||||
/// </summary>
|
||||
public Vector2 Start;
|
||||
public QuikVec2 Start;
|
||||
|
||||
/// <summary>
|
||||
/// Start point control point.
|
||||
/// </summary>
|
||||
public Vector2 ControlA;
|
||||
public QuikVec2 ControlA;
|
||||
|
||||
/// <summary>
|
||||
/// End point control point.
|
||||
/// </summary>
|
||||
public Vector2 ControlB;
|
||||
public QuikVec2 ControlB;
|
||||
|
||||
/// <summary>
|
||||
/// Segment end point.
|
||||
/// </summary>
|
||||
public Vector2 End;
|
||||
public QuikVec2 End;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -36,12 +66,12 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// Start point.
|
||||
/// </summary>
|
||||
public Vector2 Start;
|
||||
public QuikVec2 Start;
|
||||
|
||||
/// <summary>
|
||||
/// End point.
|
||||
/// </summary>
|
||||
public Vector2 End;
|
||||
public QuikVec2 End;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -52,12 +82,12 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// Rectangle minimum point.
|
||||
/// </summary>
|
||||
public Vector2 Min;
|
||||
public QuikVec2 Min;
|
||||
|
||||
/// <summary>
|
||||
/// Rectangle maximum point.
|
||||
/// </summary>
|
||||
public Vector2 Max;
|
||||
public QuikVec2 Max;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,17 +99,17 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// Ellipse center point.
|
||||
/// </summary>
|
||||
public Vector2 Center;
|
||||
public QuikVec2 Center;
|
||||
|
||||
/// <summary>
|
||||
/// First ellipse axis.
|
||||
/// </summary>
|
||||
public Vector2 AxisA;
|
||||
public QuikVec2 AxisA;
|
||||
|
||||
/// <summary>
|
||||
/// Second ellipse axis.
|
||||
/// </summary>
|
||||
public Vector2 AxisB;
|
||||
public QuikVec2 AxisB;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -90,16 +120,16 @@ namespace Quik
|
||||
/// <summary>
|
||||
/// First vertex.
|
||||
/// </summary>
|
||||
public Vector2 A;
|
||||
public QuikVec2 A;
|
||||
|
||||
/// <summary>
|
||||
/// Second vertex.
|
||||
/// </summary>
|
||||
public Vector2 B;
|
||||
public QuikVec2 B;
|
||||
|
||||
/// <summary>
|
||||
/// Third vertex.
|
||||
/// </summary>
|
||||
public Vector2 C;
|
||||
public QuikVec2 C;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user