Home › Forums › Community Projects › Streaming & Recording with Tobii Ghost › Reply To: Streaming & Recording with Tobii Ghost
25/05/2016 at 11:52 #5243
Alex [Tobii]
Participant
You should create it
private void Init()
{
_settings = new Settings(Color.FromArgb(200,236,0,136), false, Shape.SolidCircle, 0.07f, 0.5f, 0.75f);
_mmf = MemoryMappedFile.CreateOrOpen(MemoryFileName, Marshal.SizeOf(typeof(Settings)), MemoryMappedFileAccess.ReadWrite);
_accessor = _mmf.CreateViewAccessor(0, Marshal.SizeOf(typeof (Settings)));
}
private void MapMemory()
{
_accessor.Write(0, ref _settings);
}
private void Dispose()
{
_accessor.Dispose();
_mmf.Dispose();
}
public enum Shape: int
{
SolidCircle = 0,
Bubble = 1,
Inverted = 2
}
public struct Settings
{
public bool Offscreen;
public float R;
public float G;
public float B;
public float A;
public Shape Shape;
public float Size;
public float Trail;
public float Filtering;
public Settings(Color color, bool offscreen, Shape shape, float size, float trail, float filtering)
{
R = color.R / 255.0f;
G = color.G / 255.0f;
B = color.B / 255.0f;
A = color.A / 255.0f;
Offscreen = offscreen;
Shape = shape;
Size = size;
Trail = trail;
Filtering = filtering;
}
public void SetColor(Color color)
{
R = color.R / 255.0f;
G = color.G / 255.0f;
B = color.B / 255.0f;
A = color.A / 255.0f;
}
public Color GetColor()
{
return Color.FromArgb((byte) (A*255.0f), (byte) (R*255.0f), (byte) (G*255.0f), (byte) (B*255.0f));
}
}