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-10-05 12:30:34 +00:00
|
|
|
bool enableAI = false;
|
2021-07-08 14:57:18 +00:00
|
|
|
|
2021-08-02 13:31:32 +00:00
|
|
|
Direction direction() const {
|
2021-10-06 09:16:32 +00:00
|
|
|
if (up)
|
2021-07-08 14:57:18 +00:00
|
|
|
return Direction::UP;
|
2021-10-06 09:16:32 +00:00
|
|
|
if (down)
|
2021-07-08 14:57:18 +00:00
|
|
|
return Direction::DOWN;
|
2021-10-06 11:38:24 +00:00
|
|
|
if (left)
|
|
|
|
return Direction::LEFT;
|
|
|
|
if (right)
|
|
|
|
return Direction::RIGHT;
|
2021-10-06 09:16:32 +00:00
|
|
|
return Direction::NONE;
|
2021-07-08 14:57:18 +00:00
|
|
|
}
|
2020-11-27 13:10:09 +00:00
|
|
|
};
|
2021-07-05 12:10:01 +00:00
|
|
|
|
|
|
|
} // namespace pacman
|