CCTransition scale bug?

CCTransition scale bug?
0.0 0


when CCTranstionScene::finish()
it will reset scale (and other propoties )

if a scene init with scale, then it occor a bug by reset, because the size is not what we want.


I’m not very clear about this, for I haven’t set the scale to CCScene.
The code you mentioned is the same in cocos2d-iphone & cocos2d-x.

Can you post your source I can reproduce this bug, and attach a screenshot?


i created a globalfucntion singleton with the function

void GlobalFunctions::reScaleScene( cocos2d::CCNode *tempScene ){
    tempScene->setScaleX( getScaleX() );
    tempScene->setScaleY( getScaleY() );
    tempScene->setAnchorPoint( ccp( 0, 0 ) );
    tempScene->setPosition( ccp( 0, 0 ));

float GlobalFunctions::getScaleX(){
    return CCDirector::sharedDirector()->getWinSize().width / 320;

float GlobalFunctions::getScaleY(){
    return CCDirector::sharedDirector()->getWinSize().height / 480;

used to scale game into full screen for all devices.
( by the way, i try to use contentScale function for this, failed )

Then i call
GlobalFunctions::reScaleScene( this );
in anyScene init(), before return

but if i CCTransition to show the scene,
CCDirector::sharedDirector()->replaceScene( CCTransitionFade::transitionWithDuration( SCENE_TRANSITION_TIME, MyScene::node() ) );

the scene will show but scale to 1.0 right away.

there is a another bug,
if i hide a sprite out of scene area, when i use CCTranstionSlideInL or some other methods, the hidden sprite will show out during the transition duration.


Sorry for the late reply.

Cocos2d-x has its mechanism of auto-scale for different resolutions on Android, win32, wophone, and inherit the hd design from cocos2d-iphone for iOS. Please read this wiki page ]. If you’re developing on android, you can simply enable this line in MyGame/android/jni/helloworld/main.cpp
>create(480,320); // in older versions, create(320,480);

to open the auto-scale mechanism in engine. It will works on all platforms besides iOS.

Setting scale to scenes, layers & sprites manually is not a good way to do the multi-resolution support, we do this job just before each frame rendering, so the coordinations don’t need to re-calculate. Or you can play with the CCCamera, e.g. Don’t forget cocos2d is created in the 3D world.

And the lastest bug you mentioned, it’s designed as-is. Nodes out of screen will not be hide automatically by the engine. If you want to hide them, please write a schedule function to do conditional judgment in it.