Gamedev Framework (gf)  0.7.0
A C++14 framework for 2D games
Public Member Functions | Public Attributes | Related Functions | List of all members
gf::Translation Struct Reference

A translation. More...

#include <gf/Transform.h>

Public Member Functions

 Translation ()
 Default constructor. More...
 
 Translation (Vector2f translationOffset)
 Constructor with an offset. More...
 
void setOffset (Vector2f newOffset) noexcept
 Set the translation offset. More...
 
Vector2f getOffset () const noexcept
 Get the translation offset. More...
 

Public Attributes

Vector2f offset
 The offset of the translation. More...
 

Related Functions

(Note that these are not member functions.)

constexpr Vector2f transform (const Translation &translation, Vector2f point)
 Apply a translation to a 2D point. More...
 
constexpr Vector2f inverseTransform (const Translation &translation, Vector2f point)
 Apply an inverse translation to a 2D point. More...
 

Detailed Description

A translation.

See also
gf::Rotation, gf::Transform

Constructor & Destructor Documentation

◆ Translation() [1/2]

gf::Translation::Translation ( )
inline

Default constructor.

The default translation has a null offset

◆ Translation() [2/2]

gf::Translation::Translation ( Vector2f  translationOffset)
inline

Constructor with an offset.

Parameters
translationOffsetThe translation offset

Member Function Documentation

◆ getOffset()

Vector2f gf::Translation::getOffset ( ) const
inlinenoexcept

Get the translation offset.

Returns
The current translation offset

◆ setOffset()

void gf::Translation::setOffset ( Vector2f  newOffset)
inlinenoexcept

Set the translation offset.

Parameters
newOffsetThe new offset

Friends And Related Function Documentation

◆ inverseTransform()

constexpr Vector2f inverseTransform ( const Translation translation,
Vector2f  point 
)
related

Apply an inverse translation to a 2D point.

Parameters
translationThe translation
pointThe point to transform
Returns
The transformed point

◆ transform()

constexpr Vector2f transform ( const Translation translation,
Vector2f  point 
)
related

Apply a translation to a 2D point.

Parameters
translationThe translation
pointThe point to transform
Returns
The transformed point

Member Data Documentation

◆ offset

Vector2f gf::Translation::offset

The offset of the translation.