Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef ResourceHandler_hpp
- #define ResourceHandler_hpp
- #include <SFML\\Graphics.hpp>
- #include <iostream>
- #include <filesystem>
- #include <string>
- class ResourceHandler
- {
- public:
- static std::vector<sf::Texture> ENTITIES;
- static void loadResources()
- {
- std::cout << "Loading Resource...\n";
- std::string path = "../resources/textures/entity";
- for (const auto &entry : std::filesystem::directory_iterator(path))
- {
- sf::Texture texture = sf::Texture();
- std::string filePath = entry.path().generic_string();
- if (texture.loadFromFile(filePath))
- {
- ENTITIES.push_back(texture);
- std::cout << "Loadedi: " << entry.path() << std::endl;
- }
- }
- std::cout << "Resource Loaded\n================================\n";
- }
- };
- #endif
Add Comment
Please, Sign In to add comment