sf-svg
Public Member Functions | Public Attributes | List of all members
sfc::Line2< T > Class Template Reference

2D line More...

#include <Base.hpp>

Inheritance diagram for sfc::Line2< T >:
Inheritance graph
[legend]

Public Member Functions

 Line2 ()
 Default constructor. More...
 
 Line2 (const sf::Vector2< T > point, const sf::Vector2< T > vector, const sf::Color color=sf::Color::White)
 Specialized constructor. More...
 
length ()
 Calculate length. More...
 

Public Attributes

sf::Vector2< T > point
 Beginning of the line.
 
sf::Vector2< T > vector
 Vector (offset) More...
 
sf::Color color
 Color of the line.
 

Detailed Description

template<typename T>
class sfc::Line2< T >

2D line

was written to be used in sf-svg back-end, but actually can be used in any project that uses SFML. Line is defined as a pair of point and a vector (offset). Because of this, such code:

Line2<float> line({50, 50}, {60, 0});
// ...
window.draw(line);

Will draw a line between [50, 50] and [110, 50].

Constructor & Destructor Documentation

◆ Line2() [1/2]

template<typename T>
sfc::Line2< T >::Line2 ( )
inline

Default constructor.

Sets variables to proper values (white line between [0, 0] and [0, 0]).

◆ Line2() [2/2]

template<typename T>
sfc::Line2< T >::Line2 ( const sf::Vector2< T >  point,
const sf::Vector2< T >  vector,
const sf::Color  color = sf::Color::White 
)
inline

Specialized constructor.

Parameters
[in]point– beginning
[in]vector– offset
[in]color– color of the line, white by default

Creates line using given parameters.

Member Function Documentation

◆ length()

template<typename T>
T sfc::Line2< T >::length ( )
inline

Calculate length.

Returns
Length of the line

Member Data Documentation

◆ vector

template<typename T>
sf::Vector2<T> sfc::Line2< T >::vector

Vector (offset)

End of the line is point + vector.


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