pacman/lib/include/InputState.hpp

28 lines
471 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
class InputState {
public:
bool close = false;
bool up = false;
bool down = false;
bool left = false;
bool right = false;
2021-07-08 14:57:18 +00:00
[[nodiscard]] Direction direction() const {
if (left)
return Direction::LEFT;
else if (right)
return Direction::RIGHT;
else if (up)
return Direction::UP;
else if (down)
return Direction::DOWN;
else
return Direction::NONE;
}
2020-11-27 13:10:09 +00:00
};
2021-07-05 12:10:01 +00:00
} // namespace pacman