Home > Cocos2dx > CCX Extensions

CCX Extensions

Hey guys. I was pretty irritated by the fact that there was no NSNumber style class in cocos2dx. This made it impossible to use CCDictionary to transport ints and doubles.

To solve it, I wrote a small template class which is based on CCObject and can be used smoothly with CCDictionary and CCArray.


CCX Extensions


 CCXNumber<unsigned long long> *veryLong = CCXNumber<unsigned long long>::numberWithValue(13013123.2312132);

myCoolDict->setObject(veryLong, "key");


CCXNumber<unsigned long long> *storedLong = static_cast<CCXNumber<unsigned long long> *>(myCoolDict->objectForKey("key"));

CCLog("%llu", storedLong->getValue());

Have fun

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: