Add more useful stuff into frames.
This commit is contained in:
parent
2e07b0ffc9
commit
78c71054b4
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Quik.CommandMachine
|
namespace Quik.CommandMachine
|
||||||
@ -61,6 +62,18 @@ namespace Quik.CommandMachine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FrameType Type => _type;
|
||||||
|
|
||||||
|
public int I1 => _i1;
|
||||||
|
public int I2 => _i2;
|
||||||
|
public int I3 => _i3;
|
||||||
|
public int I4 => _i4;
|
||||||
|
|
||||||
|
public float F1 => _f1;
|
||||||
|
public float F2 => _f2;
|
||||||
|
public float F3 => _f3;
|
||||||
|
public float F4 => _f4;
|
||||||
|
|
||||||
public static Frame None { get; } = new Frame() {
|
public static Frame None { get; } = new Frame() {
|
||||||
_type = FrameType.None
|
_type = FrameType.None
|
||||||
};
|
};
|
||||||
@ -185,6 +198,32 @@ namespace Quik.CommandMachine
|
|||||||
return (T)_object;
|
return (T)_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float GetF(int i)
|
||||||
|
{
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 0: return _f1;
|
||||||
|
case 1: return _f2;
|
||||||
|
case 2: return _f3;
|
||||||
|
case 3: return _f4;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetI(int i)
|
||||||
|
{
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 0: return _i1;
|
||||||
|
case 1: return _i2;
|
||||||
|
case 2: return _i3;
|
||||||
|
case 3: return _i4;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static explicit operator int(in Frame frame) => frame._i1;
|
public static explicit operator int(in Frame frame) => frame._i1;
|
||||||
public static explicit operator float(in Frame frame) => frame._f1;
|
public static explicit operator float(in Frame frame) => frame._f1;
|
||||||
public static explicit operator Command(in Frame frame) => (Command)frame._i1;
|
public static explicit operator Command(in Frame frame) => (Command)frame._i1;
|
||||||
|
Loading…
Reference in New Issue
Block a user