Gamedev Framework (gf)  0.10.0
A C++14 framework for 2D games
Orientation.h
1 /*
2  * Gamedev Framework (gf)
3  * Copyright (C) 2016-2018 Julien Bernard
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  * 2. Altered source versions must be plainly marked as such, and must not be
18  * misrepresented as being the original software.
19  * 3. This notice may not be removed or altered from any source distribution.
20  */
21 #ifndef GF_ORIENTATION_H
22 #define GF_ORIENTATION_H
23 
24 #include "Portability.h"
25 #include "Vector.h"
26 
27 namespace gf {
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 inline namespace v1 {
30 #endif
31 
42  enum class Orientation : int {
43  Center = -1,
44  North = 0,
45  NorthEast = 1,
46  East = 2,
47  SouthEast = 3,
48  South = 4,
49  SouthWest = 5,
50  West = 6,
51  NorthWest = 7,
52  };
53 
54 
62  GF_API Vector2f unit(Orientation orientation);
63 
75  GF_API Vector2i displacement(Orientation orientation);
76 
86  GF_API float angle(Orientation orientation);
87 
95  GF_API Orientation opposite(Orientation orientation);
96 
104  GF_API Orientation orthogonalCW(Orientation orientation);
105 
113  GF_API Orientation orthogonalCCW(Orientation orientation);
114 
122  GF_API Orientation nextCW(Orientation orientation);
123 
131  GF_API Orientation nextCCW(Orientation orientation);
132 
133 #ifndef DOXYGEN_SHOULD_SKIP_THIS
134 }
135 #endif
136 }
137 
138 
139 #endif // GF_ORIENTATION_H
Direction orthogonalCCW(Direction direction)
Get the orthogonal direction counter-clockwise.
Vector2i displacement(Direction direction)
Get a vector from a direction.
Direction orthogonalCW(Direction direction)
Get the orthogonal direction clockwise.
Direction nextCCW(Direction direction)
Get the next direction counter-clockwise.
Direction opposite(Direction direction)
Get the opposite direction.
The south orientation.
The south-west orientation.
Direction nextCW(Direction direction)
Get the next direction clockwise.
The north-east orientation.
The south-east orientation.
Vector2f unit(Direction direction)
Get a unit vector from a direction.
The namespace for gf classes.
Definition: Action.h:34
The east orientation.
The west orientation.
float angle(Direction direction)
Get an angle from a direction.
The north orientation.
Orientation
Cardinal and ordinal orientation.
Definition: Orientation.h:42
Centered alignment.
The north-west orientation.