Documentation of SFML 1.6

Warning: this page refers to an old version of SFML. Click here to switch to the latest version.
Vector2.hpp
1 
2 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
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 
29 namespace sf
30 {
36 template <typename T>
37 class Vector2
38 {
39 public :
40 
45  Vector2();
46 
54  Vector2(T X, T Y);
55 
57  // Member data
59  T x;
60  T y;
61 };
62 
71 template <typename T>
72 Vector2<T> operator -(const Vector2<T>& V);
73 
83 template <typename T>
84 Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2);
85 
95 template <typename T>
96 Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2);
97 
107 template <typename T>
108 Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2);
109 
119 template <typename T>
120 Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2);
121 
131 template <typename T>
132 Vector2<T> operator *(const Vector2<T>& V, T X);
133 
143 template <typename T>
144 Vector2<T> operator *(T X, const Vector2<T>& V);
145 
155 template <typename T>
156 Vector2<T>& operator *=(Vector2<T>& V, T X);
157 
167 template <typename T>
168 Vector2<T> operator /(const Vector2<T>& V, T X);
169 
179 template <typename T>
180 Vector2<T>& operator /=(Vector2<T>& V, T X);
181 
191 template <typename T>
192 bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2);
193 
203 template <typename T>
204 bool operator !=(const Vector2<T>& V1, const Vector2<T>& V2);
205 
206 #include <SFML/System/Vector2.inl>
207 
208 // Define the most common types
209 typedef Vector2<int> Vector2i;
210 typedef Vector2<float> Vector2f;
211 
212 } // namespace sf
213 
214 
215 #endif // SFML_VECTOR2_HPP