I am new to cocos2dx. I played around with some samples and now want to write an own game. Because I would like to deploy my game to many devices as possible, my aim is to stay as resolution independent as possible. For this purpose, I just want to work with my own game units (like you can do it in OpenGL), so that I do not have to think in pixels (and just have to choose the appropriate resource resolution). Unfortunately, every example for cocos2dx works/thinks with pixels (this includes [[Multi_resolution_support]] article) and my own tries to get it to work just did not work.
I tried to achieve it by setting up my coordinate system via a design resolution:
CCEGLView* view = CCEGLView::sharedOpenGLView();
view->setDesignResolutionSize( 16, 10, kResolutionShowAll );
and when loading sprites setting their content size and position to e.g.
CCSprite* pSprite = CCSprite::create( "HelloWorld.png" );
pSprite->setContentSize( CCSize( 4.8f, 3.2f ) );
pSprite->setPosition( ccp( 16/2, 10/2 ) );
this->addChild( pSprite, 0 );
The result of a black/grey screen is attached, I get it on linux as on android. Can you help me? Where is my logic error or does the rendering mechanism of cocos2d-x not allow this? I am working with the latest 2.1.1 version.
I also attached the two important complete source files which I adapted from the HelloWorld example. Since I was not able to attach more than one file (clicking the button did not work) I put them all together in an archive.
Thank you in advance If something is not clear enough, do not hesitate to ask!
source and screenshot.tar.gz.zip (31.9 KB)