Esempio n. 1
0
bool	Controller::Peripheral::checkKeys(gdl::Input& input)
{
  Controller::Button	buttab[] =
    {
      BUTTON_PUTBOMB,
      BUTTON_MODE,
      BUTTON_X,
      BUTTON_START,
      BUTTON_BACK,
      BUTTON_RIGHTSHOULDER,
      BUTTON_LEFTSHOULDER
    };

  _but = BUTTON_INVALID;
  for (register size_t i = _playerkeys.size() - 1 ; i >= 4 ; i--)
    if (input.getInput(_playerkeys[i]))
      {
	_but = buttab[i - 4];
	break ;
      }
  double tabangle[] = {0.0f, -90.0f, 90.0f, 0.0f, 180.0f};
  _dir.setAngle(0);
  _dir.setSpeed(0);
  for (register size_t i = 4; i--;)
    if (input.getInput(_playerkeys[i]))
      {
	_dir.setAngle(tabangle[i + 1]);
	_dir.setSpeed(static_cast<int>(RAYON));
	return (true);
      }
  return (false);
}
Esempio n. 2
0
bool RandomMenu::update(gdl::Clock& clock, gdl::Input& input)
{
  _command->exec(_inputManager->getTouche(input), clock);
  if (input.getInput(SDL_BUTTON_LEFT, true) == true)
    this->getNameOfButton(input);
  return true;
}
Esempio n. 3
0
bool		Window::update(gdl::Input &input) {
  _context.updateClock(_clock);
  _context.updateInputs(input);
  if (input.getInput(SDL_QUIT))
    return (false);
  return (true);
}
Esempio n. 4
0
bool		Event::checkEvent(gdl::Input & input,
				  gdl::Clock & clock,
				  std::vector<AObject *> & players,
				  Pause & pause,
				  Menu & menu,
				  int _nb_players)
{
  // EVENT IN GAME
  if (!pause.isPaused() && !menu.isMenu() && pause.isLoading() == 0)
    {
      if (!eventInGame(players, input, clock, _nb_players))
	return (false);
    }
  // EVENT IN PAUSE
  else if (pause.isPaused() || pause.isLoading() == 3)
    {
      if (!pause.update(input, clock))
	return (false);
      if (pause.isLoading() == 0)
	{
	  if (pause.isMenu())
	    menu.setMenu(true);
	  if (!pause.isPaused())
	    desactivePause(players, pause);
	}
    }
  // EVENT IN MENU
  else
    if (!menu.update(input, clock))
      return (false);


  if (input.getInput(SDL_QUIT))
    return (false);
  if (input.getKey(SDLK_ESCAPE, true))
    {
      if (pause.isPaused())
	desactivePause(players, pause);
      else if (!menu.isMenu())
	activePause(players, pause);
    }

  return (true);
}