-
tanmayLikes 0Problem Description
I have two sprites in my cocos2dx project, a background image and a logo. Instead of resizing these two resources for each of the devices, I want to keep only a single version of them, in HD but I want them to be scaled according to the device resolution. This is what I’ve been doing:
bg = Sprite::create("Splash_Screen_BG.png"); bg->setPosition(Point((visibleSize.width/2) + origin.x,(visibleSize.height/2) + origin.y)); bg->setScale(visibleSize.width / bg->getContentSize().width, visibleSize.height / bg->getContentSize().height); logo = Sprite::create("Splash_Logo.png"); logo->setPosition(Point((visibleSize.width/2) + origin.x,220)); this->addChild(bg); this->addChild(logo);
The background, bg scales properly on any device but the logo doesn’t. i.e. When the project is run on a 240x320 android emulator the logo looks huge and it looks way smaller on a 1080x1920 device because the logo size always remains the same and doesn’t scale. How can I make the logo scale automatically regardless of whatever size of device the application is running on?
-
Sonar Systems adminLikes 1
Which tutorial series did you use for this method?
-
tanmayLikes 0
Yours of course. Cocos 2dx V3 C++. You used seperate resources for each of the iDevices. But what if I wanted to use the same resource on any device?
-
Sonar Systems adminLikes 0
That method is now outdated and we now have an improved method, check this series out http://www.sonarlearning.co.uk/coursepage.php?topic=game&course=cocos2d-x-multi-device-2
Login to reply