modify entire game to use class based structure

This commit is contained in:
2025-11-07 22:23:37 -05:00
parent f047348937
commit a2b7d62971
16 changed files with 622 additions and 467 deletions
+61
View File
@@ -0,0 +1,61 @@
#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H
#include <SFML/Graphics/Font.hpp>
#include <map>
#include <vector>
#include <filesystem>
#include <memory>
#include <SFML/Graphics/Texture.hpp>
//#include <SFML/Audio/SoundBuffer.hpp>
#include "MazeMap.h"
class ResourceManager {
public:
ResourceManager() : textureTileSize(8) {};
bool loadTexture(const std::string& textureName, const std::filesystem::path& texturePath);
bool loadFont(const std::string& fontName, const std::filesystem::path& fontPath);
bool loadMap(const std::string& mapName, const std::filesystem::path& mapPath);
//bool loadSound(const std::filesystem::path& soundPath);
sf::Texture& getTexture(const std::string& textureName) {
return *textures[textureName];
};
void resizeTexture(const std::string& textureName, unsigned int newTextureTileSize);
std::vector<int>& getMazeMap() {
return mazeMap;
}
std::vector<int>& getPelletMap() {
return pelletMap;
}
//load gameplay info
private:
//textures and sprites
std::map<std::string, std::unique_ptr<sf::Texture>> textures;
const int textureTileSize;
//fonts
std::map<std::string, sf::Font> fonts;
//sounds
//std::map<std::string, sf::SoundBuffer> sounds;
//map
std::vector<int> mazeMap;
std::vector<int> pelletMap;
//gameplay info (speeds, scores, etc.)
};
#endif