Tobii Pro SDK C API
get_and_set_display_area.c
#include <stdio.h>
#include <string.h>
void get_display_area_example(TobiiResearchEyeTracker* eyetracker) {
TobiiResearchStatus status = tobii_research_get_display_area(eyetracker, &display_area);
char* serial_number;
tobii_research_get_serial_number(eyetracker, &serial_number);
printf("Got display area from tracker with serial number %s with status %i:\n", serial_number, status);
printf("Bottom Left: (%f, %f, %f)\n",
display_area.bottom_left.x,
display_area.bottom_left.y,
display_area.bottom_left.z);
printf("Bottom Right: (%f, %f, %f)\n",
display_area.bottom_right.x,
display_area.bottom_right.y,
display_area.bottom_right.z);
printf("Height: %f\n", display_area.height);
printf("Top Left: (%f, %f, %f)\n",
display_area.top_left.x,
display_area.top_left.y,
display_area.top_left.z);
printf("Top Right: (%f, %f, %f)\n",
display_area.top_right.x,
display_area.top_right.y,
display_area.top_right.z);
printf("Width: %f\n", display_area.width);
// To set the display area it is possible to either use a previously saved instance of
// the type TobiiResearchDisplayArea, or create a new one as shown below.
TobiiResearchDisplayArea new_display_area;
// For simplicity we are using the same values that are already set on the eye tracker.
memcpy(&new_display_area.top_left, &display_area.top_left, sizeof(display_area.top_left));
memcpy(&new_display_area.top_right, &display_area.top_right, sizeof(display_area.top_right));
memcpy(&new_display_area.bottom_left, &display_area.bottom_left, sizeof(display_area.bottom_left));
status = tobii_research_set_display_area(eyetracker, &new_display_area);
}