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