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>
38{
39public:
40
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>
90
104template <typename T>
106
120template <typename T>
122
133template <typename T>
134Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right);
135
146template <typename T>
147Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right);
148
159template <typename T>
160Vector2<T> operator *(const Vector2<T>& left, T right);
161
172template <typename T>
173Vector2<T> operator *(T left, const Vector2<T>& right);
174
188template <typename T>
190
201template <typename T>
202Vector2<T> operator /(const Vector2<T>& left, T right);
203
217template <typename T>
219
232template <typename T>
233bool operator ==(const Vector2<T>& left, const Vector2<T>& right);
234
247template <typename T>
248bool operator !=(const Vector2<T>& left, const Vector2<T>& right);
249
250#include <SFML/System/Vector2.inl>
251
252// Define the most common types
256
257} // namespace sf
258
259
260#endif // SFML_VECTOR2_HPP
261
262
Color operator+(const Color &left, const Color &right)
Overload of the binary + operator.
Color operator*(const Color &left, const Color &right)
Overload of the binary * operator.
Color operator-(const Color &left, const Color &right)
Overload of the binary - operator.
Color & operator-=(Color &left, const Color &right)
Overload of the binary -= operator.
Color & operator*=(Color &left, const Color &right)
Overload of the binary *= operator.
Color & operator+=(Color &left, const Color &right)
Overload of the binary += operator.
Time operator/(Time left, float right)
Overload of binary / operator to scale a time value.
Time & operator/=(Time &left, float right)
Overload of binary /= operator to scale/assign a time value.
Utility template class for manipulating 2-dimensional vectors.
Definition Vector2.hpp:38
Vector2(const Vector2< U > &vector)
Construct the vector from another type of vector.
Vector2()
Default constructor.
Vector2(T X, T Y)
Construct the vector from its coordinates.
bool operator==(const IpAddress &left, const IpAddress &right)
Overload of == operator to compare two IP addresses.
bool operator!=(const IpAddress &left, const IpAddress &right)
Overload of != operator to compare two IP addresses.
Vector2< unsigned int > Vector2u
Definition Vector2.hpp:254
Vector2< int > Vector2i
Definition Vector2.hpp:253
Vector2< float > Vector2f
Definition Vector2.hpp:255