private void fireControlPress ( int index , int controllerIndex ) { consumed = false ; for ( int i = 0 ; i < controllerListeners . size ( ) ; i ++ ) { ControllerListener listener = ( ControllerListener ) controllerListeners . get ( i ) ; if ( listener . isAcceptingInput ( ) ) { switch ( index ) { case LEFT : listener . controllerLeftPressed ( controllerIndex ) ; break ; case RIGHT : listener . controllerRightPressed ( controllerIndex ) ; break ; case UP : listener . controllerUpPressed ( controllerIndex ) ; break ; case DOWN : listener . controllerDownPressed ( controllerIndex ) ; break ; default : // assume button pressed listener . controllerButtonPressed ( controllerIndex , ( index - BUTTON1 ) + 1 ) ; break ; } if ( consumed ) { break ; } } } }
Fire an event indicating that a control has been pressed