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
View.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_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
37namespace sf
38{
43 class SFML_GRAPHICS_API View
44{
45public:
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
267private:
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
Export.hpp
SFML_GRAPHICS_API
#define SFML_GRAPHICS_API
Definition Graphics/Export.hpp:43
Rect.hpp
Transform.hpp
Vector2.hpp
sf::Rect< float >
sf::Transform
Define a 3x3 transform matrix.
Definition Transform.hpp:43
sf::Vector2< float >
sf::View
2D camera that defines what region is shown on screen
Definition View.hpp:44
sf::View::move
void move(float offsetX, float offsetY)
Move the view relatively to its current position.
sf::View::View
View(const FloatRect &rectangle)
Construct the view from a rectangle.
sf::View::setRotation
void setRotation(float angle)
Set the orientation of the view.
sf::View::View
View()
Default constructor.
sf::View::getRotation
float getRotation() const
Get the current orientation of the view.
sf::View::zoom
void zoom(float factor)
Resize the view rectangle relatively to its current size.
sf::View::move
void move(const Vector2f &offset)
Move the view relatively to its current position.
sf::View::getSize
const Vector2f & getSize() const
Get the size of the view.
sf::View::rotate
void rotate(float angle)
Rotate the view relatively to its current orientation.
sf::View::getCenter
const Vector2f & getCenter() const
Get the center of the view.
sf::View::setViewport
void setViewport(const FloatRect &viewport)
Set the target viewport.
sf::View::setSize
void setSize(float width, float height)
Set the size of the view.
sf::View::setSize
void setSize(const Vector2f &size)
Set the size of the view.
sf::View::getViewport
const FloatRect & getViewport() const
Get the target viewport rectangle of the view.
sf::View::getInverseTransform
const Transform & getInverseTransform() const
Get the inverse projection transform of the view.
sf::View::setCenter
void setCenter(float x, float y)
Set the center of the view.
sf::View::setCenter
void setCenter(const Vector2f &center)
Set the center of the view.
sf::View::reset
void reset(const FloatRect &rectangle)
Reset the view to the given rectangle.
sf::View::getTransform
const Transform & getTransform() const
Get the projection transform of the view.
sf::View::View
View(const Vector2f &center, const Vector2f &size)
Construct the view from its center and size.
sf
Definition AlResource.hpp:35