ajouté interface textuelle
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
/**
|
||||
* The list of actions that can be taken by the player
|
||||
*/
|
||||
enum Action {
|
||||
QUIT,
|
||||
PAUSE,
|
||||
RETRY,
|
||||
HOLD,
|
||||
@@ -12,7 +15,33 @@ enum Action {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user