Files
axyz/src/Engine/Rendering/Util/CommonFunctions.cpp
T
Tleety 53265bbc90 PNG is now a resource.
You can now load textures threaded.
PNG will now throw exceptions when errors happend
SpriteComponent is now working without billboarding.
2016-02-10 17:50:17 +01:00

20 lines
542 B
C++

#include "Rendering/Util/CommonFunctions.h"
Texture* CommonFunctions::LoadTexture(std::string path, bool threaded)
{
Texture* img;
try {
if(threaded) {
img = ResourceManager::Load<Texture, true>(path);
} else {
img = ResourceManager::Load<Texture, false>(path);
}
} catch (const Resource::StillLoadingException&) {
img = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
} catch (const std::exception&) {
img = nullptr;
}
return img;
}