Bromeon
Static Public Member Functions | Public Member Functions | Related Functions
thor::Resources::TextureKey Class Reference

Predefined key class for sf::Texture resources. More...

List of all members.

Static Public Member Functions

static TextureKey FromSize (unsigned int width, unsigned int height, const std::string &tag="")
 Load sf::Texture from size.
static TextureKey FromFile (const std::string &fileName, const sf::IntRect &area=sf::IntRect(), const std::string &tag="")
 Load sf::Texture from file name.
static TextureKey FromMemory (const void *data, std::size_t size, const sf::IntRect &area=sf::IntRect(), const std::string &tag="")
 Load sf::Texture from file in memory.
static TextureKey FromImage (const sf::Image &image, const sf::IntRect &area=sf::IntRect(), const std::string &tag="")
 Load sf::Texture from an existing sf::Image.
static TextureKey FromStream (sf::InputStream &stream, const sf::IntRect &area=sf::IntRect(), const std::string &tag="")
 Load sf::Texture from input stream.

Public Member Functions

MovedPtr< sf::Texture, NoCopyLoad () const
 Loads the image as specified by the static functions.
void Swap (TextureKey &other)
 Exchanges the contents of *this with other.

Related Functions

bool thor::Resources::operator< (const TextureKey &lhs, const TextureKey &rhs)
 Comparison operator for strict weak ordering.
void thor::Resources::swap (TextureKey &lhs, TextureKey &rhs)
 Swaps two sf::Texture resource keys.

Detailed Description

Predefined key class for sf::Texture resources.

You can use this class to specifiy the access and loading of sf::Texture resources in a ResourceManager.


Member Function Documentation

static TextureKey thor::Resources::TextureKey::FromFile ( const std::string &  fileName,
const sf::IntRect &  area = sf::IntRect(),
const std::string &  tag = "" 
) [static]

Load sf::Texture from file name.

Parameters:
fileNameThe name of the file from which you want to load the sf::Texture.
areaSub-rectangle of the image to load.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Texture::LoadFromFile()
static TextureKey thor::Resources::TextureKey::FromImage ( const sf::Image &  image,
const sf::IntRect &  area = sf::IntRect(),
const std::string &  tag = "" 
) [static]

Load sf::Texture from an existing sf::Image.

Parameters:
imageImage containing the pixels that are copied to the texture.
areaSub-rectangle of the image to load.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Texture::LoadFromImage()
static TextureKey thor::Resources::TextureKey::FromMemory ( const void *  data,
std::size_t  size,
const sf::IntRect &  area = sf::IntRect(),
const std::string &  tag = "" 
) [static]

Load sf::Texture from file in memory.

Parameters:
dataPointer to the file data in memory.
sizeSize of the data to load, in bytes.
areaSub-rectangle of the image to load.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Texture::LoadFromMemory()
static TextureKey thor::Resources::TextureKey::FromSize ( unsigned int  width,
unsigned int  height,
const std::string &  tag = "" 
) [static]

Load sf::Texture from size.

Parameters:
width,heightThe size of the texture.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Texture::Create()
static TextureKey thor::Resources::TextureKey::FromStream ( sf::InputStream &  stream,
const sf::IntRect &  area = sf::IntRect(),
const std::string &  tag = "" 
) [static]

Load sf::Texture from input stream.

Parameters:
streamSource stream to read from.
areaSub-rectangle of the image to load.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Texture::LoadFromStream()

Loads the image as specified by the static functions.

Returns:
Movable smart pointer to the allocated sf::Texture, or null pointer at loading failure.

The documentation for this class was generated from the following file: