summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-03-26 02:07:21 +0100
committerbunnei <bunneidev@gmail.com>2016-03-26 02:07:21 +0100
commit39da819b5564a495db78f869062123fbab5fec3d (patch)
tree09d2667918cb0111b7bcb5f9cd9d5ce1b4b7b7ff /src/common
parentMerge pull request #1566 from MerryMage/audio-codec (diff)
parentimplement GyroscopeCalibrateParam (diff)
downloadyuzu-39da819b5564a495db78f869062123fbab5fec3d.tar
yuzu-39da819b5564a495db78f869062123fbab5fec3d.tar.gz
yuzu-39da819b5564a495db78f869062123fbab5fec3d.tar.bz2
yuzu-39da819b5564a495db78f869062123fbab5fec3d.tar.lz
yuzu-39da819b5564a495db78f869062123fbab5fec3d.tar.xz
yuzu-39da819b5564a495db78f869062123fbab5fec3d.tar.zst
yuzu-39da819b5564a495db78f869062123fbab5fec3d.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/emu_window.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index a0ae4c9fa..b6b7bfd26 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -121,6 +121,54 @@ public:
}
/**
+ * Gets the current accelerometer state (acceleration along each three axis).
+ * Axis explained:
+ * +x is the same direction as LEFT on D-pad.
+ * +y is normal to the touch screen, pointing outward.
+ * +z is the same direction as UP on D-pad.
+ * Units:
+ * 1 unit of return value = 1/512 g (measured by hw test),
+ * where g is the gravitational acceleration (9.8 m/sec2).
+ * @note This should be called by the core emu thread to get a state set by the window thread.
+ * @todo Implement accelerometer input in front-end.
+ * @return std::tuple of (x, y, z)
+ */
+ std::tuple<s16, s16, s16> GetAccelerometerState() const {
+ // stubbed
+ return std::make_tuple(0, -512, 0);
+ }
+
+ /**
+ * Gets the current gyroscope state (angular rates about each three axis).
+ * Axis explained:
+ * +x is the same direction as LEFT on D-pad.
+ * +y is normal to the touch screen, pointing outward.
+ * +z is the same direction as UP on D-pad.
+ * Orientation is determined by right-hand rule.
+ * Units:
+ * 1 unit of return value = (1/coef) deg/sec,
+ * where coef is the return value of GetGyroscopeRawToDpsCoefficient().
+ * @note This should be called by the core emu thread to get a state set by the window thread.
+ * @todo Implement gyroscope input in front-end.
+ * @return std::tuple of (x, y, z)
+ */
+ std::tuple<s16, s16, s16> GetGyroscopeState() const {
+ // stubbed
+ return std::make_tuple(0, 0, 0);
+ }
+
+ /**
+ * Gets the coefficient for units conversion of gyroscope state.
+ * The conversion formula is r = coefficient * v,
+ * where v is angular rate in deg/sec,
+ * and r is the gyroscope state.
+ * @return float-type coefficient
+ */
+ f32 GetGyroscopeRawToDpsCoefficient() const {
+ return 14.375f; // taken from hw test, and gyroscope's document
+ }
+
+ /**
* Returns currently active configuration.
* @note Accesses to the returned object need not be consistent because it may be modified in another thread
*/