Note that there are some explanatory texts on larger screens.

plurals
  1. POcocos2d 1.1 sprite for retina 4 inch iPhone5
    primarykey
    data
    text
    <p>I use cocos2d 1.1, xCode 4.5 for my game's progect. I would like to recode my game for support the iPhone 5. But I faced with problem: cocos2d 1.1 can't detected sprite for retina 4 inch.</p> <p>Default-568h@2x.png - work fine, but the game's sprites appears as *-hd.png. It seems cocos2d 1.1 can detected just *-hd.png, however I added the sprites *-568h@2x.png.</p> <p>Sorry for my English.</p> <p>The solving of this problem is in <strong>CCFileUtils.m</strong> file as written below <strong>sergio</strong>. </p> <p>I did the little changes in method <strong>+(NSString*) getDoubleResolutionImage:(NSString*)path</strong></p> <pre><code>+(NSString*) getDoubleResolutionImage:(NSString*)path { #if CC_IS_RETINA_DISPLAY_SUPPORTED if( CC_CONTENT_SCALE_FACTOR() == 2 ) { NSString *pathWithoutExtension = [path stringByDeletingPathExtension]; NSString *name = [pathWithoutExtension lastPathComponent]; NSString *extension = [path pathExtension]; if( [extension isEqualToString:@"ccz"] || [extension isEqualToString:@"gz"] ) { extension = [NSString stringWithFormat:@"%@.%@", [pathWithoutExtension pathExtension], extension]; pathWithoutExtension = [pathWithoutExtension stringByDeletingPathExtension]; } CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; if ([UIScreen mainScreen].scale == 2.f &amp;&amp; screenHeight == 568.0f) { if( [name rangeOfString:CC_RETINA4_DISPLAY_FILENAME_SUFFIX].location != NSNotFound ) { CCLOG(@"cocos2d: WARNING Filename(%@) already has the suffix %@. Using it.", name, CC_RETINA4_DISPLAY_FILENAME_SUFFIX); return path; } NSString *retinaName = [pathWithoutExtension stringByAppendingString:CC_RETINA4_DISPLAY_FILENAME_SUFFIX]; retinaName = [retinaName stringByAppendingPathExtension:extension]; if( [__localFileManager fileExistsAtPath:retinaName] ) { return retinaName; } } if( [name rangeOfString:CC_RETINA_DISPLAY_FILENAME_SUFFIX].location != NSNotFound ) { CCLOG(@"cocos2d: WARNING Filename(%@) already has the suffix %@. Using it.", name, CC_RETINA_DISPLAY_FILENAME_SUFFIX); return path; } NSString *retinaName = [pathWithoutExtension stringByAppendingString:CC_RETINA_DISPLAY_FILENAME_SUFFIX]; retinaName = [retinaName stringByAppendingPathExtension:extension]; if( [__localFileManager fileExistsAtPath:retinaName] ) { return retinaName; } CCLOG(@"cocos2d: CCFileUtils: Warning HD file not found: %@", [retinaName lastPathComponent] ); } #endif // CC_IS_RETINA_DISPLAY_SUPPORTED return path; } </code></pre> <p>and also add in file <strong>ccConfig.h</strong></p> <pre><code>#ifndef CC_RETINA4_DISPLAY_FILENAME_SUFFIX #define CC_RETINA4_DISPLAY_FILENAME_SUFFIX @"-568h@2x" #endif </code></pre> <p><strong>If someone have a notice, please write</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload