Sprite.setTexture

Change the source texture of the shape.

The texture argument refers to a texture that must exist as long as the sprite uses it. Indeed, the sprite doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the sprite tries to use it, the behaviour is undefined. texture can be NULL to disable texturing.

If resetRect is true, the TextureRect property of the sprite is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.

class Sprite
void
setTexture
(,
bool rectReset = false
)

Parameters

texture const(Texture)

New texture

rectReset bool

Should the texture rect be reset to the size of the new texture?

Meta