bool InputActionMapper::handleEvent( const InputEvent& event ) { // See if we have a global input action for this event InputActionStack* foundAction = find( event ); // If we couldn't find the action for the event, the input event may be // handled by one of the other methods of mapping input events to actions if( !foundAction ) { // First check to see if it's handled by any of the active key ranges if( event.isKeyType() ) { int rangeCount = actionsByKeyRange.size(); for( int i=0; i<rangeCount; ++i ) { InputKeyRange& keyRange = actionsByKeyRange[i].first; if( event.keyEvent.keyCode >= keyRange.keyCodeLow && event.keyEvent.keyCode <= keyRange.keyCodeHigh ) { foundAction = actionsByKeyRange[i].second; } } } } // If we were able to find an action for the event, try to handle the event if( foundAction && foundAction->execute( event ) ); return true; return false; }