1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 03:40:14 +00:00
OpenMW/apps/openmw/mwinput/sensormanager.hpp
2022-01-19 18:09:37 +01:00

59 lines
1.1 KiB
C++

#ifndef MWINPUT_MWSENSORMANAGER_H
#define MWINPUT_MWSENSORMANAGER_H
#include <SDL_sensor.h>
#include <osg/Matrixf>
#include <osg/Vec3f>
#include <components/settings/settings.hpp>
#include <components/sdlutil/events.hpp>
namespace SDLUtil
{
class InputWrapper;
}
namespace MWWorld
{
class Player;
}
namespace MWInput
{
class SensorManager : public SDLUtil::SensorListener
{
public:
SensorManager();
virtual ~SensorManager();
void init();
void update(float dt);
void sensorUpdated(const SDL_SensorEvent &arg) override;
void displayOrientationChanged() override;
void processChangedSettings(const Settings::CategorySettingVector& changed);
void setGuiCursorEnabled(bool enabled) { mGuiCursorEnabled = enabled; }
bool isGyroAvailable() const;
std::array<float, 3> getGyroValues() const;
private:
void updateSensors();
void correctGyroscopeAxes();
osg::Matrixf mRotation;
osg::Vec3f mGyroValues;
float mGyroUpdateTimer;
SDL_Sensor* mGyroscope;
bool mGuiCursorEnabled;
};
}
#endif