using UnityEngine;
namespace Tobii.Research.CodeExamples
{
class IEyeTracker_GetAndSetDisplayArea
{
public static IEnumerator Execute(IEyeTracker eyeTracker)
{
if (eyeTracker != null)
{
PrintDisplayArea(eyeTracker);
yield break;
}
}
private static void PrintDisplayArea(IEyeTracker eyeTracker)
{
DisplayArea displayArea = eyeTracker.GetDisplayArea();
"Got display area from tracker with serial number {0} with height {1}, width {2} and coordinates:",
eyeTracker.SerialNumber,
displayArea.Height,
displayArea.Width));
Debug.Log(
string.Format(
"Bottom Left: ({0}, {1}, {2})",
displayArea.BottomLeft.X, displayArea.BottomLeft.Y, displayArea.BottomLeft.Z));
Debug.Log(
string.Format(
"Bottom Right: ({0}, {1}, {2})",
displayArea.BottomRight.X, displayArea.BottomRight.Y, displayArea.BottomRight.Z));
Debug.Log(
string.Format(
"Top Left: ({0}, {1}, {2})",
displayArea.TopLeft.X, displayArea.TopLeft.Y, displayArea.TopLeft.Z));
Debug.Log(
string.Format(
"Top Right: ({0}, {1}, {2})",
displayArea.TopRight.X, displayArea.TopRight.Y, displayArea.TopRight.Z));
DisplayArea displayAreaToSet = new DisplayArea(displayArea.TopLeft, displayArea.BottomLeft, displayArea.TopRight);
eyeTracker.SetDisplayArea(displayAreaToSet);
}
}
}