cocos2d iphone-4 Проблема обновления файлов изображений - PullRequest
0 голосов
/ 09 августа 2010

Вот мой код ...

CCSprite *u = [CCSprite spriteWithFile:@"1_S.png"  rect:CGRectMake(0, 0, 27, 27)];

            u.position = ccp((45.7*i+45.7*(i+1))/2, 467);
            u.tag = i;

            [self addChild:u];

и в моей папке ресурсов у меня есть 2 файла изображений с именем

1_S.png

и

1_S@2x.png

. Как я читал документ

https://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/SupportingResolutionIndependence/SupportingResolutionIndependence.html#//apple_ref/doc/uid/TP40007072-CH10

Я думаю, когда я запускаю этот код в iPhone 4, изображение называется

1_S@2x.png

должен загрузить ... но это не так ... загружается первое изображение ..... почему ?? ЭТА ЛЮБАЯ ВЕРСИЯ ПРОБЛЕМА ???

1 Ответ

1 голос
/ 09 августа 2010

в коде OS4 есть ошибка, препятствующая работе дисплея сетчатки с cocos2d

См. Ссылку по вопросу 910:

http://www.cocos2d -iphone.org / вики / doku.php / release_notes: 0_99_4 #

Issue #910 is still open.

The workaround is to edit CCTextureCache.m and make the following changes:

//# work around for issue #910
#if 0        // <---- change it to     #if 1
UIImage *image = [UIImage imageNamed:path];
tex = [ [CCTexture2D alloc] initWithImage: image ];
#else
// prevents overloading the autorelease pool
UIImage *image = [ [UIImage alloc] initWithContentsOfFile: fullpath ];
tex = [ [CCTexture2D alloc] initWithImage: image ];
[image release];
#endif //

Again, issue #910 is not a cocos2d bug, but an iOS4 bug. ”@2x” images are not loaded if you use UIImage initWithContentOffile (but the documentation says it should work). So the work around is to use UIImage imageNamed, but it is not enabled by default because it will consume much more memory.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...