Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 3, 2008, 1:26:48 PM (16 years ago)
Author:
rgrieder
Message:

Fixed two issues with input:

  • Buffer gets cleared now when the window focus changes
  • Added a configValue in the InGameConsole:

Until now the input was always transparent to the level when activating the console (exception keyboard input of course)
bHidesAllInput_ can change that setting (configured in orxonox.ini)

@Oli: Sorry, couldn't apply the patch in the network branch because of conflicts (I have already made some changes to the InputManager in the trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/input/InputManager.cc

    r1788 r1878  
    6565
    6666    std::string InputManager::bindingCommmandString_s = "";
     67    EmptyHandler InputManager::EMPTY_HANDLER;
    6768    InputManager* InputManager::singletonRef_s = 0;
    6869
     
    189190
    190191            stateEmpty_ = createInputState<SimpleInputState>("empty", -1);
    191             stateEmpty_->setHandler(new EmptyHandler());
     192            stateEmpty_->setHandler(&EMPTY_HANDLER);
    192193            activeStates_[stateEmpty_->getPriority()] = stateEmpty_;
    193194
     
    198199
    199200            stateCalibrator_ = createInputState<SimpleInputState>("calibrator", 100);
    200             stateCalibrator_->setHandler(new EmptyHandler());
     201            stateCalibrator_->setHandler(&EMPTY_HANDLER);
    201202            InputBuffer* buffer = new InputBuffer();
    202203            buffer->registerListener(this, &InputManager::_completeCalibration, '\r', true);
     
    430431
    431432                // clear our own states
    432                 stateEmpty_->removeAndDestroyAllHandlers();
    433                 stateCalibrator_->removeAndDestroyAllHandlers();
    434                 stateDetector_->removeAndDestroyAllHandlers();
     433                //stateEmpty_->removeAndDestroyAllHandlers();
     434                //stateCalibrator_->removeAndDestroyAllHandlers();
     435                //stateDetector_->removeAndDestroyAllHandlers();
     436                // TODO: Memory Leak when not deleting the handlers!!!
    435437
    436438                // kick all active states 'nicely'
     
    680682        }
    681683        stateDestroyRequests_.clear();
     684
     685        // check whether a state has changed its EMPTY_HANDLER situation
     686        bool bUpdateRequired = false;
     687        for (std::map<int, InputState*>::iterator it = activeStates_.begin(); it != activeStates_.end(); ++it)
     688        {
     689            if (it->second->handlersChanged())
     690            {
     691                it->second->resetHandlersChanged();
     692                bUpdateRequired = true;
     693            }
     694        }
     695        if (bUpdateRequired)
     696            _updateActiveStates();
    682697
    683698        // mark that we capture and distribute input
     
    826841        requestLeaveState("calibrator");
    827842        bCalibrating_ = false;
     843    }
     844
     845    void InputManager::clearBuffers()
     846    {
     847        this->keysDown_.clear();
     848        this->mouseButtonsDown_.clear();
     849        for (unsigned int i = 0; i < this->joySticksSize_; ++i)
     850            this->joyStickButtonsDown_[i].clear();
    828851    }
    829852
Note: See TracChangeset for help on using the changeset viewer.