QSFML
qvector2.hpp
Go to the documentation of this file.
1 /* =========================================================== *
2  * QSFML (c) Kamil Koczurek | koczurekk@gmail.com *
3  * GNU GPL v3 License http://www.gnu.org/licenses/gpl-3.0.html *
4  * =========================================================== */
5 
8 
9 #ifndef QVECTOR2_HPP
10 #define QVECTOR2_HPP
11 
12 #include <SFML/System/Vector2.hpp>
13 #include <QPoint>
14 #include <QSize>
15 
16 namespace qsf {
31  template <typename N>
32  class QVector2
33  : public sf::Vector2<N> {
34  public:
39  : sf::Vector2<N>()
40  { }
41 
48  QVector2(N x, N y)
49  : sf::Vector2<N>(x, y)
50  { }
51 
57  QVector2(sf::Vector2<N> vec)
58  : sf::Vector2<N>(vec.x, vec.y)
59  { }
60 
66  QVector2(QPoint Qp)
67  : sf::Vector2<N>(Qp.x(), Qp.y())
68  { }
69 
75  QVector2(QSize Qp)
76  : sf::Vector2<N>(Qp.width(), Qp.height())
77  { }
78 
90  operator QPoint const() { return QPoint(N(this->x), N(this->y)); }
91 
101  operator QSize const() { return QSize(N(this->x), N(this->y)); }
102  };
103 
108 
113 
118 
119 }
120 #endif // QVECTOR2_HPP
121 
Compatibility layer sf::Vector2<N> ↔ QPoint; QSize.
Definition: qvector2.hpp:32
Namespace containing all qsf classes and methods.
Definition: Image.cpp:3
QVector2(QSize Qp)
Constructor copying QSize.
Definition: qvector2.hpp:75
QVector2< unsigned int > QVector2u
Alias to QVector with template unsigned int.
Definition: qvector2.hpp:112
QVector2< int > QVector2i
Alias to QVector with template int.
Definition: qvector2.hpp:107
QVector2()
Default constructor.
Definition: qvector2.hpp:38
QVector2< float > QVector2f
Alias to QVector with template float.
Definition: qvector2.hpp:117
QVector2(N x, N y)
Two-parameter constructor.
Definition: qvector2.hpp:48
QVector2(sf::Vector2< N > vec)
Constructor copying sf::Vector2<N>
Definition: qvector2.hpp:57
QVector2(QPoint Qp)
Constructor copying QPoint.
Definition: qvector2.hpp:66