namespace dk { ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- template Tyler::Tyler (const coords& parSize, const coords& parTileSize) : m_size(parSize), m_tilesize(parTileSize) { assert(m_size.x() > 0 and m_size.y() > 0); } ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- template typename Tyler::coords::value_type Tyler::tiles_count() const { typename coords::value_type retval = 1; for (size_t d = 0; d < D; ++d) { retval *= m_size[d]; } return retval; } ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- template template Layer& Tyler::push_layer (TileMapData& parTilemap) { auto newLayer = new Layer(m_tilesize, m_tilesize, parTilemap); DK_ASSERT(newLayer->mapSize() == m_size); DK_ASSERT(newLayer->count() == m_size); m_layers.push_back(LayerPtr(newLayer)); return *newLayer; } ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- template template Layer& Tyler::push_layer (TileMapData& parTilemap, const coords& parSubdiv) { auto newLayer = new Layer(m_tilesize / parSubdiv, m_tilesize, parTilemap); DK_ASSERT(newLayer->mapSize() == m_size); DK_ASSERT(newLayer->count() == m_size * parSubdiv); m_layers.push_back(LayerPtr(newLayer)); return *newLayer; } ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- template void Tyler::preload (const coords& parFrom, const coords& parTo) { std::cout << "Looping through layers askin' for " << parFrom << " to " << parTo << "\n"; for (auto& layer : m_layers) { layer->preload(parFrom, parTo); } } } //namespace dk