There is a sprite, I want to bind some var on it. From document I understand something, use the function "setUserData" and "getUserData". But there is some wrong.
float nums = 2.3f;
pSprite->setUserData((void*)nums); // wrong??
// how to get the var from pSprite. float some_float = *(pSprite->getUserData());??
User data stores a pointer so you will want to dynamically allocate the memory. Try something like this:
float* nums = new float(2.3f);
pSprite->setUserData((void*)nums);
...
float* data = (float*)pSprite->getUserData();
printf("%f", *data);
delete data;
Generally you create a struct that contains all of the data you want to store in the sprite. If you just wanted to store one number this will work. In either case make sure to delete the memory!