Namespace for resource-related functionality. More...
Classes | |
struct | CentralOwner |
Centralized ownership policy. More... | |
struct | RefCounted |
Reference-counted ownership policy. More... | |
Enumerations | |
enum | KnownIdStrategy { AssumeNew, Reuse, Reload } |
Strategy to deal with already known resource IDs. More... | |
Functions | |
template<class R > | |
ResourceLoader< R > | fromFile (const std::string &filename) |
Load the resource from a file on hard disk. More... | |
template<class R , typename T > | |
ResourceLoader< R > | fromFile (const std::string &filename, T arg1) |
Load the resource from a file on hard disk. More... | |
template<class R , typename T , typename U > | |
ResourceLoader< R > | fromMemory (T arg1, U arg2) |
Load the resource from a file in memory. More... | |
template<class R , typename T , typename U , typename V > | |
ResourceLoader< R > | fromMemory (T arg1, U arg2, V arg3) |
Load the resource from a file in memory. More... | |
template<class R > | |
ResourceLoader< R > | fromStream (sf::InputStream &stream) |
Load the resource from an input stream. More... | |
template<class R > | |
ResourceLoader< R > | fromStream (sf::InputStream &vertexShaderStream, sf::InputStream &fragmentShaderStream) |
Load the resource (usually sf::Shader) from two streams. More... | |
template<class R , typename T > | |
ResourceLoader< R > | fromStream (sf::InputStream &stream, T arg1) |
Load the resource from a stream with additional information. More... | |
template<class R > | |
ResourceLoader< R > | fromSamples (const sf::Int16 *samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate) |
Load sf::SoundBuffer from array of audio samples in memory. More... | |
template<class R > | |
ResourceLoader< R > | fromPixels (unsigned int width, unsigned int height, const sf::Uint8 *pixels) |
Load resource (usually sf::Image) from array of pixels. More... | |
template<class R > | |
ResourceLoader< R > | fromColor (unsigned int width, unsigned int height, const sf::Color &color) |
Load resource (usually sf::Image) from size and fill color. More... | |
template<class R > | |
ResourceLoader< R > | fromImage (const sf::Image &image, const sf::IntRect area=sf::IntRect()) |
Load the resource (usually sf::Texture) from a sf::Image. More... | |
Namespace for resource-related functionality.
Strategy to deal with already known resource IDs.
Determines what happens if the user calls ResourceHolder::acquire() with an ID that is already associated with a different resource.
Enumerator | |
---|---|
AssumeNew |
Loads a new resource if the ID is unknown. Otherwise, a ResourceAccessException is thrown. |
Reuse |
Loads a new resource if the ID is unknown. Otherwise, the resource associated with the ID is reused. |
Reload |
Always loads a new resource. If the ID is already known, the corresponding resource is released. |
ResourceLoader<R> thor::Resources::fromColor | ( | unsigned int | width, |
unsigned int | height, | ||
const sf::Color & | color | ||
) |
Load resource (usually sf::Image) from size and fill color.
width,height | The size of the image. |
color | The color used to fill the image. |
ResourceLoader<R> thor::Resources::fromFile | ( | const std::string & | filename | ) |
Load the resource from a file on hard disk.
filename | The name of the file from which you want to load the resource. |
ResourceLoader<R> thor::Resources::fromFile | ( | const std::string & | filename, |
T | arg1 | ||
) |
Load the resource from a file on hard disk.
filename | The name of the file from which you want to load the resource. |
arg1 | An additional argument (for example sf::IntRect at sf::Texture or std::string / sf::Shader::Type at sf::Shader). |
ResourceLoader<R> thor::Resources::fromImage | ( | const sf::Image & | image, |
const sf::IntRect | area = sf::IntRect() |
||
) |
Load the resource (usually sf::Texture) from a sf::Image.
image | Image to load into the texture. |
area | Area of the image to load. |
ResourceLoader<R> thor::Resources::fromMemory | ( | T | arg1, |
U | arg2 | ||
) |
Load the resource from a file in memory.
arg1 | Usually const void* for a pointer in memory; alternatively std::string for shader. |
arg2 | Usually std::size_t for the data length in bytes; alternatively std::string or sf::Shader::Type for shader. |
ResourceLoader<R> thor::Resources::fromMemory | ( | T | arg1, |
U | arg2, | ||
V | arg3 | ||
) |
Load the resource from a file in memory.
arg1 | Usually const void* for a pointer in memory; alternatively std::string for shader. |
arg2 | Usually std::size_t for the data length in bytes; alternatively std::string or sf::Shader::Type for shader. |
arg3 | An additional argument (for example sf::IntRect at sf::Texture). |
ResourceLoader<R> thor::Resources::fromPixels | ( | unsigned int | width, |
unsigned int | height, | ||
const sf::Uint8 * | pixels | ||
) |
Load resource (usually sf::Image) from array of pixels.
width,height | The size of the image. |
pixels | Pointer to the pixels in memory. |
ResourceLoader<R> thor::Resources::fromSamples | ( | const sf::Int16 * | samples, |
std::size_t | sampleCount, | ||
unsigned int | channelCount, | ||
unsigned int | sampleRate | ||
) |
Load sf::SoundBuffer from array of audio samples in memory.
samples | Pointer to the samples array. |
sampleCount | Number of samples in the array. |
channelCount | Number of channels (1 = mono, 2 = stereo, ...). |
sampleRate | Sample rate (number of samples to play per second). |
ResourceLoader<R> thor::Resources::fromStream | ( | sf::InputStream & | stream | ) |
Load the resource from an input stream.
stream | Source stream to read from. |
ResourceLoader<R> thor::Resources::fromStream | ( | sf::InputStream & | vertexShaderStream, |
sf::InputStream & | fragmentShaderStream | ||
) |
Load the resource (usually sf::Shader) from two streams.
vertexShaderStream | Source stream to read the vertex shader from. |
fragmentShaderStream | Source stream to read the fragment shader from. |
ResourceLoader<R> thor::Resources::fromStream | ( | sf::InputStream & | stream, |
T | arg1 | ||
) |
Load the resource from a stream with additional information.
stream | Source stream to read from. |
arg1 | An additional argument (for example sf::IntRect at sf::Texture or std::string / sf::Shader::Type at sf::Shader). |