From be9ccb73bc20b03f62c77f5d529602a10ef4eda9 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 12 Mar 2022 12:09:58 -0500 Subject: player has a sprite now thanks to world of solaria --- src/direction.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/direction.h (limited to 'src/direction.h') diff --git a/src/direction.h b/src/direction.h new file mode 100644 index 0000000..0fe3e5a --- /dev/null +++ b/src/direction.h @@ -0,0 +1,22 @@ +#ifndef DIRECTION_H_42BDAFB9 +#define DIRECTION_H_42BDAFB9 + +#include +#include + +enum class Direction { + up, + down, + left, + right +}; + +inline Direction directionFromString(std::string_view str) { + if (str == "up") return Direction::up; + if (str == "right") return Direction::right; + if (str == "down") return Direction::down; + if (str == "left") return Direction::left; + throw std::invalid_argument("Invalid direction: " + std::string(str)); +} + +#endif /* end of include guard: DIRECTION_H_42BDAFB9 */ -- cgit 1.4.1