コード例 #1
0
ファイル: gui_screen.cpp プロジェクト: jcs12311/pingus
void
GUIScreen::process_button_event (const Input::ButtonEvent& event)
{
  //std::cout << "GUIScreen::process_button_event (Input::ButtonEvent* event)" << std::endl;

  if (event.state == Input::BUTTON_PRESSED)
  {
    switch (event.name)
    {
      case Input::PRIMARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::SECONDARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::PAUSE_BUTTON:
        on_pause_press ();
        break;
      case Input::FAST_FORWARD_BUTTON:
        on_fast_forward_press ();
        break;
      case Input::ARMAGEDDON_BUTTON:
        on_armageddon_press ();
        break;
      case Input::ESCAPE_BUTTON:
        on_escape_press ();
        break;
      default:
        perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: " << event.name << std::endl;
        break;
    }
  }
  else if (event.state == Input::BUTTON_RELEASED)
  {
    switch (event.name)
    {
      case Input::PRIMARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::SECONDARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::PAUSE_BUTTON:
        on_pause_release ();
        break;
      case Input::FAST_FORWARD_BUTTON:
        on_fast_forward_release ();
        break;
      case Input::ARMAGEDDON_BUTTON:
        on_armageddon_release ();
        break;
      case Input::ESCAPE_BUTTON:
        on_escape_release ();
        break;
      default:
        perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: " << event.name << std::endl;
        break;
    }
  }
  else
  {
    perr(PINGUS_DEBUG_GUI) << "GUIScreen::process_button_event: got unknown event.state: "
                           << event.state << std::endl;;
  }
}
コード例 #2
0
ファイル: gui_screen.cpp プロジェクト: Tkachov/ceu_pingus
void
GUIScreen::process_button_event (const Input::ButtonEvent& event)
{
  if (event.state == Input::BUTTON_PRESSED)
  {
    switch (event.name)
    {
      case Input::PRIMARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::SECONDARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::PAUSE_BUTTON:
        on_pause_press ();
        break;
      case Input::SINGLE_STEP_BUTTON:
        on_single_step_press();
        break;
      case Input::FAST_FORWARD_BUTTON:
        on_fast_forward_press ();
        break;
      case Input::ARMAGEDDON_BUTTON:
        on_armageddon_press ();
        break;
      case Input::ESCAPE_BUTTON:
        on_escape_press ();
        break;
      case Input::ACTION_UP_BUTTON:
        on_action_up_press();
        break;
      case Input::ACTION_DOWN_BUTTON:
        on_action_down_press();
        break;
      default:
        log_debug("unhandled event: %1%", event.name);
        break;
    }
  }
  else if (event.state == Input::BUTTON_RELEASED)
  {
    switch (event.name)
    {
      case Input::PRIMARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::SECONDARY_BUTTON:
        // ignoring, handled in the gui_manager
        break;
      case Input::PAUSE_BUTTON:
        on_pause_release ();
        break;
      case Input::SINGLE_STEP_BUTTON:
        on_single_step_release();
        break;
      case Input::FAST_FORWARD_BUTTON:
        on_fast_forward_release ();
        break;
      case Input::ARMAGEDDON_BUTTON:
        on_armageddon_release ();
        break;
      case Input::ESCAPE_BUTTON:
        on_escape_release ();
        break;
      case Input::ACTION_UP_BUTTON:
        on_action_up_release();
        break;
      case Input::ACTION_DOWN_BUTTON:
        on_action_down_release();
        break;
      default:
        log_debug("unhandled event: %1%", event.name);
        break;
    }
  }
  else
  {
    log_error("got unknown event.state: %1%", event.state);
  }
}