void PictureBank::Impl::loadAtlas(const vfs::Path& filePath) { if( !filePath.exist() ) { Logger::warning( "PictureBank: cant find atlas " + filePath.toString() ); return; } VariantMap info = config::load( filePath ); vfs::Path texturePath = info.get( "texture" ).toString(); vfs::NFile file = vfs::NFile::open( texturePath ); Picture mainTexture; if( file.isOpen() ) { mainTexture = PictureLoader::instance().load( file ); } else { Logger::warning( "PictureBank: load atlas failed for texture" + texturePath.toString() ); mainTexture = Picture::getInvalid(); } //SizeF mainRectSize = mainTexture.size().toSizeF(); if( !info.empty() ) { VariantMap items = info.get( framesSection ).toMap(); for( auto& i : items ) { VariantList rInfo = i.second.toList(); Picture pic = mainTexture; Point start( rInfo.get( 0 ).toInt(), rInfo.get( 1 ).toInt() ); Size size( rInfo.get( 2 ).toInt(), rInfo.get( 3 ).toInt() ); pic.setOriginRect( Rect( start, size ) ); setPicture( i.first, pic ); } } }