PointerList<std::string>* PackageFile::GetAllFiles() { PointerList<std::string>* ret = new PointerList<std::string>(); this->ReadPackage(); auto it = entries->GetContainer()->begin(); while (it != entries->GetContainer()->end()) { DirectoryEntry* entry = (*it); ret->Add(entry->fileName); it++; } return ret; }
PointerList<BaseSprite*>* Spritesheet::ExtractSprites() { assert(this->ConfigFilePath != ""); assert(this->SpritesheetFilePath != ""); assert(this->Graphics != NULL); PointerList<BaseSprite*>* spriteList = new PointerList<BaseSprite*>(); XmlReader configReader = XmlReader(); configReader.LoadFile(this->ConfigFilePath); PointerList<XmlNode*>* nodes = configReader.FindNodes("sprite"); auto it = nodes->GetContainer()->begin(); while (it != nodes->GetContainer()->end()) { XmlNode* node = (*it); std::string spriteName = node->GetAttribute("n").AttributeValue; int spriteSubTextureX = std::atoi(node->GetAttribute("x").AttributeValue); int spriteSubTextureY = std::atoi(node->GetAttribute("y").AttributeValue); int spriteSubTextureW = std::atoi(node->GetAttribute("w").AttributeValue); int spriteSubTextureH = std::atoi(node->GetAttribute("h").AttributeValue); FRectangle subRec = FRectangle(spriteSubTextureX, spriteSubTextureY, spriteSubTextureW, spriteSubTextureH); BaseSprite* newSprite = Graphics->CreateSpriteInstance(); newSprite->Ident = spriteName; BaseTexture* newSpriteTexture = spritesheetTexture->GetSubTexture(subRec); newSprite->SetTexture(newSpriteTexture); newSpriteTexture->TextureName = spriteName; newSpriteTexture->TexturePath = this->SpritesheetFilePath; spriteList->Add(newSprite); it++; } nodes->Release(); delete(nodes); return spriteList; }
PointerList<std::string>* GameSettings::GetSettingsList() { PointerList<std::string>* settings = new PointerList<std::string>(); settings->Add(std::to_string(GameWindowHeight)); settings->Add(std::to_string(GameWindowHeight)); settings->Add(std::to_string(GameWindowHeight)); settings->Add(std::to_string(TileHeight)); settings->Add(std::to_string(TileWidth)); settings->Add(std::to_string(GridRowsCount)); settings->Add(std::to_string(GridColumnsCount)); return settings; }