Cocos2d v.2 to v.3: All my resources scale up like

2019-09-08 02:55发布

问题:

I´ve just created an new cocos2d 3.3 project using SpriteBuilder. I imported my art resources and code from my cocos2d v2 project and got it to run, but all my resources scale up to about 3x their original size and the positions I set seems to be and all touch handling seems to be broken.

I only have one sprite sheet and it does not have any suffix (like -hd). I´ve commented out [CCBReader configureCCFileUtils]; in AppDelegate.m but that didn´t change anything.

Do I have to add a suffix or place my art in a special folder to make it work like before? I´m not actually using SpriteBuilder, just created the project with it.

回答1:

When not using SpriteBuilder you should comment out [CCBReader configureCCFileUtils] in AppDelegate.m as you have done already.

The following suffixes should work:

  • "-ipad", non-retina iPad
  • "-ipadhd", retina iPad
  • "-hd", retina iPhone
  • "-iphone5hd", iPhone 5+
  • no suffix, non-retina iPhone (will get upsized on higher resolution devices)
  • "-iphone5", non-retina assets used for iPhone 5+ if no "-iphone5hd"

Since you don't have a suffix and it's looking upscaled, I suspect you may have originally hardcoded a scale factor to use assets meant for a retina device. Try adding -hd to your sprite sheet.