-
Notifications
You must be signed in to change notification settings - Fork 0
/
QRetroSensors.h
46 lines (38 loc) · 1008 Bytes
/
QRetroSensors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef QRETRO_SENSORS_H
#define QRETRO_SENSORS_H
#if QRETRO_HAVE_SENSORS
#include <QAccelerometer>
#include <QAmbientLightSensor>
#include <QRotationSensor>
#endif
#include "libretro.h"
/**
* A class managing the values of various external sensors the libretro API
* defines.
* @todo Rate limiting, multiport, illuminance, spoofing, and testing
*/
class QRetroSensors
{
public:
QRetroSensors();
float getInput(unsigned port, unsigned id);
bool setState(unsigned port, retro_sensor_action action, unsigned rate);
private:
#if QRETRO_HAVE_SENSORS
QAccelerometer m_AccelerometerSensor;
#endif
bool m_AccelerometerEnabled = false;
unsigned m_AccelerometerRate = 0;
#if QRETRO_HAVE_SENSORS
QRotationSensor m_GyroscopeSensor;
#endif
bool m_GyroscopeEnabled = false;
unsigned m_GyroscopeRate = 0;
#if QRETRO_HAVE_SENSORS
QAmbientLightSensor m_IlluminanceSensor;
#endif
bool m_IlluminanceEnabled = false;
unsigned m_IlluminanceRate = 0;
float m_IlluminanceValue = 0;
};
#endif