#include <Resources.h>
Definition at line 15 of file Resources.h.
◆ ResourcesManager()
| IncrementalEngine::ResourcesManager::ResourcesManager |
( |
| ) |
|
◆ ~ResourcesManager()
| IncrementalEngine::ResourcesManager::~ResourcesManager |
( |
| ) |
|
|
virtual |
◆ GetResourceItem()
| HRESULT IncrementalEngine::ResourcesManager::GetResourceItem |
( |
ResourceItem & |
resourceItem, |
|
|
std::pair< const std::string, Json > |
item |
|
) |
| |
|
private |
Definition at line 75 of file Resources.cpp.
79 resourceItem = ResourceItem{
81 item.second[
"Type"].string_value(),
82 item.second[
"Fileroute"].string_value()
87 catch (
const std::exception& e)
89 std::string error =
"Item load failed. Check file structure. [" + (std::string)e.what() +
"]";
90 StringAsWCHAR_ptr(error,
Error);
91 return CO_E_ERRORINAPP;
◆ GetSound()
| Sound * IncrementalEngine::ResourcesManager::GetSound |
( |
std::string |
name | ) |
|
Definition at line 68 of file Resources.cpp.
71 assert(
"The Sound requested is not loaded." && item !=
_sounds.end());
◆ GetTexture()
| Texture * IncrementalEngine::ResourcesManager::GetTexture |
( |
std::string |
name | ) |
|
Definition at line 61 of file Resources.cpp.
64 assert(
"The Texture requested is not loaded." && item !=
_textures.end());
◆ Load()
| HRESULT IncrementalEngine::ResourcesManager::Load |
( |
| ) |
|
Definition at line 20 of file Resources.cpp.
22 std::ifstream t(PATH);
24 (std::istreambuf_iterator<char>(t)),
25 std::istreambuf_iterator<char>()
28 std::string error =
"";
33 StringAsWCHAR_ptr(error,
Error)
34 return CO_E_ERRORINAPP;
40 Error = L
"Resources load failed. Check file structure.";
41 return CO_E_ERRORINAPP;
45 for (
auto const& item : items)
47 ResourceItem resourceItem;
52 return CO_E_ERRORINAPP;
◆ LoadResource()
| void IncrementalEngine::ResourcesManager::LoadResource |
( |
ResourceItem |
item | ) |
|
|
private |
Definition at line 95 of file Resources.cpp.
97 if (item.Type ==
"Texture")
99 Texture* texture =
new Texture(item.Fileroute);
100 _textures.insert(
_textures.begin(), std::pair<std::string, Texture*>(item.Name, texture));
105 if (item.Type ==
"Sound")
107 Sound* sound =
new Sound(item.Fileroute);
109 _sounds.insert(
_sounds.begin(), std::pair<std::string, Sound*>(item.Name, sound));
◆ _loadedResources
| Json IncrementalEngine::ResourcesManager::_loadedResources = nullptr |
|
private |
◆ _sounds
| std::map<std::string, Sound*> IncrementalEngine::ResourcesManager::_sounds |
|
private |
◆ _textures
| std::map<std::string, Texture*> IncrementalEngine::ResourcesManager::_textures |
|
private |
◆ Error
| LPCWSTR IncrementalEngine::ResourcesManager::Error = L"" |