void NewUserDetected(XnUserID userId, void* pCookie) { std::cout << "New user detected with ID " << userId << std::endl; } xn::UserGenerator userGenerator; userGenerator.RegisterUserCallbacks(NewUserDetected, NULL);
void UserLost(XnUserID userId, void* pCookie) { std::cout << "User with ID " << userId << " is lost" << std::endl; } xn::UserGenerator userGenerator; userGenerator.RegisterUserCallbacks(NULL, NULL, UserLost, NULL);
void NewUserDetected(XnUserID userId, void* pCookie) { std::cout << "New user detected with ID " << userId << std::endl; } void UserLost(XnUserID userId, void* pCookie) { std::cout << "User with ID " << userId << " is lost" << std::endl; } xn::UserGenerator userGenerator; userGenerator.RegisterUserCallbacks(NewUserDetected, NULL, UserLost, NULL);In this example, both the NewUserDetected and UserLost functions are registered as callbacks for their respective events. The RegisterUserCallbacks function is part of the OpenNI library for C++.