3

I am having a trouble. I am using cocos2d with UIKit. Cocos2d version is 1.0.1.

I have added tiled map to project like it is suggested in documentation: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:how_to_develop_retinadisplay_games_in_cocos2d#ccnode_details I have done everything, enabled retina, created hd map as said.

I later position some sprites relative to tile map, and I use tile map coordinate system to position them, so I use it's size and tile size.

On non-retina everything is positioned properly and works fine, but on retina everything is messed up. It looks like tile size of the tiled map is not in points but in pixels, so every calculations which are done are scaled twice, which is bad. I could divide calculations with CC_CONTENT_SCALE_FACTOR but that would require lot of calculating, and, as I understand, that is what cocos2d retina support should do under the hood.

Does somebody have an idea what should I do next, or maybe has some tutorial link where isometric tiled maps are added for both screen dimensions and that works ok?

4

1 回答 1

0

Cocos2D 的 tilemap 实现并不完全兼容 Retina。正如您所注意到的,即使在今天的 cocos2d 2.0 中,一些坐标也是以像素为单位的。除了除以内容比例因子之外别无他法。

这不应该是任何性能问题。您更大的性能问题将是 cocos2d 的无效 tilemap 渲染器,即 tilemap 越大,性能越慢,因为 cocos2d 每次都渲染所有瓦片。

于 2012-10-30T12:39:44.243 回答