Cocos2d v3 Image Naming Conventions

369 Views Asked by At

I'm migrating my apps from cocos2d v2.x to v3.x, first of all I'm not going to use spritebuilder. so in 2.0 there were 4 different resolutions for every sprite.

sprite.png/iphone sprite-hd.png/iphone retina sprite-ipad.png/ipad sprite-ipadhd.png/ipad retina

the same approach as i see is not working for v3.0,the question is, what is the solution for v3.0? also tried to add the following code manually in app delegate, but no result

[[CCFileUtils sharedFileUtils] setiPadRetinaDisplaySuffix:@"-ipadhd"];
    [[CCFileUtils sharedFileUtils] setiPadSuffix:@"-ipad"];
    [[CCFileUtils sharedFileUtils] setiPhoneRetinaDisplaySuffix:@"-hd"];
2

There are 2 best solutions below

0
On BEST ANSWER

Found solution. To use custom sprites with spritebuilder , I've moved all my sprites to ccbResources folder and put them into appropriate subfolders. then to acces them I'm using [CCSprite spriteWithImageNamed:@"ccbResources/sprite.png"];

1
On

This is what i am doing with 3.2

NSDictionary *dic = [CCFileUtils sharedFileUtils].suffixesDict;
[dic setValue:@"-hd" forKey:CCFileUtilsSuffixDefault];
[dic setValue:@"-hd" forKey:CCFileUtilsSuffixiPhone] ;
[dic setValue:@"-hd" forKey:CCFileUtilsSuffixiPad];
[dic setValue:@"-hd" forKey:CCFileUtilsSuffixiPadHD];
[dic setValue:@"-hd" forKey:CCFileUtilsSuffixiPhoneHD];
[dic setValue:@"-hd" forKey:CCFileUtilsSuffixiPhone5];
[dic setValue:@"-hd" forKey:CCFileUtilsSuffixiPhone5HD];

put whatever suffix values are appropriate for your app.