12345678910111213141516171819202122232425262728293031323334353637383940 |
- #ifndef OLC_PGE_RESOURCE_PACK
- #define OLC_PGE_RESOURCE_PACK
-
- #include <cstdint>
- #include <string>
- #include <map>
- #include <vector>
- #include <streambuf>
- #include <iostream>
- #include <fstream>
- #include "olcPGE_Common.h"
-
- namespace olc {
- class ResourcePack
- {
- public:
- ResourcePack();
- ~ResourcePack();
- struct sEntry : public std::streambuf {
- uint32_t nID, nFileOffset, nFileSize; uint8_t* data; void _config() { this->setg((char*)data, (char*)data, (char*)(data + nFileSize)); }
- };
-
- public:
- olc::rcode AddToPack(std::string sFile);
- olc::rcode RemoveFromPack(std::string sFile);
-
- public:
- olc::rcode SavePack(std::string sFile);
- olc::rcode LoadPack(std::string sFile);
- olc::rcode ClearPack();
-
- public:
- olc::ResourcePack::sEntry GetStreamBuffer(std::string sFile);
- std::vector<std::string> GetEntries();
-
- private:
- std::map<std::string, sEntry> mapFiles;
- };
- }
- #endif
|