Cocos2d-x背景图像显示不正确 [英] Cocos2d-x Background image is not displaying properly

查看:143
本文介绍了Cocos2d-x背景图像显示不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Cocos2dx 3.0 alpha的新手,并将我的游戏从Corona SDK转换为Cocos2d-x 3.0 alpha. 我正在显示这样的背景图像.

i am new to Cocos2dx 3.0 alpha and converting my game from Corona SDK to Cocos2d-x 3.0 alpha. I am displaying a background image like this.

auto sprite = Sprite::create("bg.png");
sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
this->addChild(sprite, 0);

但是图像在iOS模拟器中失真了.我也在控制台中收到了这3条警告.我正在显示3张图像,因此每张图像可能会发出1条警告.

But the image is distorted in iOS simulator. I also get these 3 warnings in console. May be 1 warning for each image, as i am displaying 3 images.

libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile

以下是屏幕截图.

这是实际图像.

感谢您的帮助.

推荐答案

我认为这是因为bg.png尺寸的比例与designResolutionSize比例不匹配.您的bg.png尺寸为512x256,而iPhone屏幕尺寸为480x320.因此,我假设您将设计分辨率大小设置为iphone(480x320),因此背景图像无法正确显示.尝试将设计分辨率的大小更改为bg.png的大小,或调整bg.png的大小以匹配您的设计分辨率的大小.有关设计分辨率大小和/或多分辨率支持的更多信息,请访问以下Wiki页面:单击我

I think it is because your bg.png dimension's ratio does not match with your designResolutionSize ratio. Your bg.png has a dimension of 512x256 while iphone screen has 480x320. So I assume that you set your design resolution size to that of iphone (480x320) hence your background image is not displaying properly. Try changing the design resolution size to the size of your bg.png or resize your bg.png to match your design resolution size. For more info about design resolution size and/or multi resolution support visit this wiki page: click me

希望这会有所帮助.

这篇关于Cocos2d-x背景图像显示不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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