【问题标题】:Problem with cocos2d and orientation changes, textures are deformedcocos2d和方向变化的问题,纹理变形
【发布时间】:2010-10-04 08:38:28
【问题描述】:

我正在使用 cocos2d v0.99.5-beta2,但我只在 iPhone 1st gen 和 iPhone 3g 上遇到了一个奇怪的问题。

当我改变 iPhone 的方向时,我所有的 CCSprite 都会变形和复制。 我已经测试了很多方法来旋转我的场景,但我总是得到相同的结果。

但我在模拟器、iPhone 4 和 iPad 上没有这个问题。

See screenshots

我想知道这是否与硬件有关。看起来图形硬件不支持方向更改。但这只是假设。

我希望有人可以帮助我。

【问题讨论】:

    标签: cocos2d-iphone


    【解决方案1】:

    不确定这是否会有所不同,但您是指定纹理的内容大小还是让 cocos2d 定义它?这里我使用的是 CCSprite (spuButton) 的子类:

    CCTexture2D *redButtonNormal = [[CCTextureCache sharedTextureCache] addImage:@"RedButtonNormal.png"];  //I don't specify the content size.
    
    spuButton *redButton = [spuButton spuButtonWithTexture:redButtonNormal];
            redButton.position = ccp(((size.width / 2) - (redButton.contentSize.width / 2)), ((size.height / 2) + (redButton.contentSize.height / 2)));
    
    [self addChild:redButton];
    

    希望这会有所帮助 8)

    【讨论】:

      猜你喜欢
      • 2011-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-12
      相关资源
      最近更新 更多