pacman/lib/include/Direction.hpp

30 lines
469 B
C++
Raw Normal View History

2021-06-10 12:42:51 +00:00
#pragma once
2020-11-27 13:10:09 +00:00
2021-07-05 12:10:01 +00:00
namespace pacman {
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;
}
2021-07-05 12:10:01 +00:00
} // namespace pacman