# direction_type.h File Reference

Different types to 'show' directions. More...

`#include "core/enum_type.hpp"`

Go to the source code of this file.

## Data Structures
struct | EnumPropsT< Direction >
| Define basic enum properties. More...
struct | EnumPropsT< DiagDirection >
| Define basic enum properties. More...
## Typedefs
typedef TinyEnumT< Direction > | DirectionByte
typedef TinyEnumT< DiagDirection > | DiagDirectionByte
## Enumerations
enum | Direction { DIR_BEGIN = 0, DIR_N = 0, DIR_NE = 1, DIR_E = 2, DIR_SE = 3, DIR_S = 4, DIR_SW = 5, DIR_W = 6, DIR_NW = 7, DIR_END, INVALID_DIR = 0xFF }
| Defines the 8 directions on the map. More...
enum | DirDiff { DIRDIFF_SAME = 0, DIRDIFF_45RIGHT = 1, DIRDIFF_90RIGHT = 2, DIRDIFF_REVERSE = 4, DIRDIFF_90LEFT = 6, DIRDIFF_45LEFT = 7 }
| Enumeration for the difference between two directions. More...
enum | DiagDirection { DIAGDIR_BEGIN = 0, DIAGDIR_NE = 0, DIAGDIR_SE = 1, DIAGDIR_SW = 2, DIAGDIR_NW = 3, DIAGDIR_END, INVALID_DIAGDIR = 0xFF }
| Enumeration for diagonal directions. More...
enum | DiagDirDiff { DIAGDIRDIFF_SAME = 0, DIAGDIRDIFF_90RIGHT = 1, DIAGDIRDIFF_REVERSE = 2, DIAGDIRDIFF_90LEFT = 3 }
| Enumeration for the difference between to DiagDirection. More...
enum | Axis { AXIS_X = 0, AXIS_Y = 1, AXIS_END, INVALID_AXIS = 0xFF }
| Enumeration for the two axis X and Y. More...
## Functions
| DECLARE_POSTFIX_INCREMENT (Direction)
| Allow incrementing of Direction variables.
| DECLARE_POSTFIX_INCREMENT (DiagDirection)
| Allow incrementing of DiagDirection variables.
| DECLARE_POSTFIX_INCREMENT (DiagDirDiff)
| Allow incrementing of DiagDirDiff variables.

## Detailed Description

Different types to 'show' directions.

Definition in file direction_type.h.

## Enumeration Type Documentation

enum Axis

Enumeration for the two axis X and Y.

This enumeration represente the two axis X and Y in the game. The X axis is the one which goes align the north-west edge (and south-east edge). The Y axis must be so the one which goes align the north-east edge (and south-west) edge.

Enumerator:

  AXIS_X | The X axis.
  AXIS_Y | The y axis.
  AXIS_END | Used for iterations.
  INVALID_AXIS | Flag for an invalid Axis.

Definition at line 127 of file direction_type.h.

enum DiagDirDiff

Enumeration for the difference between to DiagDirection.

As the DiagDirection only contains 4 possible directions the difference between two of these directions can only be in 4 ways. As the DirDiff enumeration the values can be added together and you will get the resulting difference (use modulo DIAGDIR_END).

See also:
  DirDiff

Enumerator:

  DIAGDIRDIFF_SAME | Same directions.
  DIAGDIRDIFF_90RIGHT | 90 degrees right
  DIAGDIRDIFF_REVERSE | Reverse directions.
  DIAGDIRDIFF_90LEFT | 90 degrees left

Definition at line 108 of file direction_type.h.

enum DiagDirection

Enumeration for diagonal directions.

This enumeration is used for the 4 direction of the tile-edges.

Enumerator:

  DIAGDIR_BEGIN | Used for iterations.
  DIAGDIR_NE | Northeast, upper right on your monitor.
  DIAGDIR_SE | Southeast.
  DIAGDIR_SW | Southwest.
  DIAGDIR_NW | Northwest.
  DIAGDIR_END | Used for iterations.
  INVALID_DIAGDIR | Flag for an invalid DiagDirection.

Definition at line 80 of file direction_type.h.

enum DirDiff

Enumeration for the difference between two directions.

This enumeration is used to mark differences between two directions. If you get one direction you can align a second direction in 8 different ways. This enumeration only contains 6 of these 8 differences, but the remaining two can be calculated by adding to differences together. This also means you can add two differences together and get the difference you really want to get. The difference of 45 degrees left + the difference of 45 degrees right results in the difference of 0 degrees.

Note:
  To get this mentioned addition of direction you must use modulo DIR_END or use the ChangeDirDiff(DirDiff, DirDiff) function.

See also:
  ChangeDirDiff(DirDiff, DirDiff)

Enumerator:

  DIRDIFF_SAME | Both directions faces to the same direction.
  DIRDIFF_45RIGHT | Angle of 45 degrees right.
  DIRDIFF_90RIGHT | Angle of 90 degrees right.
  DIRDIFF_REVERSE | One direction is the opposit of the other one.
  DIRDIFF_90LEFT | Angle of 90 degrees left.
  DIRDIFF_45LEFT | Angle of 45 degrees left.

Definition at line 65 of file direction_type.h.

enum Direction

Defines the 8 directions on the map.

This enum defines 8 possible directions which are used for the vehicles in the game. The directions are aligned straight to the viewport, not to the map. So north points to the top of your viewport and not rotated by 45 degrees left or right to get a "north" used in you games.

Enumerator:

  DIR_BEGIN | Used to iterate.
  DIR_N | North.
  DIR_NE | Northeast.
  DIR_E | East.
  DIR_SE | Southeast.
  DIR_S | South.
  DIR_SW | Southwest.
  DIR_W | West.
  DIR_NW | Northwest.
  DIR_END | Used to iterate.
  INVALID_DIR | Flag for an invalid direction.

Definition at line 26 of file direction_type.h.