mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-03 23:56:43 +00:00 
			
		
		
		
	Merge gyroaxis into gyro manager
This commit is contained in:
		
							parent
							
								
									57ac592973
								
							
						
					
					
						commit
						183ca3079e
					
				
					 5 changed files with 32 additions and 47 deletions
				
			
		| 
						 | 
				
			
			@ -27,7 +27,7 @@ add_openmw_dir (mwrender
 | 
			
		|||
 | 
			
		||||
add_openmw_dir (mwinput
 | 
			
		||||
    actions actionmanager bindingsmanager controllermanager controlswitch
 | 
			
		||||
    inputmanagerimp mousemanager keyboardmanager gyroaxis sensormanager gyromanager
 | 
			
		||||
    inputmanagerimp mousemanager keyboardmanager sensormanager gyromanager
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
add_openmw_dir (mwgui
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,22 +0,0 @@
 | 
			
		|||
#include "gyroaxis.hpp"
 | 
			
		||||
 | 
			
		||||
namespace MWInput
 | 
			
		||||
{
 | 
			
		||||
    GyroscopeAxis gyroscopeAxisFromString(std::string_view s)
 | 
			
		||||
    {
 | 
			
		||||
        if (s == "x")
 | 
			
		||||
            return GyroscopeAxis::X;
 | 
			
		||||
        else if (s == "y")
 | 
			
		||||
            return GyroscopeAxis::Y;
 | 
			
		||||
        else if (s == "z")
 | 
			
		||||
            return GyroscopeAxis::Z;
 | 
			
		||||
        else if (s == "-x")
 | 
			
		||||
            return GyroscopeAxis::Minus_X;
 | 
			
		||||
        else if (s == "-y")
 | 
			
		||||
            return GyroscopeAxis::Minus_Y;
 | 
			
		||||
        else if (s == "-z")
 | 
			
		||||
            return GyroscopeAxis::Minus_Z;
 | 
			
		||||
 | 
			
		||||
        return GyroscopeAxis::Unknown;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,22 +0,0 @@
 | 
			
		|||
#ifndef MWINPUT_GYROAXIS
 | 
			
		||||
#define MWINPUT_GYROAXIS
 | 
			
		||||
 | 
			
		||||
#include <string_view>
 | 
			
		||||
 | 
			
		||||
namespace MWInput
 | 
			
		||||
{
 | 
			
		||||
    enum GyroscopeAxis
 | 
			
		||||
    {
 | 
			
		||||
        Unknown = 0,
 | 
			
		||||
        X = 1,
 | 
			
		||||
        Y = 2,
 | 
			
		||||
        Z = 3,
 | 
			
		||||
        Minus_X = -1,
 | 
			
		||||
        Minus_Y = -2,
 | 
			
		||||
        Minus_Z = -3
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    GyroscopeAxis gyroscopeAxisFromString(std::string_view s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // !MWINPUT_GYROAXIS
 | 
			
		||||
| 
						 | 
				
			
			@ -7,6 +7,24 @@
 | 
			
		|||
 | 
			
		||||
namespace MWInput
 | 
			
		||||
{
 | 
			
		||||
    GyroManager::GyroscopeAxis GyroManager::gyroscopeAxisFromString(std::string_view s)
 | 
			
		||||
    {
 | 
			
		||||
        if (s == "x")
 | 
			
		||||
            return GyroscopeAxis::X;
 | 
			
		||||
        else if (s == "y")
 | 
			
		||||
            return GyroscopeAxis::Y;
 | 
			
		||||
        else if (s == "z")
 | 
			
		||||
            return GyroscopeAxis::Z;
 | 
			
		||||
        else if (s == "-x")
 | 
			
		||||
            return GyroscopeAxis::Minus_X;
 | 
			
		||||
        else if (s == "-y")
 | 
			
		||||
            return GyroscopeAxis::Minus_Y;
 | 
			
		||||
        else if (s == "-z")
 | 
			
		||||
            return GyroscopeAxis::Minus_Z;
 | 
			
		||||
 | 
			
		||||
        return GyroscopeAxis::Unknown;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    GyroManager::GyroManager()
 | 
			
		||||
        : mEnabled(Settings::Manager::getBool("enable gyroscope", "Input"))
 | 
			
		||||
        , mGuiCursorEnabled(true)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
 | 
			
		||||
#include <components/settings/settings.hpp>
 | 
			
		||||
 | 
			
		||||
#include "gyroaxis.hpp"
 | 
			
		||||
 | 
			
		||||
namespace MWInput
 | 
			
		||||
{
 | 
			
		||||
    class GyroManager
 | 
			
		||||
| 
						 | 
				
			
			@ -21,6 +19,19 @@ namespace MWInput
 | 
			
		|||
            void setGuiCursorEnabled(bool enabled) { mGuiCursorEnabled = enabled; }
 | 
			
		||||
 | 
			
		||||
        private:
 | 
			
		||||
            enum GyroscopeAxis
 | 
			
		||||
            {
 | 
			
		||||
                Unknown = 0,
 | 
			
		||||
                X = 1,
 | 
			
		||||
                Y = 2,
 | 
			
		||||
                Z = 3,
 | 
			
		||||
                Minus_X = -1,
 | 
			
		||||
                Minus_Y = -2,
 | 
			
		||||
                Minus_Z = -3
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            static GyroscopeAxis gyroscopeAxisFromString(std::string_view s);
 | 
			
		||||
 | 
			
		||||
            bool mEnabled;
 | 
			
		||||
            bool mGuiCursorEnabled;
 | 
			
		||||
            float mSensitivityH;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue