It seems that in order to maintain proper physics (with Box2d) and sprite positioning I need to first know the screen dimensions. I would like to simply store the screen width and height in some variables in the beginning of the application to access it my other classes. I’m just not sure how to scope them correctly, along with any other information i need at startup. I am currently doing this everytime i need to position a sprite:
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint visibleOrigin = CCDirector::sharedDirector()->getVisibleOrigin();
float visibleRight = visibleSize.width + visibleOrigin.x;
float visibleTop = visibleSize.height + visibleOrigin.y;
This is sloppy to me. What is that best practice I am looking for? Thank you.