scale display


#1

in http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_does_cocos2d-x_support_multi-resolution it is said that you set the resolution and it will scale according to the display, but i don’t see that when testing on the simulator or a real device. the sprites stay the sime size on all devices, so how do i call the display fucntion?


#2

I get the same problem, no sprites are automatically scaled despite uncommenting ‘view->create(480, 320)’

Anyone know if this is broken?

Tyson


#3

my mistake was that i was changing view~~>setFrameWidthAndHeight; instead of view~~>create();, also it should only scale on android devices or emulator.


#4
float scale_mult;
switch ((int)size.height) {
case 320:
    scale_mult = 0.6;
    break;
case 240:
    scale_mult = 0.4;
    break;
default:
    scale_mult = 1;
    break;
}
this->setPosition(ccp((-(size.width - size.width*scale_mult)/2 + abs(800*scale_mult - size.width)/2),(-(size.height - size.height*scale_mult)/2+ abs(480*scale_mult - size.height)/2)));
this->setScale(scale_mult);

I used this :slight_smile: But set clear positions in project, like
back->setPosition(ccp(100,150))