QSFML
Public Member Functions | List of all members
qsf::QVector2< N > Class Template Reference

Compatibility layer sf::Vector2<N> ↔ QPoint; QSize. More...

#include <qvector2.hpp>

Inheritance diagram for qsf::QVector2< N >:
Inheritance graph
[legend]

Public Member Functions

 QVector2 ()
 Default constructor. More...
 
 QVector2 (N x, N y)
 Two-parameter constructor. More...
 
 QVector2 (sf::Vector2< N > vec)
 Constructor copying sf::Vector2<N> More...
 
 QVector2 (QPoint Qp)
 Constructor copying QPoint. More...
 
 QVector2 (QSize Qp)
 Constructor copying QSize. More...
 
 operator QPoint const ()
 QPoint cast operator. More...
 
 operator QSize const ()
 QSize cast operator. More...
 

Detailed Description

template<typename N>
class qsf::QVector2< N >

Compatibility layer sf::Vector2<N> ↔ QPoint; QSize.

One Vector2 to rule them all.
Inherits sf::Vector2<N>, so it can be used everywhere, where original vector can.
Supports casting (non-explicit) to both QPoint and QSize.
Sample usage:

//Initialize using QSize
qsf::Qvector2f factor(QWidget::size());
//Use in SFML entity
someRect.setSize(factor);

Constructor & Destructor Documentation

template<typename N >
qsf::QVector2< N >::QVector2 ( )
inline

Default constructor.

Just calls default constructor of sf::Vector2<N>().

template<typename N >
qsf::QVector2< N >::QVector2 ( x,
y 
)
inline

Two-parameter constructor.

Parameters
[in]x– Point position on X axis
[in]y– Point position on Y axis

Calls sf::Vector2<N>(x, y).

template<typename N >
qsf::QVector2< N >::QVector2 ( sf::Vector2< N >  vec)
inline

Constructor copying sf::Vector2<N>

Parameters
[in]vec– Vector to copy

Calls sf::Vector2<N>(vec.x, vec.y).

template<typename N >
qsf::QVector2< N >::QVector2 ( QPoint  Qp)
inline

Constructor copying QPoint.

Parameters
[in]Qp– QPoint instance

Calls sf::Vector2<N>(Qp.x(), Qp.y()).

template<typename N >
qsf::QVector2< N >::QVector2 ( QSize  Qp)
inline

Constructor copying QSize.

Parameters
[in]Qp– QSize instance

Calls sf::Vector2<N>(Qp.x(), Qp.y()).

Member Function Documentation

template<typename N >
qsf::QVector2< N >::operator QPoint const ( )
inline

QPoint cast operator.

Casts qsf::Vector2 to a QPoint.
Sample usage:

rand() % 20 - 10,
rand() % 20 - 10
};
QWidget::move(pos);
template<typename N >
qsf::QVector2< N >::operator QSize const ( )
inline

QSize cast operator.

rand() % 200 + 100,
rand() % 200 + 100
};
QWidget::resize(size);

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