SR Research Support Site
Data Fields
HOOKFCNS2 Struct Reference

Extended structure used set and get callback functions. More...

Data Fields

int major
 
int minor
 
void * userData
 
INT16(* setup_cal_display_hook )(void *userData)
 
INT16(* exit_cal_display_hook )(void *userData)
 
INT16(* setup_image_display_hook )(void *userData, INT16 width, INT16 height)
 
INT16(* image_title_hook )(void *userData, char *title)
 
INT16(* draw_image )(void *userData, INT16 width, INT16 height, byte *pixels)
 
INT16(* exit_image_display_hook )(void *userData)
 
INT16(* clear_cal_display_hook )(void *userData)
 
INT16(* erase_cal_target_hook )(void *userData)
 
INT16(* draw_cal_target_hook )(void *userData, float x, float y)
 
INT16(* play_target_beep_hook )(void *userData, EL_CAL_BEEP beep_type)
 
INT16(* get_input_key_hook )(void *userData, InputEvent *event)
 
INT16(* alert_printf_hook )(void *userData, const char *msg)
 

Detailed Description

Extended structure used set and get callback functions.

Structure used set and get callback functions so that the calibration graphics can be drawn.

/sa setup_graphic_hook_functions( )

Field Documentation

INT16( * alert_printf_hook) (void *userData, const char *msg)

Called by alert_printf( ). Defaults to the MessageBox( ) function, in Windows. Prints to standard error in macOS and Linux.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
msgThe message that is displayed.
Returns
0 upon success.
INT16( * clear_cal_display_hook) (void *userData)

Called to clear the calibration display.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
Returns
0 upon success.
INT16( * draw_cal_target_hook) (void *userData, float x, float y)

Call to draw a gaze target for calibration, validation or drift correction.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
xx-axis coordinate of the target.
yy-axis coordinate of the target.
Returns
0 upon success.
Remarks
The x and y values are relative to those that were sent to the tracker by the 'screen_pixel_coords' command.
INT16( * draw_image) (void *userData, INT16 width, INT16 height, byte *pixels)

Called to supply the image.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
widthwidth of the picture.
heightheight of the picture.
pixelspixels pointer to the pixel data. The size of the pixel data can be calculate by width*height*4. The image comes in RGBA(network order) format.
Returns
0 upon success.
INT16( * erase_cal_target_hook) (void *userData)

Erases the target that was drawn by the last call to draw_cal_target.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
Returns
0 upon success.
INT16( * exit_cal_display_hook) (void *userData)

Called to release the resources that are not used after calibration.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
Returns
0 upon success.
INT16( * exit_image_display_hook) (void *userData)

Called to notify when the camera setup is complete. Any resources that are allocated in setup_image_display( ) may be released by this function.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
Returns
0 upon success.
INT16( * get_input_key_hook) (void *userData, InputEvent *event)

Called to check for keyboard input.

Parameters
[in]userDataUser context data set on userData field of HOOKFCNS2.
[out]eventReturns the new state of the keyboard.
Returns
1 when a key changed state, otherwise 0. -1 on error.
Remarks
Special keys and modifiers should match the following code.

Special keys:

#define F1_KEY 0x3B00
#define F2_KEY 0x3C00
#define F3_KEY 0x3D00
#define F4_KEY 0x3E00
#define F5_KEY 0x3F00
#define F6_KEY 0x4000
#define F7_KEY 0x4100
#define F8_KEY 0x4200
#define F9_KEY 0x4300
#define F10_KEY 0x4400
#define PAGE_UP 0x4900
#define PAGE_DOWN 0x5100
#define CURS_UP 0x4800
#define CURS_DOWN 0x5000
#define CURS_LEFT 0x4B00
#define CURS_RIGHT 0x4D00
#define ESC_KEY 0x001B
#define ENTER_KEY 0x000D

One needn't change the modifier value when using SDL, as it will already match the desired value.

#define ELKMOD_NONE 0x0000
#define ELKMOD_LSHIFT 0x0001
#define ELKMOD_RSHIFT 0x0002
#define ELKMOD_LCTRL 0x0040
#define ELKMOD_RCTRL 0x0080
#define ELKMOD_LALT 0x0100
#define ELKMOD_RALT 0x0200
#define ELKMOD_LMETA 0x0400
#define ELKMOD_RMETA 0x0800
#define ELKMOD_NUM 0x1000
#define ELKMOD_CAPS 0x2000
#define ELKMOD_MODE 0x4000
INT16( * image_title_hook) (void *userData, char *title)

Called to update the image title.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
titleThe text that will be rendered and printed by the image.
Returns
0 upon success.
int major

Major version. At the moment the version number must be set to 1.

int minor

Minor version. At the moment the version number must be set to 0.

INT16( * play_target_beep_hook) (void *userData, EL_CAL_BEEP beep_type)

Called to signal audibly that a new target has been presented.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
beep_typeSpecifies what sound to play, from the EL_CAL_BEEP enumeration.
Returns
0 upon success.
INT16( * setup_cal_display_hook) (void *userData)

Called before any calibration routine is started to set up the calibration/validation display.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
Returns
0 upon success.
INT16( * setup_image_display_hook) (void *userData, INT16 width, INT16 height)

Initialises the resources that are required for camera setup.

Parameters
userDataUser context data set on userData field of HOOKFCNS2.
widthwidth of the source image to expect.
heightheight of the source image to expect.
Returns
-1 on failure
0 success with support for drawing single size camera images
1 success with support for drawing variable size camera images, for high resolution global camera images from newer EyeLink models.
void* userData

The value set here will be passed to every single call back functions.


Copyright ©2002-2026, SR Research Ltd.