Documentation de SFML 2.6.0

Attention: cette page se réfère à une ancienne version de SFML. Cliquez ici pour passer à la dernière version.
Loading...
Searching...
No Matches
Vector2.hpp
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>
89Vector2<T> operator -(const Vector2<T>& right);
90
104template <typename T>
105Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right);
106
120template <typename T>
121Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right);
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>
189Vector2<T>& operator *=(Vector2<T>& left, T right);
190
201template <typename T>
202Vector2<T> operator /(const Vector2<T>& left, T right);
203
217template <typename T>
218Vector2<T>& operator /=(Vector2<T>& left, T right);
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
253typedef Vector2<int> Vector2i;
256
257} // namespace sf
258
259
260#endif // SFML_VECTOR2_HPP
261
262
Utility template class for manipulating 2-dimensional vectors.
Definition: Vector2.hpp:38
T x
X coordinate of the vector.
Definition: Vector2.hpp:75
Vector2(const Vector2< U > &vector)
Construct the vector from another type of vector.
T y
Y coordinate of the vector.
Definition: Vector2.hpp:76
Vector2()
Default constructor.
Vector2(T X, T Y)
Construct the vector from its coordinates.