src/sdl/input.cc
/*
 * Determines if the given keycode belongs to any button in the mapping,
 * releases that button if it does.
 *
 * Assumes the mapping has been initialized.
 * Assumes SDL has been initialized.
 */
Determines if the given keycode belongs to any button in the mapping,
releases that button if it does.

Assumes the mapping has been initialized.
Assumes SDL has been initialized.
Determines if the given keycode belongs to any button in the mapping releases that button if it does . Assumes the mapping has been initialized . Assumes SDL has been initialized .
void Input::Release(SDL_Keycode key) {
  size_t button = 0;
  while ((button < NUM_BUTTONS) && (button_map_[button] != key)) { button++; }
  if (button >= NUM_BUTTONS) { return; }
  switch(button) {
    case MAP_A:
      input_status_ &= ~FLAG_A;
      break;
    case MAP_B:
      input_status_ &= ~FLAG_B;
      break;
    case MAP_SELECT:
      input_status_ &= ~FLAG_SELECT;
      break;
    case MAP_START:
      input_status_ &= ~FLAG_START;
      break;
    case MAP_UP:
      dpad_priority_up_ = false;
      input_status_ &= ~FLAG_UP;
      break;
    case MAP_DOWN:
      dpad_priority_up_ = true;
      input_status_ &= ~FLAG_DOWN;
      break;
    case MAP_LEFT:
      dpad_priority_left_ = false;
      input_status_ &= ~FLAG_LEFT;
      break;
    case MAP_RIGHT:
      dpad_priority_left_ = true;
      input_status_ &= ~FLAG_RIGHT;
      break;
    default:
      break;
  }
  return;
}
void Input :: Release ( SDL_Keycode key ) { size_t button = 0 ; while ( ( button < NUM_BUTTONS ) && ( button_map_ [ button ] != key ) ) { button ++ ; } if ( button >= NUM_BUTTONS ) { return ; } switch ( button ) { case MAP_A : input_status_ &= ~ FLAG_A ; break ; case MAP_B : input_status_ &= ~ FLAG_B ; break ; case MAP_SELECT : input_status_ &= ~ FLAG_SELECT ; break ; case MAP_START : input_status_ &= ~ FLAG_START ; break ; case MAP_UP : dpad_priority_up_ = false ; input_status_ &= ~ FLAG_UP ; break ; case MAP_DOWN : dpad_priority_up_ = true ; input_status_ &= ~ FLAG_DOWN ; break ; case MAP_LEFT : dpad_priority_left_ = false ; input_status_ &= ~ FLAG_LEFT ; break ; case MAP_RIGHT : dpad_priority_left_ = true ; input_status_ &= ~ FLAG_RIGHT ; break ; default : break ; } return ; }
Determines if the given keycode belongs to any button in the mapping,
 releases that button if it does.
Determines if the given keycode belongs to any button in the mapping releases that button if it does .
// Determine which button was released, if any. // If the button is not in the map, we do nothing. // Otherwise, we update the released button in the input status.