SFML- SFML bindings

Safe HaskellNone



class SFTexturable a where Source


setTexture Source


:: a 
-> Texture

New texture

-> Bool

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

-> IO () 

Change the source texture of a Texturable.

The texture argument refers to a texture that must exist as long as the texturable uses it. Indeed, the texturable 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 texturable tries to use it, the behaviour is undefined.

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

setTextureRect Source


:: a 
-> IntRect

Rectangle defining the region of the texture to display

-> IO () 

Set the sub-rectangle of the texture that a texturable will display.

The texture rect is useful when you don't want to display the whole texture, but rather a part of it.

By default, the texture rect covers the entire texture.

getTexture :: a -> IO (Maybe Texture) Source

Get the source texture of a texturable.

If the texturable has no source texture, Nothing is returned.

The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.

getTextureRect :: a -> IO IntRect Source

Get the sub-rectangle of the texture displayed by a texturable.