cocos2d和方向变化的问题,纹理变形 [英] Problem with cocos2d and orientation changes, textures are deformed
问题描述
我正在使用 cocos2d v0.99.5-beta2,我只在 iPhone 1st gen 和 iPhone 3g 上遇到了一个奇怪的问题.
I'm using cocos2d v0.99.5-beta2 and I have a strange problem only on iPhone 1st gen and iPhone 3g.
当我改变 iPhone 的方向时,我所有的 CCSprite 都会变形和复制.我已经测试了许多旋转场景的方法,但我总是得到相同的结果.
When I change iPhone's orientation all my CCSprite are deformed and duplicated. I already have tested many methods to rotate my scene but I always have the same result.
但我在模拟器、iPhone 4 和 iPad 上没有这个问题.
But I haven't this problem on simulator, iPhone 4 and iPad.
我想知道这是否与硬件有关.看起来图形硬件不支持方向更改.但这只是假设.
I wonder if it's not a problem linked to the hardware. It looks like as the graphic hardware doesn't support orientation changes. But it's only suppositions.
我希望有人可以帮助我.
I hope someone can help me.
推荐答案
不确定这是否会有所不同,但您是指定纹理的内容大小还是让 cocos2d 定义它?这里我使用的是 CCSprite (spuButton) 的子类:
Not sure if this will make a difference but are you specifying the content size of the texture or are you letting cocos2d define it? Here I am using a subclass of 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)
Hope this helps 8)
这篇关于cocos2d和方向变化的问题,纹理变形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!