HeadBall  1.0
A game
Functions | Variables
Converter Namespace Reference

Convert the units from Box2D units to SFML units and vice-versa. More...

Functions

template<class T >
constexpr T pixelsToMeters (const T &x)
 Convert the unit from pixels to meters. More...
 
template<class T >
constexpr T metersToPixels (const T &x)
 Convert the unit from meters to pixels. More...
 
template<class T >
constexpr T degToRad (const T &x)
 Convert the unit from degrees to radians. More...
 
template<class T >
constexpr T radToDeg (const T &x)
 Convert the unit from radians to degrees. More...
 

Variables

const float PPM = 30.0f
 
const float PI = 3.1415
 

Detailed Description

Convert the units from Box2D units to SFML units and vice-versa.

This namespace is used for easier conversion of units from the box2d units to SFML units and vice-versa. SFML uses pixels for position and degree for angle whereas box2d uses SI units (meters and radian).

Function Documentation

◆ degToRad()

template<class T >
constexpr T Converter::degToRad ( const T &  x)
constexpr

Convert the unit from degrees to radians.

Template Parameters
T
Parameters
x
Returns
constexpr T

◆ metersToPixels()

template<class T >
constexpr T Converter::metersToPixels ( const T &  x)
constexpr

Convert the unit from meters to pixels.

Template Parameters
T
Parameters
x
Returns
constexpr T

◆ pixelsToMeters()

template<class T >
constexpr T Converter::pixelsToMeters ( const T &  x)
constexpr

Convert the unit from pixels to meters.

Template Parameters
T
Parameters
x
Returns
constexpr T

◆ radToDeg()

template<class T >
constexpr T Converter::radToDeg ( const T &  x)
constexpr

Convert the unit from radians to degrees.

Template Parameters
T
Parameters
x
Returns
constexpr T

Variable Documentation

◆ PI

const float Converter::PI = 3.1415

◆ PPM

const float Converter::PPM = 30.0f