mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	Merge branch 'controller-bindings' into 'master'
Allow user controller bindings See merge request OpenMW/openmw!135
This commit is contained in:
		
						commit
						793016f163
					
				
					 5 changed files with 20 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -22,6 +22,7 @@ Programmers
 | 
			
		|||
    alexanderkjall
 | 
			
		||||
    Alexander Nadeau (wareya)
 | 
			
		||||
    Alexander Olofsson (Ace)
 | 
			
		||||
    Alex Rice
 | 
			
		||||
    Alex S (docwest)
 | 
			
		||||
    Allofich
 | 
			
		||||
    Andrei Kortunov (akortunov)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -153,6 +153,7 @@
 | 
			
		|||
    Feature #5046: Gamepad thumbstick cursor speed
 | 
			
		||||
    Feature #5051: Provide a separate textures for scrollbars
 | 
			
		||||
    Feature #5094: Unix like console hotkeys
 | 
			
		||||
    Feature #5098: Allow user controller bindings
 | 
			
		||||
    Task #4686: Upgrade media decoder to a more current FFmpeg API
 | 
			
		||||
    Task #4695: Optimize Distant Terrain memory consumption
 | 
			
		||||
    Task #4789: Optimize cell transitions
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -515,8 +515,17 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
 | 
			
		|||
        controllerFileName = "gamecontrollerdb.txt";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const std::string userdefault = mCfgMgr.getUserConfigPath().string() + "/" + controllerFileName;
 | 
			
		||||
    const std::string localdefault = mCfgMgr.getLocalPath().string() + "/" + controllerFileName;
 | 
			
		||||
    const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/" + controllerFileName;
 | 
			
		||||
 | 
			
		||||
    std::string userGameControllerdb;
 | 
			
		||||
    if (boost::filesystem::exists(userdefault)){
 | 
			
		||||
        userGameControllerdb = userdefault;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
        userGameControllerdb = "";
 | 
			
		||||
 | 
			
		||||
    std::string gameControllerdb;
 | 
			
		||||
    if (boost::filesystem::exists(localdefault))
 | 
			
		||||
        gameControllerdb = localdefault;
 | 
			
		||||
| 
						 | 
				
			
			@ -525,7 +534,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
 | 
			
		|||
    else
 | 
			
		||||
        gameControllerdb = ""; //if it doesn't exist, pass in an empty string
 | 
			
		||||
 | 
			
		||||
    MWInput::InputManager* input = new MWInput::InputManager (mWindow, mViewer, mScreenCaptureHandler, mScreenCaptureOperation, keybinderUser, keybinderUserExists, gameControllerdb, mGrab);
 | 
			
		||||
    MWInput::InputManager* input = new MWInput::InputManager (mWindow, mViewer, mScreenCaptureHandler, mScreenCaptureOperation, keybinderUser, keybinderUserExists, userGameControllerdb, gameControllerdb, mGrab);
 | 
			
		||||
    mEnvironment.setInputManager (input);
 | 
			
		||||
 | 
			
		||||
    std::string myguiResources = (mResDir / "mygui").string();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,6 +39,7 @@ namespace MWInput
 | 
			
		|||
            osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler,
 | 
			
		||||
            osgViewer::ScreenCaptureHandler::CaptureOperation *screenCaptureOperation,
 | 
			
		||||
            const std::string& userFile, bool userFileExists,
 | 
			
		||||
            const std::string& userControllerBindingsFile,
 | 
			
		||||
            const std::string& controllerBindingsFile, bool grab)
 | 
			
		||||
        : mWindow(window)
 | 
			
		||||
        , mWindowVisible(true)
 | 
			
		||||
| 
						 | 
				
			
			@ -113,10 +114,14 @@ namespace MWInput
 | 
			
		|||
 | 
			
		||||
        // Load controller mappings
 | 
			
		||||
#if SDL_VERSION_ATLEAST(2,0,2)
 | 
			
		||||
        if(controllerBindingsFile!="")
 | 
			
		||||
        if(!controllerBindingsFile.empty())
 | 
			
		||||
        {
 | 
			
		||||
            SDL_GameControllerAddMappingsFromFile(controllerBindingsFile.c_str());
 | 
			
		||||
        }
 | 
			
		||||
        if(!userControllerBindingsFile.empty())
 | 
			
		||||
        {
 | 
			
		||||
            SDL_GameControllerAddMappingsFromFile(userControllerBindingsFile.c_str());
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        // Open all presently connected sticks
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,6 +76,7 @@ namespace MWInput
 | 
			
		|||
            osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler,
 | 
			
		||||
            osgViewer::ScreenCaptureHandler::CaptureOperation *screenCaptureOperation,
 | 
			
		||||
            const std::string& userFile, bool userFileExists,
 | 
			
		||||
            const std::string& userControllerBindingsFile,
 | 
			
		||||
            const std::string& controllerBindingsFile, bool grab);
 | 
			
		||||
 | 
			
		||||
        virtual ~InputManager();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue