AssetStore.h 919 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * 2D Game Engine
  3. * AssetStore.h:
  4. * Based on pikuma.com 2D game engine in C++ and Lua course
  5. * Copyright (c) 2021 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 12/02/2021.
  8. */
  9. #ifndef GAMEENGINE_ASSETSTORE_H
  10. #define GAMEENGINE_ASSETSTORE_H
  11. #include <SDL.h>
  12. #include <SDL_ttf.h>
  13. #include <string>
  14. #include <map>
  15. class AssetStore
  16. {
  17. private:
  18. std::map<std::string, SDL_Texture *> textures;
  19. std::map<std::string, TTF_Font *> fonts;
  20. // Sounds
  21. public:
  22. AssetStore() = default;
  23. ~AssetStore() = default;
  24. void clearStore();
  25. void addTexture(SDL_Renderer *renderer, const std::string &assetId, const std::string &filePath);
  26. SDL_Texture *getTexture(const std::string &assetId);
  27. void addFont(const std::string &assetId, const std::string &filePath, uint32_t fontSize);
  28. TTF_Font *getFont(const std::string &assetId);
  29. };
  30. #endif /* GAMEENGINE_ASSETSTORE_H */