-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAssetManager.cpp
51 lines (42 loc) · 901 Bytes
/
AssetManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "AssetManager.hpp"
namespace Sonar
{
void AssetManager::LoadTexture(std::string name, std::string fileName)
{
sf::Texture tex;
if (tex.loadFromFile(fileName))
{
this->_textures[name] = tex;
}
}
sf::Texture &AssetManager::GetTexture(std::string name)
{
return this->_textures.at(name);
}
/*void AssetManager::LoadMusic(std::string name, std::string fileName)
{
sf::Music music;
if (music.openFromFile(fileName))
{
this->_musics[name] = music;
}
}
sf::Music &AssetManager::GetMusic(std::string name)
{
return this->_musics.at(name);
}*/
void AssetManager::LoadFont(std::string name, std::string fileName)
{
sf::Font font;
if (font.loadFromFile(fileName))
{
this->_fonts[name] = font;
}
}
sf::Font &AssetManager::GetFont(std::string name)
{
return this->_fonts.at(name);
}
}