Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
Orientation.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <ostream>
4
10enum class Orientation { N = 1, E = 2, S = 3, W = 4 };
11
12inline std::ostream& operator<<(std::ostream& os, Orientation orientation)
13{
14 switch (orientation) {
15 case Orientation::N:
16 return os << "North";
17 case Orientation::E:
18 return os << "East";
19 case Orientation::S:
20 return os << "South";
21 case Orientation::W:
22 return os << "West";
23 }
24 return os << "Unknown";
25}
26
27inline std::string to_string(Orientation orientation)
28{
29 switch (orientation) {
30 case Orientation::N:
31 return "North";
32 case Orientation::E:
33 return "East";
34 case Orientation::S:
35 return "South";
36 case Orientation::W:
37 return "West";
38 }
39 return "Unknown";
40}
41
46inline float toAngle(Orientation orientation)
47{
48 switch (orientation) {
49 case Orientation::W:
50 return 0.0f;
51 case Orientation::S:
52 return 90.0f;
53 case Orientation::E:
54 return 180.0f;
55 case Orientation::N:
56 return 270.0f;
57 }
58 return 0.0f;
59}
std::string to_string(Orientation orientation)
Orientation
std::ostream & operator<<(std::ostream &os, Orientation orientation)
float toAngle(Orientation orientation)
Returns the Y rotation angle (degrees) for a given orientation.