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

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

List of all members.

Static Public Member Functions

static ImageKey FromSize (unsigned int width, unsigned int height, const sf::Color &fillColor=sf::Color(0, 0, 0), const std::string &tag="")
 Load sf::Image from size and fill color.
static ImageKey FromFile (const std::string &fileName, const std::string &tag="")
 Load sf::Image from file name.
static ImageKey FromMemory (const void *data, std::size_t size, const std::string &tag="")
 Load sf::Image from file in memory.
static ImageKey FromPixels (unsigned int width, unsigned int height, const sf::Uint8 *pixels, const std::string &tag="")
 Load sf::Image from array of pixels.

Public Member Functions

MovedPtr< sf::Image > Load () const
 Loads the image as specified by the static functions.
void Swap (ImageKey &other)
 Exchanges the contents of *this with other.

Related Functions

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

Detailed Description

Predefined key class for sf::Image resources.

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


Member Function Documentation

static ImageKey thor::Resources::ImageKey::FromFile ( const std::string &  fileName,
const std::string &  tag = "" 
) [static]

Load sf::Image from file name.

Parameters:
fileNameThe name of the file from which you want to load the sf::Image.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Image::LoadFromFile()
static ImageKey thor::Resources::ImageKey::FromMemory ( const void *  data,
std::size_t  size,
const std::string &  tag = "" 
) [static]

Load sf::Image from file in memory.

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

Load sf::Image from array of pixels.

Parameters:
width,heightThe size of the image.
pixelsPointer to the pixels in memory.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Image::LoadFromPixels()
static ImageKey thor::Resources::ImageKey::FromSize ( unsigned int  width,
unsigned int  height,
const sf::Color &  fillColor = sf::Color(0, 0, 0),
const std::string &  tag = "" 
) [static]

Load sf::Image from size and fill color.

Parameters:
width,heightThe size of the image.
fillColorThe color used to fill the image.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Image::Create()

Loads the image as specified by the static functions.

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

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