10#include "galaxy/core/ServiceLocator.hpp"
27 auto& lua = core::ServiceLocator<sol::state>::ref();
40 auto fonts_type = lua.new_usertype<
resource::Fonts>(
"Fonts", sol::no_constructor);
51 auto soundcache_type = lua.new_usertype<
resource::SoundCache>(
"SoundCaches", sol::no_constructor);
62 auto musiccache_type = lua.new_usertype<
resource::MusicCache>(
"MusicCache", sol::no_constructor);
73 auto voicecache_type = lua.new_usertype<
resource::VoiceCache>(
"VoiceCache", sol::no_constructor);
84 auto videocache_type = lua.new_usertype<
resource::VideoCache>(
"VideoCache", sol::no_constructor);
95 auto prefabs_type = lua.new_usertype<
resource::Prefabs>(
"Prefabs", sol::no_constructor);
106 auto scripts_type = lua.new_usertype<
resource::Scripts>(
"Scripts", sol::no_constructor);
117 auto shaders_type = lua.new_usertype<
resource::Shaders>(
"Shaders", sol::no_constructor);
128 auto textures_type = lua.new_usertype<
resource::Textures>(
"Textures", sol::no_constructor);
Cache for resources such as audio, fonts, etc.
void clear()
Destroy resources.
void load(const std::string &file)
Load a resource.
std::size_t size() const
Get amount of resources cached.
void insert(std::string_view id, std::unique_ptr< Resource > &resource)
Insert a resource directly into the cache.
void load_folder(const std::string &dir)
Load resources of a specific type.
bool has(std::string_view id)
Check if a resource exists.
Resource * get(std::string_view id)
Retrieve a resource.
const meta::vector< std::string > & keys()
Get a list of keys in the cache.
bool empty() const
Does the cache have any resources.