Class With Draw Circle Function Sfml

Specialized shape representing a circle. More than...

#include <CircleShape.hpp>

sf::Shape sf::Drawable sf::Transformable

Public Fellow member Functions

CircleShape (float radius=0, unsigned int pointCount=30)
Default constructor. More...
void setRadius (bladder radius)
Set the radius of the circle. More...
float getRadius () const
Get the radius of the circle. More...
void setPointCount (unsigned int count)
Set the number of points of the circumvolve. More...
virtual unsigned int getPointCount () const
Get the number of points of the circle. More...
virtual Vector2f getPoint (unsigned int alphabetize) const
Get a point of the circle. More...
void setTexture (const Texture *texture, bool resetRect=false)
Change the source texture of the shape. More...
void setTextureRect (const IntRect &rect)
Set the sub-rectangle of the texture that the shape will display. More...
void setFillColor (const Colour &color)
Set up the fill colour of the shape. More than...
void setOutlineColor (const Color &colour)
Set the outline color of the shape. More...
void setOutlineThickness (bladder thickness)
Set the thickness of the shape'southward outline. More than...
const Texture * getTexture () const
Get the source texture of the shape. More...
const IntRect & getTextureRect () const
Get the sub-rectangle of the texture displayed by the shape. More...
const Colour & getFillColor () const
Go the fill color of the shape. More than...
const Colour & getOutlineColor () const
Go the outline color of the shape. More...
float getOutlineThickness () const
Become the outline thickness of the shape. More...
FloatRect getLocalBounds () const
Get the local bounding rectangle of the entity. More than...
FloatRect getGlobalBounds () const
Get the global bounding rectangle of the entity. More...
void setPosition (float 10, float y)
set the position of the object More...
void setPosition (const Vector2f &position)
set the position of the object More...
void setRotation (float angle)
set the orientation of the object More...
void setScale (float factorX, float manufacturing plant)
set the calibration factors of the object More...
void setScale (const Vector2f &factors)
set up the scale factors of the object More...
void setOrigin (bladder x, float y)
set the local origin of the object More...
void setOrigin (const Vector2f &origin)
set the local origin of the object More...
const Vector2f & getPosition () const
go the position of the object More than...
float getRotation () const
get the orientation of the object More...
const Vector2f & getScale () const
become the electric current scale of the object More...
const Vector2f & getOrigin () const
get the local origin of the object More...
void motion (float offsetX, float offsetY)
Move the object by a given starting time. More...
void move (const Vector2f &offset)
Move the object past a given first. More than...
void rotate (bladder angle)
Rotate the object. More...
void calibration (float factorX, float factorY)
Scale the object. More...
void scale (const Vector2f &factor)
Calibration the object. More...
const Transform & getTransform () const
get the combined transform of the object More than...
const Transform & getInverseTransform () const
get the inverse of the combined transform of the object More...

Protected Member Functions

void update ()
Recompute the internal geometry of the shape. More...

Specialized shape representing a circle.

This class inherits all the functions of sf::Transformable (position, rotation, calibration, bounds, ...) besides as the functions of sf::Shape (outline, colour, texture, ...).

Usage example:

Since the graphics card tin't draw perfect circles, we have to false them with multiple triangles connected to each other. The "points count" belongings of sf::CircleShape defines how many of these triangles to use, and therefore defines the quality of the circle.

The number of points can also exist used for another purpose; with small numbers you can create any regular polygon shape: equilateral triangle, square, pentagon, hexagon, ...

See also
sf::Shape, sf::RectangleShape, sf::ConvexShape

Definition at line 41 of file CircleShape.hpp.

sf::CircleShape::CircleShape ( float radius = 0,
unsigned int pointCount = xxx
)
explicit

Default constructor.

Parameters
radius Radius of the circle
pointCount Number of points composing the circle
const Color& sf::Shape::getFillColor ( ) const
inherited

Get the fill colour of the shape.

Returns
Fill color of the shape
Come across as well
setFillColor
FloatRect sf::Shape::getGlobalBounds ( ) const
inherited

Get the global bounding rectangle of the entity.

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

Returns
Global bounding rectangle of the entity
const Transform& sf::Transformable::getInverseTransform ( ) const
inherited

get the inverse of the combined transform of the object

Returns
Changed of the combined transformations applied to the object
See likewise
getTransform
FloatRect sf::Shape::getLocalBounds ( ) const
inherited

Go the local bounding rectangle of the entity.

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'due south coordinate system.

Returns
Local bounding rectangle of the entity
const Vector2f& sf::Transformable::getOrigin ( ) const
inherited

get the local origin of the object

Returns
Current origin
See too
setOrigin
const Color& sf::Shape::getOutlineColor ( ) const
inherited

Get the outline color of the shape.

Returns
Outline colour of the shape
See also
setOutlineColor
float sf::Shape::getOutlineThickness ( ) const
inherited

Go the outline thickness of the shape.

Returns
Outline thickness of the shape
See besides
setOutlineThickness
virtual Vector2f sf::CircleShape::getPoint ( unsigned int alphabetize ) const
virtual

Get a point of the circle.

The returned point is in local coordinates, that is, the shape'south transforms (position, rotation, scale) are not taken into account. The result is undefined if index is out of the valid range.

Parameters
Returns
index-th point of the shape

Implements sf::Shape.

virtual unsigned int sf::CircleShape::getPointCount ( ) const
virtual

Go the number of points of the circle.

Returns
Number of points of the circumvolve
Meet too
setPointCount

Implements sf::Shape.

const Vector2f& sf::Transformable::getPosition ( ) const
inherited

get the position of the object

Returns
Current position
See also
setPosition
float sf::CircleShape::getRadius ( ) const

Get the radius of the circle.

Returns
Radius of the circle
Meet also
setRadius
float sf::Transformable::getRotation ( ) const
inherited

get the orientation of the object

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

Returns
Current rotation, in degrees
Meet likewise
setRotation
const Vector2f& sf::Transformable::getScale ( ) const
inherited

become the current scale of the object

Returns
Current scale factors
See likewise
setScale
const Texture* sf::Shape::getTexture ( ) const
inherited

Get the source texture of the 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 yous retrieve it with this function.

Returns
Arrow to the shape's texture
See also
setTexture
const IntRect& sf::Shape::getTextureRect ( ) const
inherited

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

Returns
Texture rectangle of the shape
Meet as well
setTextureRect
const Transform& sf::Transformable::getTransform ( ) const
inherited

get the combined transform of the object

Returns
Transform combining the position/rotation/scale/origin of the object
See also
getInverseTransform
void sf::Transformable::move ( bladder offsetX,
float offsetY
)
inherited

Move the object past a given offset.

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the post-obit code:

object.setPosition(pos.x + offsetX, pos.y + offsetY);

Parameters
offsetX X offset
offsetY Y offset
See likewise
setPosition
void sf::Transformable::move ( const Vector2f & start )
inherited

Move the object by a given start.

This function adds to the electric current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following lawmaking:

Parameters
See also
setPosition
void sf::Transformable::rotate ( float angle )
inherited

Rotate the object.

This role adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, information technology is equivalent to the post-obit code:

Parameters
bending Angle of rotation, in degrees
void sf::Transformable::calibration ( float factorX,
bladder factorY
)
inherited

Calibration the object.

This function multiplies the current calibration of the object, different setScale which overwrites it. Thus, information technology is equivalent to the following code:

object.setScale(scale.x * factorX, scale.y * factorY);

Parameters
factorX Horizontal scale factor
mill Vertical calibration factor
See besides
setScale
void sf::Transformable::calibration ( const Vector2f & factor )
inherited

Scale the object.

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

object.setScale(scale.x * factor.x, scale.y * factor.y);

Parameters
See also
setScale
void sf::Shape::setFillColor ( const Colour & color )
inherited

Set up the fill colour of the shape.

This color is modulated (multiplied) with the shape's texture if whatever. It can be used to colorize the shape, or change its global opacity. You tin use sf::Colour::Transparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill colour is opaque white.

Parameters
colour New color of the shape
Encounter as well
getFillColor, setOutlineColor
void sf::Transformable::setOrigin ( bladder x,
float y
)
inherited

set the local origin of the object

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this signal must be relative to the elevation-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

Parameters
10 X coordinate of the new origin
y Y coordinate of the new origin
Run across also
getOrigin
void sf::Transformable::setOrigin ( const Vector2f & origin )
inherited

set up the local origin of the object

The origin of an object defines the heart bespeak for all transformations (position, scale, rotation). The coordinates of this bespeak must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

Parameters
Meet also
getOrigin
void sf::Shape::setOutlineColor ( const Color & color )
inherited

Fix the outline colour of the shape.

By default, the shape'south outline colour is opaque white.

Parameters
color New outline color of the shape
See also
getOutlineColor, setFillColor
void sf::Shape::setOutlineThickness ( bladder thickness )
inherited

Fix the thickness of the shape's outline.

Note that negative values are immune (and then that the outline expands towards the center of the shape), and using zero disables the outline. By default, the outline thickness is 0.

Parameters
thickness New outline thickness
See also
getOutlineThickness
void sf::CircleShape::setPointCount ( unsigned int count )

Set the number of points of the circle.

Parameters
count New number of points of the circumvolve
See also
getPointCount
void sf::Transformable::setPosition ( float ten,
float y
)
inherited

fix the position of the object

This function completely overwrites the previous position. Run into the motility function to use an first based on the previous position instead. The default position of a transformable object is (0, 0).

Parameters
ten X coordinate of the new position
y Y coordinate of the new position
See also
move, getPosition
void sf::Transformable::setPosition ( const Vector2f & position )
inherited

prepare the position of the object

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

Parameters
Run into besides
move, getPosition
void sf::CircleShape::setRadius ( float radius )

Set the radius of the circle.

Parameters
radius New radius of the circle
See likewise
getRadius
void sf::Transformable::setRotation ( float bending )
inherited

set the orientation of the object

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

Parameters
bending New rotation, in degrees
Come across also
rotate, getRotation
void sf::Transformable::setScale ( float factorX,
float factorY
)
inherited

prepare the scale factors of the object

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

Parameters
factorX New horizontal scale factor
factorY New vertical calibration factor
Come across also
scale, getScale
void sf::Transformable::setScale ( const Vector2f & factors )
inherited

ready the scale factors of the object

This function completely overwrites the previous calibration. See the calibration function to add a cistron based on the previous calibration instead. The default calibration of a transformable object is (ane, 1).

Parameters
See also
calibration, getScale
void sf::Shape::setTexture ( const Texture * texture,
bool resetRect = false
)
inherited

Alter the source texture of the shape.

The texture argument refers to a texture that must exist equally long as the shape uses it. Indeed, the shape doesn't store its own re-create of the texture, but rather keeps a arrow to the i that you passed to this function. If the source texture is destroyed and the shape tries to utilize it, the behavior is undefined. texture tin can be NULL to disable texturing. If resetRect is truthful, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is imitation, the texture rect is left unchanged.

Parameters
texture New texture
resetRect Should the texture rect exist reset to the size of the new texture?
Meet likewise
getTexture, setTextureRect
void sf::Shape::setTextureRect ( const IntRect & rect )
inherited

Set the sub-rectangle of the texture that the shape will brandish.

The texture rect is useful when you don't desire to brandish the whole texture, just rather a role of it. By default, the texture rect covers the entire texture.

Parameters
rect Rectangle defining the region of the texture to display
See also
getTextureRect, setTexture
void sf::Shape::update ( )
protected inherited

Recompute the internal geometry of the shape.

This function must be called by the derived grade everytime the shape's points alter (i.e. the effect of either getPointCount or getPoint is different).


The documentation for this class was generated from the post-obit file:

  • CircleShape.hpp

nunnallashom.blogspot.com

Source: https://progsv.epfl.ch/www/doc-sfml/html/classsf_1_1CircleShape.htm

0 Response to "Class With Draw Circle Function Sfml"

แสดงความคิดเห็น

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel