objective-c - Cocos2d - 使用TexturePacker创建的.pvr.ccz spritesheet(位置不正确,模糊)的问题

标签 objective-c iphone cocos2d-iphone textures texturepacker

我在使用 .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中我选择了以下选项:

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/

相关文章:

ios - 如何在没有类名的情况下推送下一类而不是在 iOS 中使用 NSString?

ios - 夏令时 UIDatePicker 问题

c++ - 如何将NSData转换成OpenCV的图像(Mat)

objective-c - 不使用 NSDateFormatter 将日期转换为字符串

iphone - 将新字典添加到我的 plist 文件中

iPhone - 更改应用程序内 info.plist 指向的应用程序图标?

iphone - Cocos2d iPhone 中的 NSNotification

iphone - CGContextSetRGBFillColor 不工作

ios - 在多个 UIViewController 中使用 Cocos2D 时帧率明显下降

iphone - 在 iphone SDK 中通过 popover 的表格行关闭模态视图