SFML - Simple and Fast Multimedia Library

SFML 2.6.2

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
Vector2.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef SFML_VECTOR2_HPP
26#define SFML_VECTOR2_HPP
27
28
29namespace sf
30{
36template <typename T>
37 class Vector2
38{
39public:
40
47 Vector2();
48
56 Vector2(T X, T Y);
57
69 template <typename U>
70 explicit Vector2(const Vector2<U>& vector);
71
73 // Member data
75 T x;
76 T y;
77};
78
88template <typename T>
89 Vector2<T> operator -(const Vector2<T>& right);
90
104template <typename T>
105 Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right);
106
120template <typename T>
121 Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right);
122
133template <typename T>
134 Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right);
135
146template <typename T>
147 Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right);
148
159template <typename T>
160 Vector2<T> operator *(const Vector2<T>& left, T right);
161
172template <typename T>
173 Vector2<T> operator *(T left, const Vector2<T>& right);
174
188template <typename T>
189 Vector2<T>& operator *=(Vector2<T>& left, T right);
190
201template <typename T>
202 Vector2<T> operator /(const Vector2<T>& left, T right);
203
217template <typename T>
218 Vector2<T>& operator /=(Vector2<T>& left, T right);
219
232template <typename T>
233 bool operator ==(const Vector2<T>& left, const Vector2<T>& right);
234
247template <typename T>
248 bool operator !=(const Vector2<T>& left, const Vector2<T>& right);
249
250#include <SFML/System/Vector2.inl>
251
252// Define the most common types
253 typedef Vector2<int> Vector2i;
254 typedef Vector2<unsigned int> Vector2u;
255 typedef Vector2<float> Vector2f;
256
257} // namespace sf
258
259
260#endif // SFML_VECTOR2_HPP
261
262
sf::Color::operator+
Color operator+(const Color &left, const Color &right)
Overload of the binary + operator.
sf::Color::operator*
Color operator*(const Color &left, const Color &right)
Overload of the binary * operator.
sf::Color::operator-
Color operator-(const Color &left, const Color &right)
Overload of the binary - operator.
sf::Color::operator-=
Color & operator-=(Color &left, const Color &right)
Overload of the binary -= operator.
sf::Color::operator*=
Color & operator*=(Color &left, const Color &right)
Overload of the binary *= operator.
sf::Color::operator+=
Color & operator+=(Color &left, const Color &right)
Overload of the binary += operator.
sf::Time::operator/
Time operator/(Time left, float right)
Overload of binary / operator to scale a time value.
sf::Time::operator/=
Time & operator/=(Time &left, float right)
Overload of binary /= operator to scale/assign a time value.
sf::Vector2
Utility template class for manipulating 2-dimensional vectors.
Definition Vector2.hpp:38
sf::Vector2::x
T x
X coordinate of the vector.
Definition Vector2.hpp:75
sf::Vector2::Vector2
Vector2(const Vector2< U > &vector)
Construct the vector from another type of vector.
sf::Vector2::y
T y
Y coordinate of the vector.
Definition Vector2.hpp:76
sf::Vector2::Vector2
Vector2()
Default constructor.
sf::Vector2::Vector2
Vector2(T X, T Y)
Construct the vector from its coordinates.
sf
Definition AlResource.hpp:35
sf::operator==
bool operator==(const IpAddress &left, const IpAddress &right)
Overload of == operator to compare two IP addresses.
sf::operator!=
bool operator!=(const IpAddress &left, const IpAddress &right)
Overload of != operator to compare two IP addresses.
sf::Vector2u
Vector2< unsigned int > Vector2u
Definition Vector2.hpp:254
sf::Vector2i
Vector2< int > Vector2i
Definition Vector2.hpp:253
sf::Vector2f
Vector2< float > Vector2f
Definition Vector2.hpp:255