Gamedev Framework (gf)  0.3.0
A C++11 framework for 2D games
Classes | Typedefs | Enumerations | Functions | Variables
Core classes and functions

All the core generic classes and functions. More...

Classes

class  gf::Array2D< T >
 A two-dimensional array. More...
 
class  gf::ArrayRef< T >
 A constant reference to an array and its size. More...
 
struct  gf::Circ< T >
 Utility class for manipulating circles. More...
 
class  gf::Clock
 Utility class that measures the elapsed time. More...
 
class  gf::Flags< E >
 Bitfield relying on an enumeration. More...
 
class  gf::InputStream
 Abstract class for custom file input streams. More...
 
class  gf::FileInputStream
 File based input stream. More...
 
class  gf::MemoryInputStream
 Memory based input stream. More...
 
class  gf::Library
 A class to represent the library. More...
 
struct  gf::Library::Version
 Information about version. More...
 
class  gf::Log
 Logging functions. More...
 
struct  gf::Matrix< T, ROWS, COLS >
 General purpose math matrix. More...
 
struct  gf::Matrix< T, 2, 2 >
 A 2x2 matrix. More...
 
struct  gf::Matrix< T, 3, 3 >
 A 3x3 matrix. More...
 
struct  gf::Matrix< T, 4, 4 >
 A 4x4 matrix. More...
 
class  gf::Noise2D
 2D A noise function More...
 
class  gf::Noise3D
 3D A noise function More...
 
class  gf::ValueNoise2D
 Value 2D noise. More...
 
class  gf::GradientNoise2D
 Gradient 2D noise. More...
 
class  gf::GradientNoise3D
 Gradient 3D noise. More...
 
class  gf::BetterGradientNoise2D
 Better gradient 2D noise. More...
 
class  gf::FractalNoise2D
 Fractal 2D noise. More...
 
class  gf::FractalNoise3D
 Fractal 3D noise. More...
 
class  gf::PerlinNoise2D
 Perlin 2D noise. More...
 
class  gf::PerlinNoise3D
 Perlin 3D noise. More...
 
class  gf::SimplexNoise2D
 Simplex 2D noise. More...
 
class  gf::OpenSimplexNoise2D
 OpenSimplex 2D noise. More...
 
class  gf::OpenSimplexNoise3D
 OpenSimplex3D noise. More...
 
class  gf::WaveletNoise3D
 Wavelet 3D noise. More...
 
class  gf::WorleyNoise2D
 Worley 2D noise. More...
 
class  gf::Multifractal2D
 Multi Fractal 2D noise. More...
 
class  gf::HeteroTerrain2D
 Hetero Terrain 2D noise. More...
 
class  gf::HybridMultifractal2D
 Hybrid Multifractal 2D noise. More...
 
class  gf::RidgedMultifractal2D
 Ridged Multifractal 2D noise. More...
 
class  gf::Queue< T >
 A simple concurrent queue. More...
 
class  gf::Random
 A random engine. More...
 
struct  gf::Range< T >
 A half-open range of values. More...
 
struct  gf::Range< T >::Iterator
 A range iterator. More...
 
struct  gf::Rect< T >
 Utility class for manipulating 2D axis aligned rectangles. More...
 
class  gf::Singleton< T >
 A singleton that wraps a pointer provided by a storage. More...
 
class  gf::SingletonStorage< T >
 A storage for a singleton. More...
 
class  gf::StringRef
 A constant reference to a string and its size. More...
 
class  gf::SystemInfo
 A class for system info. More...
 
class  gf::Time
 Represents a time value. More...
 
struct  gf::NoneType
 Semantic type to represent "none". More...
 
struct  gf::AllType
 Semantic type to represent "all". More...
 
struct  gf::Vector< T, N >
 General purpose math vector. More...
 
struct  gf::Vector< T, 2 >
 A 2D vector. More...
 
struct  gf::Vector< T, 3 >
 A 3D vector. More...
 
struct  gf::Vector< T, 4 >
 A 4D vector. More...
 

Typedefs

using gf::CircF = Circ< float >
 A float circle. More...
 
using gf::CircI = Circ< int >
 A int circle. More...
 
using gf::CircU = Circ< unsigned >
 A unsigned circle. More...
 
using gf::CircZ = Circ< std::size_t >
 A std::size_t circle. More...
 
using gf::Path = boost::filesystem::path
 A path in the filesystem. More...
 
using gf::Id = uint64_t
 An identifier. More...
 
template<typename T >
using gf::Step = T(*)(T)
 A step is a function with special features. More...
 
using gf::Matrix2f = Matrix< float, 2, 2 >
 A float square matrix of size 2. More...
 
using gf::Matrix3f = Matrix< float, 3, 3 >
 A float square matrix of size 3. More...
 
using gf::Matrix4f = Matrix< float, 4, 4 >
 A float square matrix of size 4. More...
 
using gf::RangeF = Range< float >
 A float range. More...
 
using gf::RangeI = Range< int >
 A int range. More...
 
using gf::RangeU = Range< unsigned >
 A unsigned range. More...
 
using gf::RangeZ = Range< std::size_t >
 A std::size_t range. More...
 
using gf::RectF = Rect< float >
 A float rectangle. More...
 
using gf::RectI = Rect< int >
 A int rectangle. More...
 
using gf::RectU = Rect< unsigned >
 A unsigned rectangle. More...
 
using gf::RectZ = Rect< std::size_t >
 A std::size_t rectangle. More...
 
using gf::Vector2f = Vector< float, 2 >
 A float vector with 2 components. More...
 
using gf::Vector3f = Vector< float, 3 >
 A float vector with 3 components. More...
 
using gf::Vector4f = Vector< float, 4 >
 A float vector with 4 components. More...
 
using gf::Vector2d = Vector< double, 2 >
 A double vector with 2 components. More...
 
using gf::Vector3d = Vector< double, 3 >
 A double vector with 3 components. More...
 
using gf::Vector4d = Vector< double, 4 >
 A double vector with 4 components. More...
 
using gf::Vector2i = Vector< int, 2 >
 A int vector with 2 components. More...
 
using gf::Vector3i = Vector< int, 3 >
 A int vector with 3 components. More...
 
using gf::Vector4i = Vector< int, 4 >
 A int vector with 4 components. More...
 
using gf::Vector2u = Vector< unsigned, 2 >
 A unsigned vector with 2 components. More...
 
using gf::Vector3u = Vector< unsigned, 3 >
 A unsigned vector with 3 components. More...
 
using gf::Vector4u = Vector< unsigned, 4 >
 A unsigned vector with 4 components. More...
 
using gf::Vector2z = Vector< std::size_t, 2 >
 A std::size_t vector with 2 components. More...
 
using gf::Vector3z = Vector< std::size_t, 3 >
 A std::size_t vector with 3 components. More...
 
using gf::Vector4z = Vector< std::size_t, 4 >
 A std::size_t vector with 4 components. More...
 
using gf::Vector2b = Vector< bool, 2 >
 A bool vector with 2 components. More...
 
using gf::Vector3b = Vector< bool, 3 >
 A bool vector with 3 components. More...
 
using gf::Vector4b = Vector< bool, 4 >
 A bool vector with 4 components. More...
 
using gf::Color3f = Vector< float, 3 >
 A float color vector with 3 components. More...
 
using gf::Color4f = Vector< float, 4 >
 A float color vector with 4 components. More...
 
using gf::Color3u = Vector< uint8_t, 3 >
 A uint8_t color vector with 3 components. More...
 
using gf::Color4u = Vector< uint8_t, 4 >
 A uint8_t color vector with 4 components. More...
 
template<typename T , std::size_t N>
using gf::Distance = T(*)(const Vector< T, N > &, const Vector< T, N > &)
 A distance function. More...
 
template<typename T >
using gf::Distance2 = Distance< T, 2 >
 A distance function for 2D vectors. More...
 
template<typename T >
using gf::Distance3 = Distance< T, 3 >
 A distance function for 3D vectors. More...
 

Enumerations

enum  gf::Direction : int {
  gf::Direction::Center = -1,
  gf::Direction::Up = 0,
  gf::Direction::Right = 1,
  gf::Direction::Down = 2,
  gf::Direction::Left = 3
}
 Main four directions. More...
 
enum  gf::Log::Level : int {
  gf::Log::Debug,
  gf::Log::Info,
  gf::Log::Warn,
  gf::Log::Error,
  gf::Log::Fatal
}
 The severity level of the log. More...
 
enum  gf::Log::Category : int {
  gf::Log::General,
  gf::Log::Graphics,
  gf::Log::Network,
  gf::Log::Physics,
  gf::Log::Resources
}
 The category of the log. More...
 
enum  gf::Orientation : int {
  gf::Orientation::Center = -1,
  gf::Orientation::North = 0,
  gf::Orientation::NorthEast = 1,
  gf::Orientation::East = 2,
  gf::Orientation::SouthEast = 3,
  gf::Orientation::South = 4,
  gf::Orientation::SouthWest = 5,
  gf::Orientation::West = 6,
  gf::Orientation::NorthWest = 7
}
 Cardinal and ordinal orientation. More...
 

Functions

Vector2f gf::unit (Direction direction)
 Get a unit vector from a direction. More...
 
Vector2i gf::displacement (Direction direction)
 Get a vector from a direction. More...
 
float gf::angle (Direction direction)
 Get an angle from a direction. More...
 
Direction gf::opposite (Direction direction)
 Get the opposite direction. More...
 
Direction gf::orthogonalCW (Direction direction)
 Get the orthogonal direction clockwise. More...
 
Direction gf::orthogonalCCW (Direction direction)
 Get the orthogonal direction counter-clockwise. More...
 
Direction gf::nextCW (Direction direction)
 Get the next direction clockwise. More...
 
Direction gf::nextCCW (Direction direction)
 Get the next direction counter-clockwise. More...
 
constexpr Id gf::hash (const char *str, std::size_t sz)
 Get an identifier from a string. More...
 
Id gf::hash (const std::string &str)
 Get an idenfitier from a string. More...
 
template<typename T >
constexpr T gf::linearStep (T t)
 Linear step. More...
 
template<typename T >
constexpr T gf::cubicStep (T t)
 Cubic step (smoothstep) More...
 
template<typename T >
constexpr T gf::quinticStep (T t)
 Quintic step (smootherstep) More...
 
template<typename T >
gf::cosineStep (T t)
 Cosine step. More...
 
template<typename T , typename U >
gf::lerp (T lhs, T rhs, U t)
 Linear interpolation function. More...
 
template<typename T >
constexpr T gf::clamp (T val, T lo, T hi)
 Clamping function. More...
 
template<typename T >
constexpr T gf::square (T val)
 Square function. More...
 
Vector2f gf::unit (Orientation orientation)
 Get a unit vector from an orientation. More...
 
Vector2i gf::displacement (Orientation orientation)
 Get a vector from an orientation. More...
 
float gf::angle (Orientation orientation)
 Get an angle from a orientation. More...
 
Orientation gf::opposite (Orientation orientation)
 Get the opposite orientation. More...
 
Orientation gf::orthogonalCW (Orientation orientation)
 Get the orthogonal orientation clockwise. More...
 
Orientation gf::orthogonalCCW (Orientation orientation)
 Get the orthogonal orientation counter-clockwise. More...
 
Orientation gf::nextCW (Orientation orientation)
 Get the next orientation clockwise. More...
 
Orientation gf::nextCCW (Orientation orientation)
 Get the next orientation counter-clockwise. More...
 
Vector2f gf::transform (const Matrix3f &mat, Vector2f point)
 Apply an affine transformation to a 2D point. More...
 
RectF gf::transform (const Matrix3f &mat, const RectF &rect)
 Apply an affine transformaton to a rectangle. More...
 
constexpr Matrix3f gf::identityTransform ()
 Identity transform. More...
 
Matrix3f gf::translation (Vector2f offset)
 Get a translation matrix. More...
 
void gf::translate (Matrix3f &mat, Vector2f offset)
 Combine the current transform with a translation. More...
 
Matrix3f gf::rotation (float angle)
 Get a rotation matrix. More...
 
Matrix3f gf::rotation (float angle, Vector2f center)
 Get a rotation matrix. More...
 
void gf::rotate (Matrix3f &mat, float angle)
 Combine the current transform with a rotation. More...
 
void gf::rotate (Matrix3f &mat, float angle, Vector2f center)
 Combine the current transform with a rotation. More...
 
Matrix3f gf::scaling (Vector2f factor)
 Get a scaling matrix. More...
 
Matrix3f gf::scaling (Vector2f factor, Vector2f center)
 Get a scaling matrix. More...
 
void gf::scale (Matrix3f &mat, Vector2f factor)
 Combine the current transform with a scaling. More...
 
void gf::scale (Matrix3f &mat, Vector2f factor, Vector2f center)
 Combine the current transform with a scaling. More...
 

Variables

constexpr Id gf::InvalidId = 0
 The invalid id (which is 0) More...
 
constexpr float gf::Pi = 3.14159265358979323846f
 The \( \pi \) constant. More...
 
constexpr float gf::Pi2 = Pi / 2
 The \( \frac{\pi}{2} \) constant. More...
 
constexpr float gf::Pi4 = Pi / 4
 The \( \frac{\pi}{4} \) constant. More...
 
constexpr float gf::Sqrt2 = 1.41421356237309504880f
 The \( \sqrt{2} \) constant. More...
 
constexpr float gf::InvSqrt2 = 1 / Sqrt2
 The \( \frac{1}{\sqrt{2}} \) constant. More...
 
constexpr NoneType gf::None = { }
 Constant to represent "none". More...
 
constexpr AllType gf::All = { }
 Constant to represent "all". More...
 

Detailed Description

All the core generic classes and functions.

Typedef Documentation

using gf::CircF = typedef Circ<float>

A float circle.

using gf::CircI = typedef Circ<int>

A int circle.

using gf::CircU = typedef Circ<unsigned>

A unsigned circle.

using gf::CircZ = typedef Circ<std::size_t>

A std::size_t circle.

using gf::Color3f = typedef Vector<float, 3>

A float color vector with 3 components.

using gf::Color3u = typedef Vector<uint8_t, 3>

A uint8_t color vector with 3 components.

using gf::Color4f = typedef Vector<float, 4>

A float color vector with 4 components.

using gf::Color4u = typedef Vector<uint8_t, 4>

A uint8_t color vector with 4 components.

template<typename T , std::size_t N>
using gf::Distance = typedef T (*)(const Vector<T, N>&, const Vector<T, N>&)

A distance function.

A distance function is a function that gives the distance between two vectors.

gf::Distance<float, 3> distFn = gf::manhattanDistance<float, 3>;
Vector3f vec1 = ...;
Vector3f vec2 = ...;
float distance = distFn(vec1, vec2);
See also
manhattanDistance(), squareDistance(), euclideanDistance(), chebyshevDistance()
gf::Distance2, gf::Distance3
template<typename T >
using gf::Distance2 = typedef Distance<T, 2>

A distance function for 2D vectors.

See also
gf::Distance
template<typename T >
using gf::Distance3 = typedef Distance<T, 3>

A distance function for 3D vectors.

See also
gf::Distance
using gf::Id = typedef uint64_t

An identifier.

using gf::Matrix2f = typedef Matrix<float, 2, 2>

A float square matrix of size 2.

See also
Matrix<T, 2, 2>
using gf::Matrix3f = typedef Matrix<float, 3, 3>

A float square matrix of size 3.

See also
Matrix<T, 3, 3>
using gf::Matrix4f = typedef Matrix<float, 4, 4>

A float square matrix of size 4.

See also
Matrix<T, 4, 4>
using gf::Path = typedef boost::filesystem::path

A path in the filesystem.

gf::Path is a simple typedef for boost::filesystem::path. Boost.Filesystem will eventually be part of the C++17 standard. So, in the future, gf::Path will be a typedef for std::path.

using gf::RangeF = typedef Range<float>

A float range.

using gf::RangeI = typedef Range<int>

A int range.

using gf::RangeU = typedef Range<unsigned>

A unsigned range.

using gf::RangeZ = typedef Range<std::size_t>

A std::size_t range.

using gf::RectF = typedef Rect<float>

A float rectangle.

using gf::RectI = typedef Rect<int>

A int rectangle.

using gf::RectU = typedef Rect<unsigned>

A unsigned rectangle.

using gf::RectZ = typedef Rect<std::size_t>

A std::size_t rectangle.

template<typename T >
using gf::Step = typedef T (*)(T)

A step is a function with special features.

A step \( f \) is a (mathematical) function which has the following properties:

  • \( f(0) = 0 \)
  • \( f(1) = 1 \)

It can be used to smooth a linear interpolation.

gf::Vector2f point1 = ...;
gf::Vector2f point2 = ...;
float t = ...;
gf::Step<float> step = gf::cubicStep<float>;
gf::Vector2f interpolatedPoint = gf::lerp(point1, point2, t);
gf::Vector2f smoothedInterpolatedPoint = gf::lerp(point1, point2, step(t));
See also
linearStep(), cubicStep(), quinticStep(), cosineStep()
using gf::Vector2b = typedef Vector<bool, 2>

A bool vector with 2 components.

using gf::Vector2d = typedef Vector<double, 2>

A double vector with 2 components.

using gf::Vector2f = typedef Vector<float, 2>

A float vector with 2 components.

using gf::Vector2i = typedef Vector<int, 2>

A int vector with 2 components.

using gf::Vector2u = typedef Vector<unsigned, 2>

A unsigned vector with 2 components.

using gf::Vector2z = typedef Vector<std::size_t, 2>

A std::size_t vector with 2 components.

using gf::Vector3b = typedef Vector<bool, 3>

A bool vector with 3 components.

using gf::Vector3d = typedef Vector<double, 3>

A double vector with 3 components.

using gf::Vector3f = typedef Vector<float, 3>

A float vector with 3 components.

using gf::Vector3i = typedef Vector<int, 3>

A int vector with 3 components.

using gf::Vector3u = typedef Vector<unsigned, 3>

A unsigned vector with 3 components.

using gf::Vector3z = typedef Vector<std::size_t, 3>

A std::size_t vector with 3 components.

using gf::Vector4b = typedef Vector<bool, 4>

A bool vector with 4 components.

using gf::Vector4d = typedef Vector<double, 4>

A double vector with 4 components.

using gf::Vector4f = typedef Vector<float, 4>

A float vector with 4 components.

using gf::Vector4i = typedef Vector<int, 4>

A int vector with 4 components.

using gf::Vector4u = typedef Vector<unsigned, 4>

A unsigned vector with 4 components.

using gf::Vector4z = typedef Vector<std::size_t, 4>

A std::size_t vector with 4 components.

Enumeration Type Documentation

enum gf::Log::Category : int

The category of the log.

Enumerator
General 

The general category.

Graphics 

The graphics category.

Network 

The network category.

Physics 

The physics category.

Resources 

The resources category.

enum gf::Direction : int
strong

Main four directions.

gf::Direction represents one of the four main directions. A special value is added to represent the center, it indicates no direction.

See also
gf::Orientation
Enumerator
Center 

The center, indicates no direction.

Up 

The up direction.

Right 

The right direction.

Down 

The down direction.

Left 

The left direction.

enum gf::Log::Level : int

The severity level of the log.

Enumerator
Debug 

The debug level.

Info 

The info level.

Warn 

The warn level.

Error 

The error level.

Fatal 

The fatal level.

enum gf::Orientation : int
strong

Cardinal and ordinal orientation.

gf::Orientation represents one the four cardinal orientations and the four ordinal (or intercardinal) orientations. A special value is added to represent the center, it indicates no orientation.

See also
gf::Direction
Enumerator
Center 

The center, indicates no orientation.

North 

The north orientation.

NorthEast 

The north-east orientation.

East 

The east orientation.

SouthEast 

The south-east orientation.

South 

The south orientation.

SouthWest 

The south-west orientation.

West 

The west orientation.

NorthWest 

The north-west orientation.

Function Documentation

float gf::angle ( Direction  direction)

Get an angle from a direction.

Up is at angle 0 and angle grows clockwise.

Parameters
directionThe direction
Returns
an angle (in radians) representing the direction
float gf::angle ( Orientation  orientation)

Get an angle from a orientation.

North is at angle 0 and angle grows clockwise.

Parameters
orientationThe orientation
Returns
an angle (in radians) representing the orientation
template<typename T >
constexpr T gf::clamp ( val,
lo,
hi 
)

Clamping function.

This function takes a value and returns it if it is in a specified range. If not, the returned value is the nearest value in the range.

Parameters
valThe value to clamp
loThe minimum accepted value
hiThe maximum accepted value
Returns
The clamped value
template<typename T >
T gf::cosineStep ( t)
inline

Cosine step.

\[ f(t) = (1 - \cos(\pi * t)) * 0.5 \]

See also
gf::Step
template<typename T >
constexpr T gf::cubicStep ( t)

Cubic step (smoothstep)

\[ f(t) = -2 * t^3 + 3 * t^2 \]

Compared to a step, it has the following properties:

  • \( f'(0) = 0 \)
  • \( f'(1) = 0 \)

This function is also known as smoothstep

See also
gf::Step
Vector2i gf::displacement ( Direction  direction)

Get a vector from a direction.

The vector has its coordinates at -1, 0 or 1 depending on the direction. It can be used to represent the displacement on a grid in the given direction.

Parameters
directionThe direction
Returns
A vector representing the direction
Vector2i gf::displacement ( Orientation  orientation)

Get a vector from an orientation.

The vector has its coordinates at -1, 0 or 1 depending on the orientation. It can be used to represent the displacement on a grid in the given orientation.

Parameters
orientationThe orientation
Returns
A vector representing the orientation
constexpr Id gf::hash ( const char *  str,
std::size_t  sz 
)

Get an identifier from a string.

The hash is a Fowler–Noll–Vo 1a hash. This function is mainly for internal use. You should instead use the user-defined literal _id.

Example:

gf::Id id = "A string"_id; // computed at compile time
Parameters
strThe string
szThe size of the string
Id gf::hash ( const std::string &  str)
inline

Get an idenfitier from a string.

The hash is a Fowler–Noll–Vo 1a hash. This function can be used for computing an id at runtime. For computing an id from a string at compile time, you should use the the user-defined literal _id.

constexpr Matrix3f gf::identityTransform ( )

Identity transform.

Returns
The identity matrix
template<typename T , typename U >
T gf::lerp ( lhs,
rhs,
t 
)
inline

Linear interpolation function.

This functions returns an interpolated value between two values lhs and rhs according to a parameter \( t \). When \( t = 0 \) then lhs is returned, and when \( t = 1 \) then rhs is returned.

Parameters
lhsThe first value
rhsThe second value
tThe interpolation parameter, generally in the interval \( [0,1] \)
Returns
A value between the first and second value
template<typename T >
constexpr T gf::linearStep ( t)

Linear step.

\[ f(t) = t \]

See also
gf::Step
Direction gf::nextCCW ( Direction  direction)

Get the next direction counter-clockwise.

Parameters
directionThe direction
Returns
The next direction counter-clockwise
Orientation gf::nextCCW ( Orientation  orientation)

Get the next orientation counter-clockwise.

Parameters
orientationThe orientation
Returns
The next orientation counter-clockwise
Direction gf::nextCW ( Direction  direction)

Get the next direction clockwise.

Parameters
directionThe direction
Returns
The next direction clockwise
Orientation gf::nextCW ( Orientation  orientation)

Get the next orientation clockwise.

Parameters
orientationThe orientation
Returns
The next orientation clockwise
Direction gf::opposite ( Direction  direction)

Get the opposite direction.

Parameters
directionThe direction
Returns
The opposite direction
Orientation gf::opposite ( Orientation  orientation)

Get the opposite orientation.

Parameters
orientationThe orientation
Returns
The opposite orientation
Direction gf::orthogonalCCW ( Direction  direction)

Get the orthogonal direction counter-clockwise.

Parameters
directionThe direction
Returns
The orthogonal direction counter-clockwise
Orientation gf::orthogonalCCW ( Orientation  orientation)

Get the orthogonal orientation counter-clockwise.

Parameters
orientationThe orientation
Returns
The orthogonal orientation counter-clockwise
Direction gf::orthogonalCW ( Direction  direction)

Get the orthogonal direction clockwise.

Parameters
directionThe direction
Returns
The orthogonal direction clockwise
Orientation gf::orthogonalCW ( Orientation  orientation)

Get the orthogonal orientation clockwise.

Parameters
orientationThe orientation
Returns
The orthogonal orientation clockwise
template<typename T >
constexpr T gf::quinticStep ( t)

Quintic step (smootherstep)

\[ f(t) = 6 * t^5 - 15 * t^4 + 10 * t^3 \]

Compared to a step, it has the following properties:

  • \( f'(0) = 0 \)
  • \( f'(1) = 0 \)
  • \( f''(0) = 0 \)
  • \( f''(1) = 0 \)

This function is also known as smootherstep

See also
gf::Step
void gf::rotate ( Matrix3f &  mat,
float  angle 
)

Combine the current transform with a rotation.

Parameters
matThe current transform
angleThe angle of the rotation (in radians)
void gf::rotate ( Matrix3f &  mat,
float  angle,
Vector2f  center 
)

Combine the current transform with a rotation.

Parameters
matThe current transform
angleThe angle of the rotation (in radians)
centerThe center of the rotation
Matrix3f gf::rotation ( float  angle)
inline

Get a rotation matrix.

Parameters
angleThe angle of the rotation (in radians)
Returns
A rotation of angle radians
Matrix3f gf::rotation ( float  angle,
Vector2f  center 
)
inline

Get a rotation matrix.

Parameters
angleThe angle of the rotation (in radians)
centerThe center of the rotation
Returns
A rotation of angle radians of origin center
void gf::scale ( Matrix3f &  mat,
Vector2f  factor 
)

Combine the current transform with a scaling.

Parameters
matThe current transform
factorThe scaling factor
void gf::scale ( Matrix3f &  mat,
Vector2f  factor,
Vector2f  center 
)

Combine the current transform with a scaling.

Parameters
matThe current transform
factorThe scaling factor
centerThe center of the scaling
Matrix3f gf::scaling ( Vector2f  factor)
inline

Get a scaling matrix.

Parameters
factorThe scaling factor
Returns
A scaling by factor
Matrix3f gf::scaling ( Vector2f  factor,
Vector2f  center 
)
inline

Get a scaling matrix.

Parameters
factorThe scaling factor
centerThe center of the scaling
Returns
A scaling by factor of origin center
template<typename T >
constexpr T gf::square ( val)

Square function.

For a value \( x \), the square value is \( x^2 \).

Parameters
valA value
Returns
The square of the value
Vector2f gf::transform ( const Matrix3f &  mat,
Vector2f  point 
)
inline

Apply an affine transformation to a 2D point.

Parameters
matThe transformation matrix
pointThe point to transform
Returns
The transformed point
RectF gf::transform ( const Matrix3f &  mat,
const RectF &  rect 
)

Apply an affine transformaton to a rectangle.

The resulting rectangle is axis-aligned

Parameters
matThe transformation matrix
rectThe rectangle to transform
Returns
The transformed rectangle
void gf::translate ( Matrix3f &  mat,
Vector2f  offset 
)

Combine the current transform with a translation.

Parameters
matThe current transform
offsetThe offset of the translation
Matrix3f gf::translation ( Vector2f  offset)
inline

Get a translation matrix.

Parameters
offsetThe offset of the translation
Returns
A translation by offset
Vector2f gf::unit ( Direction  direction)

Get a unit vector from a direction.

Parameters
directionThe direction
Returns
A unit vector representing the direction
Vector2f gf::unit ( Orientation  orientation)

Get a unit vector from an orientation.

Parameters
orientationThe orientation
Returns
A unit vector representing the orientation

Variable Documentation

constexpr AllType gf::All = { }

Constant to represent "all".

See also
gf::AllType, gf::None
constexpr Id gf::InvalidId = 0

The invalid id (which is 0)

constexpr float gf::InvSqrt2 = 1 / Sqrt2

The \( \frac{1}{\sqrt{2}} \) constant.

constexpr NoneType gf::None = { }

Constant to represent "none".

See also
gf::NoneType, gf::All
constexpr float gf::Pi = 3.14159265358979323846f

The \( \pi \) constant.

constexpr float gf::Pi2 = Pi / 2

The \( \frac{\pi}{2} \) constant.

constexpr float gf::Pi4 = Pi / 4

The \( \frac{\pi}{4} \) constant.

constexpr float gf::Sqrt2 = 1.41421356237309504880f

The \( \sqrt{2} \) constant.