sftools  2.0 dev
Bunch of tools for SFML application development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions | List of all members
sftools::Curve Class Reference

Drawable representing a mathematical curve. More...

#include <Curve.hpp>

+ Collaboration diagram for sftools::Curve:

Public Member Functions

 Curve (CurveInfo info, sf::Color color=sf::Color::Black, float thickness=1.f)
 Construct a curve.
 
virtual ~Curve ()
 Virtual destructor.
 
sf::FloatRect getLocalBounds () const
 Get the local bounding rectangle of the entity.
 
sf::FloatRect getGlobalBounds () const
 Get the global bounding rectangle of the entity.
 
CurveInfo const & getInfo () const
 Get the curve's info.
 
void setInfo (CurveInfo const &info)
 Set the curve's info.
 
sf::Color getColor () const
 Get the curve's color.
 
void setColor (sf::Color color)
 Set the curve's color.
 
float getThickness () const
 Get the curve's thickness.
 
void setThickness (float thickness)
 Set the curve's thickness.
 

Protected Member Functions

virtual void draw (sf::RenderTarget &target, sf::RenderStates states) const
 Draw the curve to a render target.
 

Detailed Description

Drawable representing a mathematical curve.

You can draw partial circle, ellipse, sine, etc... curves with this class. Here is an example :

sftools::Curve astroid(sftools::CurveInfo::astroid(50, 0, 6.283185307, 120), sf::Color::Blue, 2);
See Also
CurveInfo

Definition at line 159 of file Curve.hpp.

Constructor & Destructor Documentation

sftools::Curve::Curve ( CurveInfo  info,
sf::Color  color = sf::Color::Black,
float  thickness = 1.f 
)
inline

Construct a curve.

Parameters
infocurve's info
colorcurve's color
thicknesscurve's thickness

Definition at line 170 of file Curve.hpp.

virtual sftools::Curve::~Curve ( )
inlinevirtual

Virtual destructor.

Definition at line 182 of file Curve.hpp.

Member Function Documentation

virtual void sftools::Curve::draw ( sf::RenderTarget &  target,
sf::RenderStates  states 
) const
inlineprotectedvirtual

Draw the curve to a render target.

Parameters
targetRender target to draw to
statesCurrent render states

Definition at line 289 of file Curve.hpp.

sf::Color sftools::Curve::getColor ( ) const
inline

Get the curve's color.

Returns
curve's color

Definition at line 245 of file Curve.hpp.

sf::FloatRect sftools::Curve::getGlobalBounds ( ) const
inline

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, 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.

Returns
Global bounding rectangle of the entity

Definition at line 214 of file Curve.hpp.

References getLocalBounds().

CurveInfo const& sftools::Curve::getInfo ( ) const
inline

Get the curve's info.

Returns
the curve's info

Definition at line 224 of file Curve.hpp.

sf::FloatRect sftools::Curve::getLocalBounds ( ) const
inline

Get 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's coordinate system.

Returns
Local bounding rectangle of the entity

Definition at line 198 of file Curve.hpp.

Referenced by getGlobalBounds().

float sftools::Curve::getThickness ( ) const
inline

Get the curve's thickness.

Returns
curve's thickness

Definition at line 266 of file Curve.hpp.

void sftools::Curve::setColor ( sf::Color  color)
inline

Set the curve's color.

Parameters
colornew curve's color

Definition at line 255 of file Curve.hpp.

void sftools::Curve::setInfo ( CurveInfo const &  info)
inline

Set the curve's info.

Returns
info new curve's info

Definition at line 234 of file Curve.hpp.

void sftools::Curve::setThickness ( float  thickness)
inline

Set the curve's thickness.

Parameters
thicknessnew curve's thickness

Definition at line 276 of file Curve.hpp.


The documentation for this class was generated from the following file: