axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
922 stars 205 forks source link

i use FastTMXTiledMap to load 300*300 tile ,but it cannt display all #1300

Closed jcy1001 closed 1 year ago

jcy1001 commented 1 year ago

image

aismann commented 1 year ago

Any example source plz?

jcy1001 commented 1 year ago

FastTMXTiledMap pTiledmap=FastTMXTiledMap::create("TileMap/BattleMap/BattleMap2.tmx"); Layer layer = Layer::create(); layer->setPosition(_tileMap->getPosition()); layer->addChild(_tileMap, 0);

Size winSize = Director::getInstance()->getWinSize();  
m_pScrollView = axis::extension::ScrollView::create(winSize,NULL);
m_pScrollView->setMinScale(MIN_SCALE);
m_pScrollView->setMaxScale(MAX_SCALE);
this->addChild(m_pScrollView,0); 

just like this and

i found void FastTMXLayer::updateIndexBuffer() {

ifdef AX_FAST_TILEMAP_32_BIT_INDICES

unsigned int indexBufferSize = (unsigned int)(sizeof(unsigned int) * _indices.size());

else

unsigned int indexBufferSize = (unsigned int)(sizeof(unsigned short) * _indices.size());

endif

if (!_indexBuffer)
{
    auto device  = backend::Device::getInstance();
    _indexBuffer = device->newBuffer(indexBufferSize, backend::BufferType::INDEX, backend::BufferUsage::DYNAMIC);
}
_indexBuffer->updateData(&_indices[0], indexBufferSize);

}

indexBufferSize is unsigned int ,may it cause this problem??

aismann commented 1 year ago

@jcy1001 without any source example (300*300 tiles) neverone can give an answer.

rh101 commented 1 year ago

This is the same issue as #1306

300 x 300 tiles = 90,000 tiles, which is above the 16384 (128x128) tile limit in the TMX implementation.