pacman/lib/Direction.hpp

26 lines
426 B
C++
Raw Normal View History

2021-06-10 12:42:51 +00:00
#pragma once
2020-11-27 13:10:09 +00:00
enum class Direction {
NONE,
LEFT,
RIGHT,
UP,
DOWN
};
2021-06-28 10:42:21 +00:00
inline Direction oppositeDirection(Direction d) {
switch (d) {
case Direction::LEFT:
return Direction::RIGHT;
case Direction::RIGHT:
return Direction::LEFT;
case Direction::UP:
return Direction::DOWN;
case Direction::DOWN:
return Direction::UP;
case Direction::NONE:
return d;
}
return d;
}