cocos2d和方向更改问题,纹理变形 [英] Problem with cocos2d and orientation changes, textures are deformed

查看:288
本文介绍了cocos2d和方向更改问题,纹理变形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用cocos2d v0.99.5-beta2,我只有在iPhone 1st和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)

这篇关于cocos2d和方向更改问题,纹理变形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆