ppsspp/UI/TiltEventProcessor.h

43 lines
1.1 KiB
C
Raw Normal View History

namespace TiltEventProcessor {
enum TiltTypes{
TILT_NULL = 0,
TILT_ANALOG,
TILT_DPAD,
2015-12-21 07:16:45 +00:00
TILT_ACTION_BUTTON,
TILT_TRIGGER_BUTTON,
};
//Represents a generic Tilt event
2015-12-21 07:03:34 +00:00
struct Tilt {
Tilt() : x_(0), y_(0) {}
Tilt(const float x, const float y) : x_(x), y_(y) {}
float x_, y_;
};
Tilt NormalizeTilt(const Tilt &tilt);
//generates a tilt in the correct coordinate system based on
//calibration. BaseTilt is the "base" / "zero" tilt. currentTilt is the
//sensor tilt reading at this moment.
//NOTE- both base and current tilt *MUST BE NORMALIZED* by calling the NormalizeTilt() function.
Tilt GenTilt(const Tilt &baseTilt, const Tilt &currentTilt, bool invertX, bool invertY, float deadzone, float xSensitivity, float ySensitivity);
2015-12-21 07:03:34 +00:00
void TranslateTiltToInput(const Tilt &tilt);
2015-12-21 07:03:34 +00:00
//the next functions generate tilt events given the current Tilt amount,
//and the deadzone radius.
void GenerateAnalogStickEvent(const Tilt &tilt);
void GenerateDPadEvent(const Tilt &tilt);
2015-12-21 07:16:45 +00:00
void GenerateActionButtonEvent(const Tilt &tilt);
void GenerateTriggerButtonEvent(const Tilt &tilt);
void ResetTiltEvents();
}