66 const std::string &ext,
76 static std::string
getPath(
const std::string &file);
128 const std::function<
Resource *()> &generator);
Stores a set of subimages originating from a single image.
Defines a class for loading and storing images.
Defines a class for loading and storing music.
A class for loading and managing resources.
ResourceRef< SpriteDef > getSprite(const std::string &path, int variant=0)
Loads a SpriteDef based on a given path and the supplied variant.
void remove(Resource *)
Removes a resource from the list of resources managed by the resource manager.
static ResourceManager * getInstance()
Returns an instance of the class, creating one if it does not already exist.
Resource * get(const std::string &idPath, const std::function< Resource *()> &generator)
Looks up a resource, creating it with the generator function if it does not exist.
ResourceRef< Music > getMusic(const std::string &path)
Loads the Music resource found at the given path.
std::map< std::string, Resource * > mResources
static ResourceManager * instance
~ResourceManager()
Destructor.
ResourceRef< SoundEffect > getSoundEffect(const std::string &path)
Loads the SoundEffect resource found at the given path.
static std::string getPath(const std::string &file)
Returns the real path to a file.
ResourceRef< Image > getImage(const std::string &idPath)
Loads the Image resource found at the given identifier path.
static void deleteInstance()
Deletes the class instance if it exists.
static void cleanUp(Resource *resource)
Deletes the resource after logging a cleanup message.
static void searchAndAddArchives(const std::string &path, const std::string &ext, bool append)
Searches for zip files and adds them to the search path.
void release(Resource *)
Releases a resource, placing it in the set of orphaned resources.
static bool addToSearchPath(const std::string &path, bool append)
Adds a directory or archive to the search path.
std::map< std::string, Resource * > mOrphanedResources
ResourceRef< ImageSet > getImageSet(const std::string &imagePath, int w, int h)
Loads a image set based on the image referenced by the given path and the supplied sprite sizes.
Automatically counting Resource reference.
A generic reference counted resource object.
Defines a class for loading and storing sound effects.
Defines a class to load an animation.