CSFML - C binding of the Simple and Fast Multimedia Library

CSFML
Functions
CircleShape.h File Reference
`#include <SFML/Graphics/Export.h>`
`#include <SFML/Graphics/Color.h>`
`#include <SFML/Graphics/Rect.h>`
`#include <SFML/Graphics/Transform.h>`
`#include <SFML/Graphics/Types.h>`
`#include <SFML/System/Vector2.h>`
`#include <stddef.h>`

Go to the source code of this file.

## Functions
CSFML_GRAPHICS_API sfCircleShape * | sfCircleShape_create (void)
| Create a new circle shape. More...
CSFML_GRAPHICS_API sfCircleShape * | sfCircleShape_copy (const sfCircleShape *shape)
| Copy an existing circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_destroy (sfCircleShape *shape)
| Destroy an existing circle Shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setPosition (sfCircleShape *shape, sfVector2f position)
| Set the position of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setRotation (sfCircleShape *shape, float angle)
| Set the orientation of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setScale (sfCircleShape *shape, sfVector2f scale)
| Set the scale factors of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setOrigin (sfCircleShape *shape, sfVector2f origin)
| Set the local origin of a circle shape. More...
CSFML_GRAPHICS_API sfVector2f | sfCircleShape_getPosition (const sfCircleShape *shape)
| Get the position of a circle shape. More...
CSFML_GRAPHICS_API float | sfCircleShape_getRotation (const sfCircleShape *shape)
| Get the orientation of a circle shape. More...
CSFML_GRAPHICS_API sfVector2f | sfCircleShape_getScale (const sfCircleShape *shape)
| Get the current scale of a circle shape. More...
CSFML_GRAPHICS_API sfVector2f | sfCircleShape_getOrigin (const sfCircleShape *shape)
| Get the local origin of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_move (sfCircleShape *shape, sfVector2f offset)
| Move a circle shape by a given offset. More...
CSFML_GRAPHICS_API void | sfCircleShape_rotate (sfCircleShape *shape, float angle)
| Rotate a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_scale (sfCircleShape *shape, sfVector2f factors)
| Scale a circle shape. More...
CSFML_GRAPHICS_API sfTransform | sfCircleShape_getTransform (const sfCircleShape *shape)
| Get the combined transform of a circle shape. More...
CSFML_GRAPHICS_API sfTransform | sfCircleShape_getInverseTransform (const sfCircleShape *shape)
| Get the inverse of the combined transform of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setTexture (sfCircleShape *shape, const sfTexture *texture, sfBool resetRect)
| Change the source texture of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setTextureRect (sfCircleShape *shape, sfIntRect rect)
| Set the sub-rectangle of the texture that a circle shape will display. More...
CSFML_GRAPHICS_API void | sfCircleShape_setFillColor (sfCircleShape *shape, sfColor color)
| Set the fill color of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setOutlineColor (sfCircleShape *shape, sfColor color)
| Set the outline color of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setOutlineThickness (sfCircleShape *shape, float thickness)
| Set the thickness of a circle shape's outline. More...
CSFML_GRAPHICS_API const sfTexture * | sfCircleShape_getTexture (const sfCircleShape *shape)
| Get the source texture of a circle shape. More...
CSFML_GRAPHICS_API sfIntRect | sfCircleShape_getTextureRect (const sfCircleShape *shape)
| Get the sub-rectangle of the texture displayed by a circle shape. More...
CSFML_GRAPHICS_API sfColor | sfCircleShape_getFillColor (const sfCircleShape *shape)
| Get the fill color of a circle shape. More...
CSFML_GRAPHICS_API sfColor | sfCircleShape_getOutlineColor (const sfCircleShape *shape)
| Get the outline color of a circle shape. More...
CSFML_GRAPHICS_API float | sfCircleShape_getOutlineThickness (const sfCircleShape *shape)
| Get the outline thickness of a circle shape. More...
CSFML_GRAPHICS_API size_t | sfCircleShape_getPointCount (const sfCircleShape *shape)
| Get the total number of points of a circle shape. More...
CSFML_GRAPHICS_API sfVector2f | sfCircleShape_getPoint (const sfCircleShape *shape, size_t index)
| Get a point of a circle shape. More...
CSFML_GRAPHICS_API void | sfCircleShape_setRadius (sfCircleShape *shape, float radius)
| Set the radius of a circle. More...
CSFML_GRAPHICS_API float | sfCircleShape_getRadius (const sfCircleShape *shape)
| Get the radius of a circle. More...
CSFML_GRAPHICS_API void | sfCircleShape_setPointCount (sfCircleShape *shape, size_t count)
| Set the number of points of a circle. More...
CSFML_GRAPHICS_API sfFloatRect | sfCircleShape_getLocalBounds (const sfCircleShape *shape)
| Get the local bounding rectangle of a circle shape. More...
CSFML_GRAPHICS_API sfFloatRect | sfCircleShape_getGlobalBounds (const sfCircleShape *shape)
| Get the global bounding rectangle of a circle shape. More...

## Function Documentation

## ◆ sfCircleShape_copy()

CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_copy | ( | const sfCircleShape * | shape | ) |

Copy an existing circle shape.

Parameters

  shape | Shape to copy

Returns
  Copied object

## ◆ sfCircleShape_create()

CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_create | ( | void |  | ) |

Create a new circle shape.

Returns
  A new sfCircleShape object, or NULL if it failed

## ◆ sfCircleShape_destroy()

CSFML_GRAPHICS_API void sfCircleShape_destroy | ( | sfCircleShape * | shape | ) |

Destroy an existing circle Shape.

Parameters

  shape | Shape to delete

## ◆ sfCircleShape_getFillColor()

CSFML_GRAPHICS_API sfColor sfCircleShape_getFillColor | ( | const sfCircleShape * | shape | ) |

Get the fill color of a circle shape.

Parameters

  shape | Shape object

Returns
  Fill color of the shape

## ◆ sfCircleShape_getGlobalBounds()

CSFML_GRAPHICS_API sfFloatRect sfCircleShape_getGlobalBounds | ( | const sfCircleShape * | shape | ) |

Get the global bounding rectangle of a circle 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.

Parameters

  shape | Shape object

Returns
  Global bounding rectangle of the entity

## ◆ sfCircleShape_getInverseTransform()

CSFML_GRAPHICS_API sfTransform sfCircleShape_getInverseTransform | ( | const sfCircleShape * | shape | ) |

Get the inverse of the combined transform of a circle shape.

Parameters

  shape | Shape object

Returns
  Inverse of the combined transformations applied to the object

## ◆ sfCircleShape_getLocalBounds()

CSFML_GRAPHICS_API sfFloatRect sfCircleShape_getLocalBounds | ( | const sfCircleShape * | shape | ) |

Get the local bounding rectangle of a circle shape.

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.

Parameters

  shape | Shape object

Returns
  Local bounding rectangle of the entity

## ◆ sfCircleShape_getOrigin()

CSFML_GRAPHICS_API sfVector2f sfCircleShape_getOrigin | ( | const sfCircleShape * | shape | ) |

Get the local origin of a circle shape.

Parameters

  shape | Shape object

Returns
  Current origin

## ◆ sfCircleShape_getOutlineColor()

CSFML_GRAPHICS_API sfColor sfCircleShape_getOutlineColor | ( | const sfCircleShape * | shape | ) |

Get the outline color of a circle shape.

Parameters

  shape | Shape object

Returns
  Outline color of the shape

## ◆ sfCircleShape_getOutlineThickness()

CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness | ( | const sfCircleShape * | shape | ) |

Get the outline thickness of a circle shape.

Parameters

  shape | Shape object

Returns
  Outline thickness of the shape

## ◆ sfCircleShape_getPoint()

CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint | ( | const sfCircleShape * | shape,
|  | size_t | index
| ) |  |

Get a point of a circle shape.

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

Parameters

  shape | Shape object
  index | Index of the point to get, in range [0 .. getPointCount() - 1]

Returns
  Index-th point of the shape

## ◆ sfCircleShape_getPointCount()

CSFML_GRAPHICS_API size_t sfCircleShape_getPointCount | ( | const sfCircleShape * | shape | ) |

Get the total number of points of a circle shape.

Parameters

  shape | Shape object

Returns
  Number of points of the shape

## ◆ sfCircleShape_getPosition()

CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPosition | ( | const sfCircleShape * | shape | ) |

Get the position of a circle shape.

Parameters

  shape | Shape object

Returns
  Current position

## ◆ sfCircleShape_getRadius()

CSFML_GRAPHICS_API float sfCircleShape_getRadius | ( | const sfCircleShape * | shape | ) |

Get the radius of a circle.

Parameters

  shape | Shape object

Returns
  Radius of the circle

## ◆ sfCircleShape_getRotation()

CSFML_GRAPHICS_API float sfCircleShape_getRotation | ( | const sfCircleShape * | shape | ) |

Get the orientation of a circle shape.

The rotation is always in the range [0, 360].

Parameters

  shape | Shape object

Returns
  Current rotation, in degrees

## ◆ sfCircleShape_getScale()

CSFML_GRAPHICS_API sfVector2f sfCircleShape_getScale | ( | const sfCircleShape * | shape | ) |

Get the current scale of a circle shape.

Parameters

  shape | Shape object

Returns
  Current scale factors

## ◆ sfCircleShape_getTexture()

CSFML_GRAPHICS_API const sfTexture* sfCircleShape_getTexture | ( | const sfCircleShape * | shape | ) |

Get the source texture of a circle shape.

If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.

Parameters

  shape | Shape object

Returns
  Pointer to the shape's texture

## ◆ sfCircleShape_getTextureRect()

CSFML_GRAPHICS_API sfIntRect sfCircleShape_getTextureRect | ( | const sfCircleShape * | shape | ) |

Get the sub-rectangle of the texture displayed by a circle shape.

Parameters

  shape | Shape object

Returns
  Texture rectangle of the shape

## ◆ sfCircleShape_getTransform()

CSFML_GRAPHICS_API sfTransform sfCircleShape_getTransform | ( | const sfCircleShape * | shape | ) |

Get the combined transform of a circle shape.

Parameters

  shape | Shape object

Returns
  Transform combining the position/rotation/scale/origin of the object

## ◆ sfCircleShape_move()

CSFML_GRAPHICS_API void sfCircleShape_move | ( | sfCircleShape * | shape,
|  | sfVector2f | offset
| ) |  |

Move a circle shape by a given offset.

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

Parameters

  shape | Shape object
  offset | Offset

## ◆ sfCircleShape_rotate()

CSFML_GRAPHICS_API void sfCircleShape_rotate | ( | sfCircleShape * | shape,
|  | float | angle
| ) |  |

Rotate a circle shape.

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

Parameters

  shape | Shape object
  angle | Angle of rotation, in degrees

## ◆ sfCircleShape_scale()

CSFML_GRAPHICS_API void sfCircleShape_scale | ( | sfCircleShape * | shape,
|  | sfVector2f | factors
| ) |  |

Scale a circle shape.

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

Parameters

  shape | Shape object
  factors | Scale factors

## ◆ sfCircleShape_setFillColor()

CSFML_GRAPHICS_API void sfCircleShape_setFillColor | ( | sfCircleShape * | shape,
|  | sfColor | color
| ) |  |

Set the fill color of a circle 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 sfTransparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.

Parameters

  shape | Shape object
  color | New color of the shape

## ◆ sfCircleShape_setOrigin()

CSFML_GRAPHICS_API void sfCircleShape_setOrigin | ( | sfCircleShape * | shape,
|  | sfVector2f | origin
| ) |  |

Set the local origin of a circle shape.

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 circle Shape object is (0, 0).

Parameters

  shape | Shape object
  origin | New origin

## ◆ sfCircleShape_setOutlineColor()

CSFML_GRAPHICS_API void sfCircleShape_setOutlineColor | ( | sfCircleShape * | shape,
|  | sfColor | color
| ) |  |

Set the outline color of a circle shape.

You can use sfTransparent to disable the outline. By default, the shape's outline color is opaque white.

Parameters

  shape | Shape object
  color | New outline color of the shape

## ◆ sfCircleShape_setOutlineThickness()

CSFML_GRAPHICS_API void sfCircleShape_setOutlineThickness | ( | sfCircleShape * | shape,
|  | float | thickness
| ) |  |

Set the thickness of a circle shape's outline.

This number cannot be negative. Using zero disables the outline. By default, the outline thickness is 0.

Parameters

  shape | Shape object
  thickness | New outline thickness

## ◆ sfCircleShape_setPointCount()

CSFML_GRAPHICS_API void sfCircleShape_setPointCount | ( | sfCircleShape * | shape,
|  | size_t | count
| ) |  |

Set the number of points of a circle.

Parameters

  shape | Shape object
  count | New number of points of the circle

## ◆ sfCircleShape_setPosition()

CSFML_GRAPHICS_API void sfCircleShape_setPosition | ( | sfCircleShape * | shape,
|  | sfVector2f | position
| ) |  |

Set the position of a circle shape.

This function completely overwrites the previous position. See sfCircleShape_move to apply an offset based on the previous position instead. The default position of a circle Shape object is (0, 0).

Parameters

  shape | Shape object
  position | New position

## ◆ sfCircleShape_setRadius()

CSFML_GRAPHICS_API void sfCircleShape_setRadius | ( | sfCircleShape * | shape,
|  | float | radius
| ) |  |

Set the radius of a circle.

Parameters

  shape | Shape object
  radius | New radius of the circle

## ◆ sfCircleShape_setRotation()

CSFML_GRAPHICS_API void sfCircleShape_setRotation | ( | sfCircleShape * | shape,
|  | float | angle
| ) |  |

Set the orientation of a circle shape.

This function completely overwrites the previous rotation. See sfCircleShape_rotate to add an angle based on the previous rotation instead. The default rotation of a circle Shape object is 0.

Parameters

  shape | Shape object
  angle | New rotation, in degrees

## ◆ sfCircleShape_setScale()

CSFML_GRAPHICS_API void sfCircleShape_setScale | ( | sfCircleShape * | shape,
|  | sfVector2f | scale
| ) |  |

Set the scale factors of a circle shape.

This function completely overwrites the previous scale. See sfCircleShape_scale to add a factor based on the previous scale instead. The default scale of a circle Shape object is (1, 1).

Parameters

  shape | Shape object
  scale | New scale factors

## ◆ sfCircleShape_setTexture()

CSFML_GRAPHICS_API void sfCircleShape_setTexture | ( | sfCircleShape * | shape,
|  | const sfTexture * | texture,
|  | sfBool | resetRect
| ) |  |

Change the source texture of a circle shape.

The texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape 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 shape tries to use it, the behaviour is undefined. texture can be NULL to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.

Parameters

  shape | Shape object
  texture | New texture
  resetRect | Should the texture rect be reset to the size of the new texture?

## ◆ sfCircleShape_setTextureRect()

CSFML_GRAPHICS_API void sfCircleShape_setTextureRect | ( | sfCircleShape * | shape,
|  | sfIntRect | rect
| ) |  |

Set the sub-rectangle of the texture that a circle shape 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.

Parameters

  shape | Shape object
  rect | Rectangle defining the region of the texture to display