No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

olcPGE_ResourcePack.h 892B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef OLC_PGE_RESOURCE_PACK
  2. #define OLC_PGE_RESOURCE_PACK
  3. #include <cstdint>
  4. #include <string>
  5. #include <map>
  6. #include <vector>
  7. #include <streambuf>
  8. #include <iostream>
  9. #include <fstream>
  10. #include "olcPGE_Common.h"
  11. namespace olc {
  12. class ResourcePack
  13. {
  14. public:
  15. ResourcePack();
  16. ~ResourcePack();
  17. struct sEntry : public std::streambuf {
  18. uint32_t nID, nFileOffset, nFileSize; uint8_t* data; void _config() { this->setg((char*)data, (char*)data, (char*)(data + nFileSize)); }
  19. };
  20. public:
  21. olc::rcode AddToPack(std::string sFile);
  22. olc::rcode RemoveFromPack(std::string sFile);
  23. public:
  24. olc::rcode SavePack(std::string sFile);
  25. olc::rcode LoadPack(std::string sFile);
  26. olc::rcode ClearPack();
  27. public:
  28. olc::ResourcePack::sEntry GetStreamBuffer(std::string sFile);
  29. std::vector<std::string> GetEntries();
  30. private:
  31. std::map<std::string, sEntry> mapFiles;
  32. };
  33. }
  34. #endif