2021-12-29 15:59:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
namespace kku
|
|
|
|
{
|
|
|
|
|
|
|
|
template <typename Resource, typename Id>
|
|
|
|
class ResourceHolder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline void load(Id id, std::unique_ptr<Resource>&& resource) noexcept
|
|
|
|
{
|
|
|
|
_resources[id] = std::move(resource);
|
|
|
|
}
|
|
|
|
|
2022-03-10 18:45:19 +01:00
|
|
|
inline std::shared_ptr<Resource> get(Id id) const
|
2021-12-29 15:59:18 +01:00
|
|
|
{
|
|
|
|
return _resources.find(id)->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::map<Id, std::shared_ptr<Resource>> _resources;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace Font
|
|
|
|
{
|
|
|
|
enum class Id
|
|
|
|
{
|
|
|
|
GUI
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-03-10 18:45:19 +01:00
|
|
|
namespace Texture
|
|
|
|
{
|
|
|
|
enum class Id
|
|
|
|
{
|
|
|
|
GUI
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace GUISprite
|
|
|
|
{
|
|
|
|
enum class Id
|
|
|
|
{
|
|
|
|
SFML_LOGO,
|
|
|
|
CRYPTOPP_LOGO
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|