home · contact · privacy
More code re-styling and documentation.
[plomrogue] / src / yx_uint16.h
1 /*  yx_uint16.h
2  *
3  *  Structs and routines for coordinates and movement in 2-dimensional space
4  *  (such as the ncurses screen and game maps).
5  */
6
7 #ifndef YX_UINT16_H
8 #define YX_UINT16_H
9
10 #include <stdint.h>
11
12 /* Coordinates for maps of max. 65536x65536 cells. */
13 struct yx_uint16
14 {
15     uint16_t y;
16     uint16_t x;
17 };
18
19 /* This encodes directions. */
20
21 enum dir
22 {
23     NORTH = 1,
24     EAST  = 2,
25     SOUTH = 3,
26     WEST  = 4
27 };
28
29 /* Return 1 if two yx_uint16 coordinates a and b are equal, else 0. */
30 extern char yx_uint16_cmp(struct yx_uint16 a, struct yx_uint16 b);
31
32 /* Return yx_uint16 coordinate one step from coordinate yx in direction dir. */
33 extern struct yx_uint16 mv_yx_in_dir(enum dir d, struct yx_uint16 yx);
34
35 #endif