Predefined key class for sf::Music resources. More...
Static Public Member Functions | |
static MusicKey | FromFile (const std::string &fileName, const std::string &tag="") |
Open sf::Music from file name. | |
static MusicKey | FromMemory (const void *data, std::size_t size, const std::string &tag="") |
Open sf::Music from file in memory. | |
static MusicKey | FromStream (sf::InputStream &stream, const std::string &tag="") |
Open sf::Music from input stream. | |
Public Member Functions | |
MovedPtr< sf::Music, NoCopy > | Load () const |
Loads the music as specified by the static functions. | |
void | Swap (MusicKey &other) |
Exchanges the contents of *this with other. | |
Related Functions | |
bool | thor::Resources::operator< (const MusicKey &lhs, const MusicKey &rhs) |
Comparison operator for strict weak ordering. | |
void | thor::Resources::swap (MusicKey &lhs, MusicKey &rhs) |
Swaps two sf::Music resource keys. |
Predefined key class for sf::Music resources.
You can use this class to specifiy the access and loading of sf::Music resources in a ResourceManager. Note that unlike the other SFML resources, sf::Music is not copied completely into memory, rather streamed continuously. Therefore, it is only suited to a limited extend as a resource in a resource manager. While ResourceManager allows easy loading and error-checking, a single sf::Music instance cannot be meaningfully shared, therefore the access through multiple ResourcePtr objects isn't recommended. Also note that const pointers to sf::Music aren't useful at all.
static MusicKey thor::Resources::MusicKey::FromFile | ( | const std::string & | fileName, |
const std::string & | tag = "" |
||
) | [static] |
Open sf::Music from file name.
fileName | The name of the file from which you want to load the sf::Music. |
tag | If an existing key has the same loading parameters, you can use this ID to create a distinct key. |
static MusicKey thor::Resources::MusicKey::FromMemory | ( | const void * | data, |
std::size_t | size, | ||
const std::string & | tag = "" |
||
) | [static] |
Open sf::Music from file in memory.
data | Pointer to the file data in memory. |
size | Size of the data to load, in bytes. |
tag | If an existing key has the same loading parameters, you can use this ID to create a distinct key. |
static MusicKey thor::Resources::MusicKey::FromStream | ( | sf::InputStream & | stream, |
const std::string & | tag = "" |
||
) | [static] |
Open sf::Music from input stream.
stream | Source stream to read from. |
tag | If an existing key has the same loading parameters, you can use this ID to create a distinct key. |
MovedPtr<sf::Music, NoCopy> thor::Resources::MusicKey::Load | ( | ) | const |
Loads the music as specified by the static functions.
This function is mainly provided for ResourceManager, you don't need to call it directly.