summaryrefslogtreecommitdiff
path: root/src/common/emu_window.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/emu_window.h')
-rw-r--r--src/common/emu_window.h52
1 files changed, 50 insertions, 2 deletions
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index a0ae4c9fa..7c3486dea 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -105,7 +105,7 @@ public:
105 * @todo Fix this function to be thread-safe. 105 * @todo Fix this function to be thread-safe.
106 * @return PadState object indicating the current pad state 106 * @return PadState object indicating the current pad state
107 */ 107 */
108 const Service::HID::PadState GetPadState() const { 108 Service::HID::PadState GetPadState() const {
109 return pad_state; 109 return pad_state;
110 } 110 }
111 111
@@ -116,11 +116,59 @@ public:
116 * @return std::tuple of (x, y, pressed) where `x` and `y` are the touch coordinates and 116 * @return std::tuple of (x, y, pressed) where `x` and `y` are the touch coordinates and
117 * `pressed` is true if the touch screen is currently being pressed 117 * `pressed` is true if the touch screen is currently being pressed
118 */ 118 */
119 const std::tuple<u16, u16, bool> GetTouchState() const { 119 std::tuple<u16, u16, bool> GetTouchState() const {
120 return std::make_tuple(touch_x, touch_y, touch_pressed); 120 return std::make_tuple(touch_x, touch_y, touch_pressed);
121 } 121 }
122 122
123 /** 123 /**
124 * Gets the current accelerometer state (acceleration along each three axis).
125 * Axis explained:
126 * +x is the same direction as LEFT on D-pad.
127 * +y is normal to the touch screen, pointing outward.
128 * +z is the same direction as UP on D-pad.
129 * Units:
130 * 1 unit of return value = 1/512 g (measured by hw test),
131 * where g is the gravitational acceleration (9.8 m/sec2).
132 * @note This should be called by the core emu thread to get a state set by the window thread.
133 * @todo Implement accelerometer input in front-end.
134 * @return std::tuple of (x, y, z)
135 */
136 std::tuple<s16, s16, s16> GetAccelerometerState() const {
137 // stubbed
138 return std::make_tuple(0, -512, 0);
139 }
140
141 /**
142 * Gets the current gyroscope state (angular rates about each three axis).
143 * Axis explained:
144 * +x is the same direction as LEFT on D-pad.
145 * +y is normal to the touch screen, pointing outward.
146 * +z is the same direction as UP on D-pad.
147 * Orientation is determined by right-hand rule.
148 * Units:
149 * 1 unit of return value = (1/coef) deg/sec,
150 * where coef is the return value of GetGyroscopeRawToDpsCoefficient().
151 * @note This should be called by the core emu thread to get a state set by the window thread.
152 * @todo Implement gyroscope input in front-end.
153 * @return std::tuple of (x, y, z)
154 */
155 std::tuple<s16, s16, s16> GetGyroscopeState() const {
156 // stubbed
157 return std::make_tuple(0, 0, 0);
158 }
159
160 /**
161 * Gets the coefficient for units conversion of gyroscope state.
162 * The conversion formula is r = coefficient * v,
163 * where v is angular rate in deg/sec,
164 * and r is the gyroscope state.
165 * @return float-type coefficient
166 */
167 f32 GetGyroscopeRawToDpsCoefficient() const {
168 return 14.375f; // taken from hw test, and gyroscope's document
169 }
170
171 /**
124 * Returns currently active configuration. 172 * Returns currently active configuration.
125 * @note Accesses to the returned object need not be consistent because it may be modified in another thread 173 * @note Accesses to the returned object need not be consistent because it may be modified in another thread
126 */ 174 */