From 93b3e4004387047c25b2f5a190aced01c9091934 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 2 Feb 2021 19:34:48 -0500 Subject: Added collision with map tiles --- src/direction.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/direction.h') 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) { } } +inline bool dirHasDir(Direction value, Direction inner) { + switch (inner) { + case Direction::up: return value == Direction::up_left || value == Direction::up || value == Direction::up_right; + case Direction::down: return value == Direction::down_left || value == Direction::down || value == Direction::down_right; + case Direction::left: return value == Direction::up_left || value == Direction::left || value == Direction::down_left; + case Direction::right: return value == Direction::up_right || value == Direction::right || value == Direction::down_right; + default: return value == inner; + } +} + #endif /* end of include guard: DIRECTION_H_AB66A90E */ -- cgit 1.4.1