diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-02 19:34:48 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-02 19:34:48 -0500 |
commit | 93b3e4004387047c25b2f5a190aced01c9091934 (patch) | |
tree | 4bc8ff58dd7198bb2bfed77122547c9599b0ef0f /src/direction.h | |
parent | 9f0e76a47da72573863b22bda72d55e6010def6b (diff) | |
download | tanetane-93b3e4004387047c25b2f5a190aced01c9091934.tar.gz tanetane-93b3e4004387047c25b2f5a190aced01c9091934.tar.bz2 tanetane-93b3e4004387047c25b2f5a190aced01c9091934.zip |
Added collision with map tiles
Diffstat (limited to 'src/direction.h')
-rw-r--r-- | src/direction.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/direction.h b/src/direction.h index ebc0e46..a83a6f8 100644 --- a/src/direction.h +++ b/src/direction.h | |||
@@ -41,4 +41,14 @@ inline vec2i unitVecInDirection(Direction dir) { | |||
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | inline bool dirHasDir(Direction value, Direction inner) { | ||
45 | switch (inner) { | ||
46 | case Direction::up: return value == Direction::up_left || value == Direction::up || value == Direction::up_right; | ||
47 | case Direction::down: return value == Direction::down_left || value == Direction::down || value == Direction::down_right; | ||
48 | case Direction::left: return value == Direction::up_left || value == Direction::left || value == Direction::down_left; | ||
49 | case Direction::right: return value == Direction::up_right || value == Direction::right || value == Direction::down_right; | ||
50 | default: return value == inner; | ||
51 | } | ||
52 | } | ||
53 | |||
44 | #endif /* end of include guard: DIRECTION_H_AB66A90E */ | 54 | #endif /* end of include guard: DIRECTION_H_AB66A90E */ |