Image living on the graphics card that can be used for drawing. More...
#include <Texture.h>
Public Types | |
using | Ptr = std::shared_ptr< Texture > |
shared texture pointer More... | |
Public Member Functions | |
Texture () | |
Constructor. More... | |
Texture (const std::string &filename, const UIntRect &area=UIntRect()) | |
Construct the texture. More... | |
Texture (const Texture &) | |
Copy constructor. More... | |
Texture & | operator= (const Texture &) |
Copy assignment operator. More... | |
Texture (Texture &&) noexcept | |
Move constructor. More... | |
Texture & | operator= (Texture &&) noexcept |
Move assignment operator. More... | |
Vector2u | getSize () const |
Get the size of the texture. More... | |
void | setSmooth (bool smooth) |
Enable or disable the smooth filter. More... | |
bool | isSmooth () const |
Check whether the smooth filter is enabled or not. More... | |
void | setRepeated (bool repeated) |
Enable or disable repeating. More... | |
bool | isRepeated () const |
Check whether the texture is repeated or not. More... | |
const std::string & | getFilename () const |
Get the filename of the image the texture was loaded from. More... | |
const sf::Texture & | getInternalTexture () const |
~Texture () | |
Destructor. More... | |
Static Public Member Functions | |
static unsigned int | getMaximumSize () |
Get the maximum texture size allowed. More... | |
Image living on the graphics card that can be used for drawing.
using ime::Texture::Ptr = std::shared_ptr<Texture> |
ime::Texture::Texture | ( | ) |
Constructor.
Creates an empty texture
Construct the texture.
filename | Filename of the image file to load |
area | Area of the image to load |
FileNotFound | if the filename cannot be found on the disk |
The area can be used to construct the texture from a sub-rectangle of the whole image. To construct the texture from the whole image (default), leave the area argument unspecified. If the area rectangle crosses the bounds of the image, it is adjusted to fit the image size
ime::Texture::Texture | ( | const Texture & | ) |
Copy constructor.
|
noexcept |
Move constructor.
ime::Texture::~Texture | ( | ) |
Destructor.
const std::string& ime::Texture::getFilename | ( | ) | const |
Get the filename of the image the texture was loaded from.
|
static |
Get the maximum texture size allowed.
This maximum size is defined by the graphics driver. You can expect a value of 512 pixels for low-end graphics card, and up to 8192 pixels or more for newer hardware.
Vector2u ime::Texture::getSize | ( | ) | const |
Get the size of the texture.
bool ime::Texture::isRepeated | ( | ) | const |
Check whether the texture is repeated or not.
bool ime::Texture::isSmooth | ( | ) | const |
Check whether the smooth filter is enabled or not.
void ime::Texture::setRepeated | ( | bool | repeated | ) |
Enable or disable repeating.
repeated | True to repeat the texture, false to disable repeating |
Repeating is involved when using texture coordinates outside the texture rectangle [0, 0, width, height]. In this case, if repeat mode is enabled, the whole texture will be repeated as many times as needed to reach the coordinate (for example, if the X texture coordinate is 3 * width, the texture will be repeated 3 times). If repeat mode is disabled, the "extra space" will instead be filled with border pixels.
Repeating is disabled by default.
void ime::Texture::setSmooth | ( | bool | smooth | ) |
Enable or disable the smooth filter.
smooth | True to enable smoothing or false to disable it |
When the filter is activated, the texture appears smoother so that pixels are less noticeable. However if you want the texture to look exactly the same as its source file, you should leave it disabled
The smooth filter is disabled by default