Tile map中的坐标

今天看了一下cocos2d-x中的tile map的使用,在其中有一个TMXIsoObjectsTest类,它里面的draw函数是吧tile map中的object的坐标画在界面上

但是根据示例中的代码显示出来的方框和在tile map editor中看到的位置完全不一样。

请问应该怎么处理从object得到的坐标才能正确显示这些object呢。

具体代码如下:

void TMXIsoObjectsTest::draw()
{
CCTMXTiledMap map = (CCTMXTiledMap) getChildByTag(kTagTileMap);
CCTMXObjectGroup *group = map->objectGroupNamed(“Object Group 1”);

CCArray* objects = group->getObjects();
CCDictionary* dict;
CCObject* pObj = NULL;
CCARRAY_FOREACH(objects, pObj)
{
    dict = (CCDictionary*)pObj;//dynamic_cast<CCStringToStringDictionary*>(*it);


    if(!dict)
        break;
    const char* key = "x";
    int x = ((CCString*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("x"))->getNumber();
    key = "y";
    int y = ((CCString*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("y"))->getNumber();
    key = "width";
    int width = ((CCString*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("width"))->getNumber();
    key = "height";
    int height = ((CCString*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("height"))->getNumber();

    glLineWidth(3);

    ccDrawLine( ccp(x,y), ccp(x+width,y) );
    ccDrawLine( ccp(x+width,y), ccp(x+width,y+height) );
    ccDrawLine( ccp(x+width,y+height), ccp(x,y+height) );
    ccDrawLine( ccp(x,y+height), ccp(x,y) );

    glLineWidth(1);
}

}

程序效果运行如下:

![](file:///C:\Documents)

tile map editor显示如下

![](file:///C:\Documents)

求大神指导啊。