Texture

class Texture

A texture object.

Public Functions

explicit Texture(SDL_Texture *texture)

Create a texture.

Note

This function is not meant to be used by the user.

Parameters:

texture – The SDL texture.

math::Vec2 getSize() const

Get the size of the texture.

Returns:

The size of the texture.

Rect getRect() const

Get the rect of the texture.

Returns:

The rect of the texture.

SDL_Texture *getSDLTexture() const

Get the SDL texture.

Note

This function is not meant to be used by the user.

Returns:

The SDL texture.

void setSize(const math::Vec2 &size)

Set the size of the texture rect.

Parameters:

size – The size of the texture rect.

void scaleBy(float factor)

Scale the texture rect by a factor.

Parameters:

factor – The factor to scale by.

void fitWidth(float width)

Fit the texture rect to a width while maintaining the aspect ratio.

Parameters:

width – The width to fit to.

void fitHeight(float height)

Fit the texture rect to a height while maintaining the aspect ratio.

Parameters:

height – The height to fit to.