Small fixes in the command engine components.

This commit is contained in:
H. Utku Maden 2023-06-29 10:31:28 +03:00
parent 5c71afe9c7
commit 46c18d97d2
3 changed files with 19 additions and 11 deletions

@ -16,12 +16,12 @@ namespace Quik.CommandMachine
private Command _customCommandBase = Command.CustomCommandBase;
private readonly List<QuikCommandHandler> _customCommands = new List<QuikCommandHandler>();
public QuikRectangle Viewport { get; }
public QuikRectangle Viewport => _viewport;
// TODO: Make a real matrix class.
public float[] ActiveTransforms { get; }
public StyleStack Style { get; }
public StyleStack Style { get; } = new StyleStack(new Quik.Style());
protected CommandEngine()
{
@ -106,7 +106,7 @@ namespace Quik.CommandMachine
{
}
private void Reset()
public virtual void Reset()
{
_zIndex = 0;
_zStack.Clear();

@ -27,7 +27,7 @@ namespace Quik.CommandMachine
[FieldOffset(sizeof(FrameType) + 3*sizeof(float))]
private float _f4;
[FieldOffset(sizeof(FrameType))]
[FieldOffset(24)]
private object _object;
public bool IsCommand => _type == FrameType.Command;
@ -37,10 +37,10 @@ namespace Quik.CommandMachine
_type == FrameType.IVec3 ||
_type == FrameType.IVec4;
public bool IsFloat =>
_type == FrameType.IVec1 ||
_type == FrameType.IVec2 ||
_type == FrameType.IVec3 ||
_type == FrameType.IVec4;
_type == FrameType.Vec1 ||
_type == FrameType.Vec2 ||
_type == FrameType.Vec3 ||
_type == FrameType.Vec4;
public int VectorSize
{
@ -73,13 +73,15 @@ namespace Quik.CommandMachine
public float F2 => _f2;
public float F3 => _f3;
public float F4 => _f4;
public static Frame None { get; } = new Frame() {
_type = FrameType.None
};
public Frame(Command command) : this((int)command)
public Frame(Command command) : this()
{
_type = FrameType.Command;
_i1 = (int)command;
}
public Frame(object o)

@ -24,6 +24,12 @@ namespace Quik.VertexGenerator
Color = Style.Color ?? QuikColor.White,
};
public override void Reset()
{
base.Reset();
DrawQueue.Clear();
}
protected override void ChildProcessCommand(Command name, CommandQueue queue)
{
base.ChildProcessCommand(name, queue);
@ -473,7 +479,7 @@ namespace Quik.VertexGenerator
DrawQueue.AddVertex(v);
DrawQueue.AddElement(0); DrawQueue.AddElement(1); DrawQueue.AddElement(2);
DrawQueue.AddElement(1); DrawQueue.AddElement(2); DrawQueue.AddElement(3);
DrawQueue.AddElement(0); DrawQueue.AddElement(2); DrawQueue.AddElement(3);
if (radius == 0.0f)
return;