Pacman Torben Petré
Loading...
Searching...
No Matches
AssetManager.h
Go to the documentation of this file.
1#ifndef ASSETMANAGER_H
2#define ASSETMANAGER_H
3
4#include <SFML/Graphics/Texture.hpp>
5#include <SFML/Graphics/Font.hpp>
6#include <SFML/Audio.hpp>
7#include <unordered_map>
8
9
11public:
15 AssetManager(AssetManager &other) = delete;
16 void operator=(const AssetManager &) = delete;
17
22 [[nodiscard]] static AssetManager& getInstance();
23
24
29 [[nodiscard]] sf::Font& getFont();
30
31
36 [[nodiscard]] sf::Texture& getPacmanLogo();
37
42 [[nodiscard]] sf::Texture& getSpriteSheet();
43
44
49 void toggleEasterEgg(bool toggle);
50
51
61 [[nodiscard]] sf::SoundBuffer& getSoundBuffer(const std::string& name);
62
63private:
65
66 sf::Font font;
67
68 sf::Texture pacmanLogo;
69 sf::Texture spriteSheet;
70
71 sf::Texture easterEgg;
72 bool easterEggToggle = false;
73
74 // Cache of sf::SoundBuffers by filename.
75 std::unordered_map<std::string, sf::SoundBuffer> soundBuffers;
76};
77
78
79
80#endif //ASSETMANAGER_H
AssetManager(AssetManager &other)=delete
sf::Texture & getSpriteSheet()
Returns the Spritesheet.
Definition AssetManager.cpp:37
static AssetManager & getInstance()
Returns an instance of the AssetManager class.
Definition AssetManager.cpp:20
void operator=(const AssetManager &)=delete
sf::SoundBuffer & getSoundBuffer(const std::string &name)
Returns the sf::SoundBuffer of the file with the provided name.
Definition AssetManager.cpp:48
void toggleEasterEgg(bool toggle)
Toggle whether the regular or the easteregg spritesheet is used.
Definition AssetManager.cpp:43
sf::Texture & getPacmanLogo()
Returns the Pacman logo.
Definition AssetManager.cpp:33
sf::Font & getFont()
Returns the font used throughout the project.
Definition AssetManager.cpp:28