mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-03 23:26:40 +00:00 
			
		
		
		
	Pressing Enter should skip _one_ message box, not skip all message boxes until the key is released again
This commit is contained in:
		
							parent
							
								
									52d0f0b750
								
							
						
					
					
						commit
						b52df83d84
					
				
					 2 changed files with 7 additions and 12 deletions
				
			
		| 
						 | 
					@ -51,7 +51,6 @@ namespace MWInput
 | 
				
			||||||
        , mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
 | 
					        , mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
 | 
				
			||||||
        , mPreviewPOVDelay(0.f)
 | 
					        , mPreviewPOVDelay(0.f)
 | 
				
			||||||
        , mTimeIdle(0.f)
 | 
					        , mTimeIdle(0.f)
 | 
				
			||||||
        , mEnterPressed(false)
 | 
					 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Ogre::RenderWindow* window = ogre.getWindow ();
 | 
					        Ogre::RenderWindow* window = ogre.getWindow ();
 | 
				
			||||||
        size_t windowHnd;
 | 
					        size_t windowHnd;
 | 
				
			||||||
| 
						 | 
					@ -240,10 +239,6 @@ namespace MWInput
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void InputManager::update(float dt, bool loading)
 | 
					    void InputManager::update(float dt, bool loading)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Pressing enter when a messagebox is prompting for "ok" will activate the ok button 
 | 
					 | 
				
			||||||
        if(mEnterPressed && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox)
 | 
					 | 
				
			||||||
            MWBase::Environment::get().getWindowManager()->enterPressed();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Tell OIS to handle all input events
 | 
					        // Tell OIS to handle all input events
 | 
				
			||||||
        mKeyboard->capture();
 | 
					        mKeyboard->capture();
 | 
				
			||||||
        mMouse->capture();
 | 
					        mMouse->capture();
 | 
				
			||||||
| 
						 | 
					@ -431,8 +426,13 @@ namespace MWInput
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool InputManager::keyPressed( const OIS::KeyEvent &arg )
 | 
					    bool InputManager::keyPressed( const OIS::KeyEvent &arg )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if(arg.key == OIS::KC_RETURN && MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console)
 | 
					        if(arg.key == OIS::KC_RETURN
 | 
				
			||||||
            mEnterPressed = true;
 | 
					            && MWBase::Environment::get().getWindowManager()->isGuiMode()
 | 
				
			||||||
 | 
					            && MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            // Pressing enter when a messagebox is prompting for "ok" will activate the ok button
 | 
				
			||||||
 | 
					            MWBase::Environment::get().getWindowManager()->enterPressed();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        mInputCtrl->keyPressed (arg);
 | 
					        mInputCtrl->keyPressed (arg);
 | 
				
			||||||
        unsigned int text = arg.text;
 | 
					        unsigned int text = arg.text;
 | 
				
			||||||
| 
						 | 
					@ -450,9 +450,6 @@ namespace MWInput
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool InputManager::keyReleased( const OIS::KeyEvent &arg )
 | 
					    bool InputManager::keyReleased( const OIS::KeyEvent &arg )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if(arg.key == OIS::KC_RETURN)
 | 
					 | 
				
			||||||
            mEnterPressed = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        mInputCtrl->keyReleased (arg);
 | 
					        mInputCtrl->keyReleased (arg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
 | 
					        MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,8 +151,6 @@ namespace MWInput
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::map<std::string, bool> mControlSwitch;
 | 
					        std::map<std::string, bool> mControlSwitch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool mEnterPressed;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
        void adjustMouseRegion(int width, int height);
 | 
					        void adjustMouseRegion(int width, int height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue