Documentation of SFML 2.1

Warning: this page refers to an old version of SFML. Click here to switch to the latest version.
View.hpp
1 
2 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2013 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_VIEW_HPP
26 #define SFML_VIEW_HPP
27 
29 // Headers
31 #include <SFML/Graphics/Export.hpp>
32 #include <SFML/Graphics/Rect.hpp>
33 #include <SFML/Graphics/Transform.hpp>
34 #include <SFML/System/Vector2.hpp>
35 
36 
37 namespace sf
38 {
43 class SFML_GRAPHICS_API View
44 {
45 public :
46 
53  View();
54 
61  explicit View(const FloatRect& rectangle);
62 
70  View(const Vector2f& center, const Vector2f& size);
71 
81  void setCenter(float x, float y);
82 
91  void setCenter(const Vector2f& center);
92 
102  void setSize(float width, float height);
103 
112  void setSize(const Vector2f& size);
113 
124  void setRotation(float angle);
125 
141  void setViewport(const FloatRect& viewport);
142 
153  void reset(const FloatRect& rectangle);
154 
163  const Vector2f& getCenter() const;
164 
173  const Vector2f& getSize() const;
174 
183  float getRotation() const;
184 
193  const FloatRect& getViewport() const;
194 
204  void move(float offsetX, float offsetY);
205 
214  void move(const Vector2f& offset);
215 
224  void rotate(float angle);
225 
241  void zoom(float factor);
242 
253  const Transform& getTransform() const;
254 
265  const Transform& getInverseTransform() const;
266 
267 private :
268 
270  // Member data
272  Vector2f m_center;
273  Vector2f m_size;
274  float m_rotation;
275  FloatRect m_viewport;
276  mutable Transform m_transform;
277  mutable Transform m_inverseTransform;
278  mutable bool m_transformUpdated;
279  mutable bool m_invTransformUpdated;
280 };
281 
282 } // namespace sf
283 
284 
285 #endif // SFML_VIEW_HPP
286 
287