我在使用 .pvr.ccz 格式时遇到问题。我有一个简单的 Sprite 表,上面有一些由TexturePacker 创建的 Sprite 。它的加载方式如下面的示例代码所示。
@implementation MainScene
- (id)init
{
// Apple recommend assigning self with supers return value
self = [super init];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"spritesheet.plist"];
CCSprite * sprite = [CCSprite spriteWithSpriteFrame:[CCSpriteFrame frameWithImageNamed:@"play-button.png"]];
sprite.position = ccp(0.5, 0.5);
sprite.positionType = CCPositionTypeNormalized;
[self addChild:sprite];
// done
return self;
}
@end
Sprite 表已加载,但我在控制台中没有收到任何警告或错误。但不知何故, Sprite (play-button.png)首先是模糊的,其次它在 Sprite 表上的位置错误(所以它是另一个 Sprite 的一半,而不是播放按钮)。
在TexturePacker中我选择了以下选项:
我读了很多关于使用 pvr.ccz 优点的文章。我用的是cocos2d 3.5版本。那么我是否遗漏了代码中的某些内容,或者Texturepacker 中是否有选项?
最佳答案
在某个时间点(内存故障),cocos2d 和 TP 将 .pvr 格式(生成和读取)更改为正常的“翻转”版本。因此,只需在 TP 中选中Flip PVR
复选框,渲染就应该没问题。
关于objective-c - Cocos2d - 使用TexturePacker创建的.pvr.ccz spritesheet(位置不正确,模糊)的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38038681/