From f3166702d7dd30312b5a401f52941aad43ac51c3 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 30 Jan 2021 13:01:01 -0500 Subject: Added standing/walking animations --- src/direction.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 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..0679a00 --- /dev/null +++ b/src/direction.h @@ -0,0 +1,30 @@ +#ifndef DIRECTION_H_AB66A90E +#define DIRECTION_H_AB66A90E + +#include +#include + +enum class Direction { + up, + up_right, + right, + down_right, + down, + down_left, + left, + up_left +}; + +inline Direction directionFromString(std::string_view str) { + if (str == "up") return Direction::up; + if (str == "up_right") return Direction::up_right; + if (str == "right") return Direction::right; + if (str == "down_right") return Direction::down_right; + if (str == "down") return Direction::down; + if (str == "down_left") return Direction::down_left; + if (str == "left") return Direction::left; + if (str == "up_left") return Direction::up_left; + throw std::invalid_argument("Invalid direction: " + std::string(str)); +} + +#endif /* end of include guard: DIRECTION_H_AB66A90E */ -- cgit 1.4.1