Files
jminos/src/Core/Action.h
2025-03-02 23:36:20 +01:00

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;
}