0
votes

I have a conceptual question about the use if CCDirector and other shared Cocos2d-x objects.

One common thing that is always done is:

CCSize s = CCDirector::sharedDirector()->getWinSize();

I usually just pass s around where needed instead of re-calling CCDirector::sharedDirector()->getWinSize();

Is this what others do? Or do they just re-issue the call where needed?

is there a cost benefit to passing around versus just calling it where needed?

1

1 Answers

0
votes
#define MIDSCREEN  ccp(CCDirector::sharedDirector()->getWinSize().width/2, CCDirector::sharedDirector()->getWinSize().height/2)
#define WINSIZE    CCDirector::sharedDirector()->getWinSize()
#define WINHEIGHT  CCDirector::sharedDirector()->getWinSize().height
#define WINWIDTH   CCDirector::sharedDirector()->getWinSize().width