48 lines
773 B
C++
48 lines
773 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
|
|
|
|
/**
|
|
* The list of actions that can be taken by the player
|
|
*/
|
|
enum Action {
|
|
QUIT,
|
|
PAUSE,
|
|
RETRY,
|
|
HOLD,
|
|
SOFT_DROP,
|
|
HARD_DROP,
|
|
MOVE_LEFT,
|
|
MOVE_RIGHT,
|
|
ROTATE_0,
|
|
ROTATE_CW,
|
|
ROTATE_180,
|
|
ROTATE_CCW
|
|
};
|
|
|
|
|
|
static const std::string ACTION_NAMES[] = { // name for each action
|
|
"Quit",
|
|
"Pause",
|
|
"Retry",
|
|
"Hold",
|
|
"Soft drop",
|
|
"Hard drop",
|
|
"Move left",
|
|
"Move right",
|
|
"Rotate 0°",
|
|
"Rotate CW",
|
|
"Rotate 180°",
|
|
"Rotate CCW"
|
|
};
|
|
|
|
/**
|
|
* Stream output operator, adds the name of the action
|
|
* @return A reference to the output stream
|
|
*/
|
|
inline std::ostream& operator<<(std::ostream& os, const Action action) {
|
|
os << ACTION_NAMES[action];
|
|
return os;
|
|
}
|