metaforce/Runtime/Input/ControlMapper.hpp

140 lines
3.1 KiB
C++
Raw Permalink Normal View History

2018-10-06 20:42:33 -07:00
#pragma once
2015-08-27 17:11:31 -07:00
#include <type_traits>
#include "Input/CKeyboardMouseController.hpp"
2019-01-20 20:10:34 -08:00
2021-04-10 01:42:06 -07:00
namespace metaforce {
2018-02-03 22:46:47 -08:00
struct CFinalInput;
2015-08-27 17:11:31 -07:00
2018-12-07 21:30:43 -08:00
class ControlMapper {
2015-08-27 17:11:31 -07:00
public:
2018-12-07 21:30:43 -08:00
enum class ECommands {
Forward,
Backward,
TurnLeft,
TurnRight,
StrafeLeft,
StrafeRight,
LookLeft,
LookRight,
LookUp,
LookDown,
JumpOrBoost = 10,
FireOrBomb = 11,
MissileOrPowerBomb = 12,
Morph,
AimUp,
AimDown,
CycleBeamUp,
CycleBeamDown,
CycleItem,
PowerBeam,
IceBeam,
WaveBeam,
PlasmaBeam,
ToggleHolster = 23,
OrbitClose,
OrbitFar,
OrbitObject,
OrbitSelect,
OrbitConfirm,
OrbitLeft,
OrbitRight,
OrbitUp,
OrbitDown,
LookHold1,
LookHold2,
LookZoomIn,
LookZoomOut,
AimHold,
MapCircleUp,
MapCircleDown,
MapCircleLeft,
MapCircleRight,
MapMoveForward,
MapMoveBack,
MapMoveLeft,
MapMoveRight,
MapZoomIn,
MapZoomOut,
SpiderBall,
ChaseCamera,
XrayVisor = 50,
ThermoVisor = 51,
InviroVisor = 52,
NoVisor = 53,
VisorMenu,
VisorUp,
VisorDown,
ShowCrosshairs,
UseSheild = 0x3B,
ScanItem = 0x3C,
PreviousPauseScreen = 0x41,
NextPauseScreen = 0x42,
UNKNOWN,
None,
MAX
};
2015-08-27 17:11:31 -07:00
2018-12-07 21:30:43 -08:00
enum class EFunctionList {
None,
LeftStickUp,
LeftStickDown,
LeftStickLeft,
LeftStickRight,
RightStickUp,
RightStickDown,
RightStickLeft,
RightStickRight,
LeftTrigger,
RightTrigger,
DPadUp,
DPadDown,
DPadLeft,
DPadRight,
AButton,
BButton,
XButton,
YButton,
ZButton,
LeftTriggerPress,
RightTriggerPress,
Start,
MAX // default case
};
2015-08-27 17:11:31 -07:00
2019-01-20 20:10:34 -08:00
enum class EKBMFunctionList {
None,
KeyPress,
SpecialKeyPress = 259,
MousePress = 285,
MAX = 291 /* Provide space for keys/buttons within base actions */
};
2018-12-07 21:30:43 -08:00
static void SetCommandFiltered(ECommands cmd, bool filtered);
static void ResetCommandFilters();
static bool GetPressInput(ECommands cmd, const CFinalInput& input);
static bool GetDigitalInput(ECommands cmd, const CFinalInput& input);
static float GetAnalogInput(ECommands cmd, const CFinalInput& input);
static const char* GetDescriptionForCommand(ECommands cmd);
static const char* GetDescriptionForFunction(EFunctionList func);
2015-08-27 17:11:31 -07:00
};
2019-01-20 20:10:34 -08:00
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, char b) {
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
}
2022-07-29 13:16:55 -07:00
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, ESpecialKey b) {
2019-01-20 20:10:34 -08:00
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
}
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, EMouseButton b) {
2019-01-20 20:10:34 -08:00
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
}
2021-04-10 01:42:06 -07:00
} // namespace metaforce