HeadBall  1.0
A game
Converter.hpp
Go to the documentation of this file.
1 #pragma once
2 
12 namespace Converter {
13  const float PPM = 30.0f;
14  const float PI = 3.1415;
15 
23  template <class T>
24  constexpr T pixelsToMeters (const T &x) { return x / PPM; }
25 
33  template <class T>
34  constexpr T metersToPixels (const T &x) { return x * PPM; }
35 
43  template <class T>
44  constexpr T degToRad (const T &x) { return PI * x / 180.0; };
45 
53  template <class T>
54  constexpr T radToDeg (const T &x) { return 180.0 * x / PI; }
55 }
Convert the units from Box2D units to SFML units and vice-versa.
Definition: Converter.hpp:12
constexpr T radToDeg(const T &x)
Convert the unit from radians to degrees.
Definition: Converter.hpp:54
constexpr T degToRad(const T &x)
Convert the unit from degrees to radians.
Definition: Converter.hpp:44
constexpr T pixelsToMeters(const T &x)
Convert the unit from pixels to meters.
Definition: Converter.hpp:24
const float PPM
Definition: Converter.hpp:13
constexpr T metersToPixels(const T &x)
Convert the unit from meters to pixels.
Definition: Converter.hpp:34
const float PI
Definition: Converter.hpp:14