Files
jminos/src/Core/Action.h
2025-03-25 17:17:36 +01:00

59 lines
1.0 KiB
C++

#pragma once
#include <iostream>
/**
* The list of in-game actions that can be taken by the player
*/
enum Action {
PAUSE,
RETRY,
HOLD,
SOFT_DROP,
HARD_DROP,
MOVE_LEFT,
MOVE_RIGHT,
ROTATE_0,
ROTATE_CW,
ROTATE_180,
ROTATE_CCW
};
static const Action ACTION_LIST_IN_ORDER[] = { // the list of possible actions in a sorted order
MOVE_LEFT,
MOVE_RIGHT,
SOFT_DROP,
HARD_DROP,
ROTATE_CW,
ROTATE_CCW,
ROTATE_180,
ROTATE_0,
HOLD,
PAUSE,
RETRY
};
static const std::string ACTION_NAMES[] = { // name representation for each actions
"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;
}