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
|
namespace Quik
|
||||||
{
|
{
|
||||||
@ -363,13 +362,13 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The vertices that make up the polygon.
|
/// The vertices that make up the polygon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2[] Polygon { get; }
|
public QuikVec2[] Polygon { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a draw polygon command.
|
/// Create a draw polygon command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="polygon">The polygon to draw.</param>
|
/// <param name="polygon">The polygon to draw.</param>
|
||||||
public QuikCommandPolygon(Vector2[] polygon)
|
public QuikCommandPolygon(QuikVec2[] polygon)
|
||||||
{
|
{
|
||||||
Polygon = polygon;
|
Polygon = polygon;
|
||||||
}
|
}
|
||||||
@ -392,14 +391,14 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The baseline start position of the character.
|
/// The baseline start position of the character.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 Position { get; }
|
public QuikVec2 Position { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a put character command.
|
/// Create a put character command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="character">The character to put.</param>
|
/// <param name="character">The character to put.</param>
|
||||||
/// <param name="position">The baseline start position of the character.</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;
|
Character = character;
|
||||||
Position = position;
|
Position = position;
|
||||||
@ -410,7 +409,7 @@ namespace Quik
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="character">The character to put.</param>
|
/// <param name="character">The character to put.</param>
|
||||||
/// <param name="position">The baseline start position of the character.</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>
|
/// <summary>
|
||||||
/// The baseline start position of the text.
|
/// The baseline start position of the text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 Position { get; }
|
public QuikVec2 Position { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a put text command.
|
/// Create a put text command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text to put.</param>
|
/// <param name="text">The text to put.</param>
|
||||||
/// <param name="position">The baseline start position of the text.</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;
|
Text = text;
|
||||||
Position = position;
|
Position = position;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
|
||||||
|
|
||||||
namespace Quik
|
namespace Quik
|
||||||
{
|
{
|
||||||
@ -29,8 +28,8 @@ namespace Quik
|
|||||||
public void Triangle(params QuikTriangle[] triangles) => Commands.Enqueue(new QuikCommandTriangles(triangles));
|
public void Triangle(params QuikTriangle[] triangles) => Commands.Enqueue(new QuikCommandTriangles(triangles));
|
||||||
public void Triangle(IEnumerable<QuikTriangle> triangles) =>
|
public void Triangle(IEnumerable<QuikTriangle> triangles) =>
|
||||||
Commands.Enqueue(new QuikCommandTriangles(triangles.ToArray()));
|
Commands.Enqueue(new QuikCommandTriangles(triangles.ToArray()));
|
||||||
public void Polygon(params Vector2[] polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon));
|
public void Polygon(params QuikVec2[] polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon));
|
||||||
public void Polygon(IEnumerable<Vector2> polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon.ToArray()));
|
public void Polygon(IEnumerable<QuikVec2> polygon) => Commands.Enqueue(new QuikCommandPolygon(polygon.ToArray()));
|
||||||
public void StencilClear() => Commands.Enqueue(new QuikCommandStencilClear());
|
public void StencilClear() => Commands.Enqueue(new QuikCommandStencilClear());
|
||||||
public void StencilBegin() => Commands.Enqueue(new QuikCommandStencilBegin());
|
public void StencilBegin() => Commands.Enqueue(new QuikCommandStencilBegin());
|
||||||
public void StencilEnd() => Commands.Enqueue(new QuikCommandStencilEnd());
|
public void StencilEnd() => Commands.Enqueue(new QuikCommandStencilEnd());
|
||||||
|
@ -1,7 +1,37 @@
|
|||||||
using System.Numerics;
|
|
||||||
|
|
||||||
namespace Quik
|
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>
|
/// <summary>
|
||||||
/// A bezier curve segment.
|
/// A bezier curve segment.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -10,22 +40,22 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Segment start point.
|
/// Segment start point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 Start;
|
public QuikVec2 Start;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start point control point.
|
/// Start point control point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 ControlA;
|
public QuikVec2 ControlA;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// End point control point.
|
/// End point control point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 ControlB;
|
public QuikVec2 ControlB;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Segment end point.
|
/// Segment end point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 End;
|
public QuikVec2 End;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -36,12 +66,12 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start point.
|
/// Start point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 Start;
|
public QuikVec2 Start;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// End point.
|
/// End point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 End;
|
public QuikVec2 End;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -52,12 +82,12 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rectangle minimum point.
|
/// Rectangle minimum point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 Min;
|
public QuikVec2 Min;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rectangle maximum point.
|
/// Rectangle maximum point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 Max;
|
public QuikVec2 Max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -69,17 +99,17 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ellipse center point.
|
/// Ellipse center point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 Center;
|
public QuikVec2 Center;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// First ellipse axis.
|
/// First ellipse axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 AxisA;
|
public QuikVec2 AxisA;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Second ellipse axis.
|
/// Second ellipse axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 AxisB;
|
public QuikVec2 AxisB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -90,16 +120,16 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// First vertex.
|
/// First vertex.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 A;
|
public QuikVec2 A;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Second vertex.
|
/// Second vertex.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 B;
|
public QuikVec2 B;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Third vertex.
|
/// Third vertex.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 C;
|
public QuikVec2 C;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user