Home Forums Community Projects Gaming and desktop mouse control with the Rex Reply To: Gaming and desktop mouse control with the Rex

#1018
Robert [Tobii]
Participant

Great that you are sharing and collaborating. I’ll add some helping instructions regarding the API changes.

Here is the code, currently written for EyeX Engine 0.8.3:
https://github.com/gigertron/EyeTracker

To update the MinimalGazeDataStream.cpp to latest EyeX Engine API, here are the steps:
1) Change type of hContext from TX_HANDLE to TX_CONTEXTHANDLE
2) On txInitializeSystem, add a fourth NULL parameter
3) On txReleaseContext, remove the last two parameters
4) Rename txCommitSnapshot to txCommitSnapshotAsync

5) Replace OnSnapshotCommitted with this snippet:

void TX_CALLCONVENTION OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param)
{
	// check the result code using an assertion.
	// this will catch validation errors and runtime errors in debug builds. in release builds it won't do anything.

	TX_RESULT result = TX_RESULT_UNKNOWN;
	txGetAsyncDataResultCode(hAsyncData, &result);
	assert(result == TX_RESULT_OK || result == TX_RESULT_CANCELLED);
}

6) Change the first part of HandleEvent (before the if statements) to:

void TX_CALLCONVENTION HandleEvent(TX_CONSTHANDLE hObject, TX_USERPARAM userParam)
{
	TX_HANDLE hEvent = TX_EMPTY_HANDLE;
	TX_HANDLE hBehavior = TX_EMPTY_HANDLE;

    txGetAsyncDataContent(hObject, &hEvent);

7) Change the last line of HandleEvent to

txReleaseObject(&hEvent);