问题描述
我遵循将平铺地图转换为 Retina 显示的指南,将宽度和高度的大小也更改为对象的两倍大小和位置.但是正常显示的结果与retina display的结果不一样,正常显示是正确的,但retina显示不正确
I follow guide of converting tile map for retina display by changing size of width and height to double size and position of object too. but the result on normal display is not same as retina display normal display is correct but retina display is not correct
这是非视网膜平铺地图
这是视网膜平铺贴图
我还在视网膜 .tmx 文件中添加了 -hd 后缀
I also add -hd suffix to retinal .tmx file
有什么问题吗?
推荐答案
我也发现cocos2D tile map有同样的问题,最后通过划分CC_CONTENT_SCALE_FACTOR解决了.在视网膜模式下,它提供 2.0.
Me also observed same problem with cocos2D tile map and finally resolved by dividing CC_CONTENT_SCALE_FACTOR. In retina mode it gives 2.0.
CCTMXObjectGroup *objects = [tileMap objectGroupNamed:NN_TILE_MAP_OBJECT_LAYER];
CGSize s = [[CCDirector sharedDirector] winSize];
NSMutableDictionary *newtonPos = [objects objectNamed:NN_NEWTON_POS];
if(newtonPos)
{
float x = ([[newtonPos valueForKey:@"x"] floatValue])/CC_CONTENT_SCALE_FACTOR();
float y = [[newtonPos valueForKey:@"y"] floatValue]/CC_CONTENT_SCALE_FACTOR();
MyGameScreen *p = (MyGameScreen*)self.parentLayer;
p.gameActor.position = ccp(x, y);
}
//我用这个函数来获取和弦..
//I used this function to get chord..
- (CGPoint)getTileCoordForPosition:(CGPoint)position
{
int maxTileCol = self.mapSize.height;
int x = ( (position.x-self.position.x)/TILE_SIZE);
int y = maxTileCol - ( ((position.y)-self.position.y)/TILE_SIZE);
if( x >= TILE_IN_ROW)
x = TILE_IN_ROW - 1;
if( y >= TILE_IN_COL)
y = TILE_IN_COL - 1;
return ccp(x, y);
}
这篇关于当我转换为视网膜显示时,瓷砖地图的位置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)