SFML-2.3.2: SFML bindings

Safe HaskellNone
LanguageHaskell98

SFML.Graphics.CircleShape

Synopsis

Documentation

module SFML.Utils

createCircleShape :: IO (Either SFException CircleShape) Source

Create a new circle shape.

copy :: SFCopyable a => a -> IO a Source

Copy the given SFML resource.

destroy :: SFResource a => a -> IO () Source

Destroy the given SFML resource.

setPosition :: SFTransformable a => a -> Vec2f -> IO () Source

Set the position of a transformable.

This function completely overwrites the previous position.

See move to apply an offset based on the previous position instead.

The default position of a transformable object is (0, 0).

setRotation Source

Arguments

:: SFTransformable a 
=> a 
-> Float

New rotation, in degrees

-> IO () 

Set the orientation of a transformable.

This function completely overwrites the previous rotation.

See rotate to add an angle based on the previous rotation instead.

The default rotation of a transformable SFTransformable object is 0.

setScale :: SFTransformable a => a -> Vec2f -> IO () Source

Set the scale factors of a transformable.

This function completely overwrites the previous scale.

See scale to add a factor based on the previous scale instead.

The default scale of a transformable SFTransformable object is (1, 1).

setOrigin :: SFTransformable a => a -> Vec2f -> IO () Source

Set the local origin of a transformable.

The origin of an object defines the center point for all transformations (position, scale, rotation).

The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation).

The default origin of a transformable SFTransformable object is (0, 0).

getPosition :: SFTransformable a => a -> IO Vec2f Source

Get the position of a transformable.

getRotation Source

Arguments

:: SFTransformable a 
=> a 
-> IO Float

Current rotation, in degrees

Get the orientation of a transformable.

getScale :: SFTransformable a => a -> IO Vec2f Source

Get the current scale of a transformable

getOrigin :: SFTransformable a => a -> IO Vec2f Source

Get the local origin of a transformable.

move :: SFTransformable a => a -> Vec2f -> IO () Source

Move a transformable by a given offset

This function adds to the current position of the object, unlike setPosition which overwrites it.

rotate Source

Arguments

:: SFTransformable a 
=> a 
-> Float

Angle of rotation, in degrees

-> IO () 

Rotate a transformable.

This function adds to the current rotation of the object, unlike setRotation which overwrites it.

scale :: SFTransformable a => a -> Vec2f -> IO () Source

Scale a transformable.

This function multiplies the current scale of the object, unlike setScale which overwrites it.

getTransform :: SFTransformable a => a -> IO Transform Source

Get the combined transform of a transformable.

getInverseTransform :: SFTransformable a => a -> IO Transform Source

Get the inverse of the combined transform of a transformable.

setTexture Source

Arguments

:: SFTexturable a 
=> 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

Arguments

:: SFTexturable a 
=> 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 :: SFTexturable a => 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 :: SFTexturable a => a -> IO IntRect Source

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

setFillColor :: SFShape a => a -> Color -> IO () Source

Set the fill color of a shape.

This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity.

You can use Transparent to make the inside of the shape transparent, and have the outline alone.

By default, the shape's fill color is opaque white.

setOutlineColor :: SFShape a => a -> Color -> IO () Source

Set the outline color of a shape.

You can use Transparent to disable the outline.

By default, the shape's outline color is opaque white.

setOutlineThickness Source

Arguments

:: SFShape a 
=> a 
-> Float

New outline thickness

-> IO () 

Set the thickness of a shape's outline.

This number cannot be negative. Using zero disables the outline.

By default, the outline thickness is 0.

getFillColor :: SFShape a => a -> IO Color Source

Get the fill color of a shape.

getOutlineColor :: SFShape a => a -> IO Color Source

Get the outline color of a shape.

getOutlineThickness :: SFShape a => a -> IO Float Source

Get the outline thickness of a shape.

getPointCount :: SFShape a => a -> IO Int Source

Get the total number of points of a shape.

getPoint Source

Arguments

:: SFShape a 
=> a 
-> Int

Index of the point to get, in range [0 .. getPointCount - 1]

-> IO Vec2f 

Get the ith point of a shape.

The result is undefined if index is out of the valid range.

setRadius Source

Arguments

:: CircleShape 
-> Float

New radius of the circle

-> IO () 

Set the radius of a circle.

getRadius Source

Arguments

:: CircleShape 
-> IO Float

Radius of the circle

Get the radius of a circle.

setPointCount Source

Arguments

:: SFShapeResizable a 
=> a 
-> Int

New number of points of the shape

-> IO () 

Set the number of points of a resizable shape.

getLocalBounds :: SFBounded a => a -> IO FloatRect Source

Get the local bounding rectangle of a boundable.

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

getGlobalBounds :: SFBounded a => a -> IO FloatRect Source

Get the global bounding rectangle of a shape.

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.