Apprendre
Télécharger
Communauté
Développement
Accueil
»
Apprendre
»
Documentation 2.6.0
»
Transform.hpp Source File
English
Faire un don
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.
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Loading...
Searching...
No Matches
SFML
include
SFML
Graphics
Transform.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_TRANSFORM_HPP
26
#define SFML_TRANSFORM_HPP
27
29
// Headers
31
#include <SFML/Graphics/Export.hpp>
32
#include <SFML/Graphics/Rect.hpp>
33
#include <SFML/System/Vector2.hpp>
34
35
36
namespace
sf
37
{
42
class
SFML_GRAPHICS_API
Transform
43
{
44
public
:
45
52
Transform
();
53
68
Transform
(
float
a00,
float
a01,
float
a02,
69
float
a10,
float
a11,
float
a12,
70
float
a20,
float
a21,
float
a22);
71
87
const
float
*
getMatrix
()
const
;
88
98
Transform
getInverse
()
const
;
99
115
Vector2f
transformPoint
(
float
x,
float
y)
const
;
116
131
Vector2f
transformPoint
(
const
Vector2f
& point)
const
;
132
147
FloatRect
transformRect
(
const
FloatRect
& rectangle)
const
;
148
167
Transform
&
combine
(
const
Transform
& transform);
168
187
Transform
&
translate
(
float
x,
float
y);
188
206
Transform
&
translate
(
const
Vector2f
& offset);
207
225
Transform
&
rotate
(
float
angle);
226
251
Transform
&
rotate
(
float
angle,
float
centerX,
float
centerY);
252
276
Transform
&
rotate
(
float
angle,
const
Vector2f
& center);
277
296
Transform
&
scale
(
float
scaleX,
float
scaleY);
297
323
Transform
&
scale
(
float
scaleX,
float
scaleY,
float
centerX,
float
centerY);
324
342
Transform
&
scale
(
const
Vector2f
& factors);
343
367
Transform
&
scale
(
const
Vector2f
& factors,
const
Vector2f
& center);
368
370
// Static member data
372
static
const
Transform
Identity
;
373
374
private
:
375
377
// Member data
379
float
m_matrix[16];
380
};
381
394
SFML_GRAPHICS_API
Transform
operator *(
const
Transform
& left,
const
Transform
& right);
395
408
SFML_GRAPHICS_API
Transform
& operator *=(
Transform
& left,
const
Transform
& right);
409
422
SFML_GRAPHICS_API
Vector2f
operator *(
const
Transform
& left,
const
Vector2f
& right);
423
437
SFML_GRAPHICS_API
bool
operator ==(
const
Transform
& left,
const
Transform
& right);
438
451
SFML_GRAPHICS_API
bool
operator !=(
const
Transform
& left,
const
Transform
& right);
452
453
}
// namespace sf
454
455
456
#endif
// SFML_TRANSFORM_HPP
457
458
sf::Rect< float >
sf::Transform
Define a 3x3 transform matrix.
Definition:
Transform.hpp:43
sf::Transform::translate
Transform & translate(float x, float y)
Combine the current transform with a translation.
sf::Transform::rotate
Transform & rotate(float angle, const Vector2f ¢er)
Combine the current transform with a rotation.
sf::Transform::getInverse
Transform getInverse() const
Return the inverse of the transform.
sf::Transform::scale
Transform & scale(const Vector2f &factors)
Combine the current transform with a scaling.
sf::Transform::translate
Transform & translate(const Vector2f &offset)
Combine the current transform with a translation.
sf::Transform::transformRect
FloatRect transformRect(const FloatRect &rectangle) const
Transform a rectangle.
sf::Transform::scale
Transform & scale(const Vector2f &factors, const Vector2f ¢er)
Combine the current transform with a scaling.
sf::Transform::Transform
Transform(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)
Construct a transform from a 3x3 matrix.
sf::Transform::scale
Transform & scale(float scaleX, float scaleY)
Combine the current transform with a scaling.
sf::Transform::Identity
static const Transform Identity
The identity transform (does nothing)
Definition:
Transform.hpp:372
sf::Transform::transformPoint
Vector2f transformPoint(const Vector2f &point) const
Transform a 2D point.
sf::Transform::getMatrix
const float * getMatrix() const
Return the transform as a 4x4 matrix.
sf::Transform::Transform
Transform()
Default constructor.
sf::Transform::rotate
Transform & rotate(float angle)
Combine the current transform with a rotation.
sf::Transform::rotate
Transform & rotate(float angle, float centerX, float centerY)
Combine the current transform with a rotation.
sf::Transform::combine
Transform & combine(const Transform &transform)
Combine the current transform with another one.
sf::Transform::scale
Transform & scale(float scaleX, float scaleY, float centerX, float centerY)
Combine the current transform with a scaling.
sf::Transform::transformPoint
Vector2f transformPoint(float x, float y) const
Transform a 2D point.
sf::Vector2< float >