• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ gdl::Input类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中gdl::Input的典型用法代码示例。如果您正苦于以下问题:C++ Input类的具体用法?C++ Input怎么用?C++ Input使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Input类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: update

  // Ici le cube bougera avec les fleches du clavier
  virtual void update(gdl::Clock const &clock, gdl::Input &input)
  {
    glm::vec3 pos = glm::vec3(0, 0, 0);
    float delta = static_cast<float>(clock.getElapsed()) * _speed;
    // On multiplie par le temps ecoule depuis la derniere image pour que la vitesse ne depende pas de la puissance de l'ordinateur
    if (input.getKey(SDLK_UP))
      {
	pos.x = 1;
	_rotation.y = -90;
	translate(pos * delta);  
      }
    if (input.getKey(SDLK_DOWN))
      {
	pos.x = -1;
	_rotation.y = 90;
	translate(pos * delta);
      }
    if (input.getKey(SDLK_LEFT))
      {
	pos.z = -1;
	_rotation.y = 180;
	translate(pos * delta);
      }
    if (input.getKey(SDLK_RIGHT))
      {
	pos.z = 1;
	_rotation.y = 0;
	translate(pos * delta);
      }
  }
开发者ID:koolkt,项目名称:Bomberman,代码行数:31,代码来源:AObject.hpp


示例2: return

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);
}
开发者ID:Zaclos,项目名称:Bomberman,代码行数:32,代码来源:Peripheral.cpp


示例3: update

  void MenuLabel::update(gdl::GameClock const & gameClock, gdl::Input & input)
  {
    if (this->MenuDecide == false) {
      if (input.isKeyDown(gdl::Keys::Up) == true)
	{
	  this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_play.png");
	  this->MenuCurr = 1;
	}
      if (input.isKeyDown(gdl::Keys::Left) == true)
	{
	  this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_load.png");
	  this->MenuCurr = 2;
	}
      if (input.isKeyDown(gdl::Keys::Right) == true)
	{
	  this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_save.png");
	  this->MenuCurr = 3;
	}
      if (input.isKeyDown(gdl::Keys::Down) == true)
	{
	  this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_exit.png");
	  this->MenuCurr = 4;
	}
      if (input.isKeyDown(gdl::Keys::Space) == true)
	{
	  this->MenuDecide = true;
	}
    }
  }
开发者ID:noelq,项目名称:EpiHistory,代码行数:29,代码来源:MenuLabel.cpp


示例4: dropBomb

void				Player::update(gdl::Clock const& clock,
					       gdl::Input& input)
{
  _timeReload -= clock.getElapsed();
  if (_timeReload <= 0.0f)
    {
      _bombCount = ((_bombCount < _maxBombCount) ? _maxBombCount : _bombCount);
      _timeReload = 1.5f;
    }
  if (input.getKey(_controls[DROPBOMB], false))
    dropBomb(clock);
  for (int i = TOP; i != NONE; i++)
    {
      if (input.getKey(_controls[static_cast<e_dir>(i)], false))
	{
	  moveTo(static_cast<e_dir>(i), clock);
	  return ;
	}
    }
  if (_hasToStop == true)
    {
      _model->setCurrentSubAnim("end", false);
      _hasToStop = false;
    }
  checkPlayerDeath();
}
开发者ID:simonvadee,项目名称:bomberman,代码行数:26,代码来源:Player.cpp


示例5: return

bool		Event::eventInGame(std::vector<AObject *> & players,
				   gdl::Input & input, gdl::Clock & clock, int _nb_player)
{
  for (unsigned int i = 0; i < players.size(); i++)
    {
      if ((i < 2 && _nb_player == 2) || (i < 1 && _nb_player == 1))
	{
	  if (!players[i]->isDead() &&
	      (input.getKey(static_cast<Player *>(players[i])->_event.getTop())
	       || input.getKey(static_cast<Player *>(players[i])->_event.getBot())
	       || input.getKey(static_cast<Player *>(players[i])->_event.getRight())
	       || input.getKey(static_cast<Player *>(players[i])->_event.getLeft())))
	    if ((static_cast<Bomber *>(players[i]->getObject()))->launchWalkAnim() == false)
	      return (false);
	  if (!players[i]->isDead())
	    static_cast<Player *>(players[i])->checkEvent(input, clock);
	}
      else
	{
	  if (!players[i]->isDead())
	    if (!static_cast<Player *>(players[i])->handleActionIa(clock))
	      return (false);
	}
    }
  return (true);
}
开发者ID:AntoineDewaele,项目名称:Bomberman,代码行数:26,代码来源:Event.cpp


示例6:

void	AdventureGame::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler * cH)
{
  (void)cH;
  pressEnter_.update(gClock);
  if (input.isKeyDown(gdl::Keys::Return) && !returnHit_)
    sMg->pushState(new AdventureState);
  returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
开发者ID:teamBICYCLE,项目名称:Bomberman,代码行数:8,代码来源:AdventureGame.cpp


示例7: if

int		Menu::updateMain(gdl::Input & input_)
{
  if (input_.isKeyDown(gdl::Keys::Up))
    {
      ((choice > 0 ? choice-- && usleep(300000) : 0));
      this->string[choice].setSize(60);
      if (choice == 0)
	{
	  this->string[1].setSize(40);
	  this->string[2].setSize(40);
	}
      else if (choice == 1)
	{
	  this->string[2].setSize(40);
	  this->string[0].setSize(40);
	}
      else
	{
	  this->string[1].setSize(40);
	  this->string[0].setSize(40);
	}
    }
  else if (input_.isKeyDown(gdl::Keys::Down))
    {
      ((choice < 2 ? choice++ && usleep(300000) : 0));
      this->string[choice].setSize(60);
      if (choice == 0)
	{
	  this->string[1].setSize(40);
	  this->string[2].setSize(40);
	}
      else if (choice == 1)
	{
	  this->string[2].setSize(40);
	  this->string[0].setSize(40);
	}
      else
	{
	  this->string[1].setSize(40);
	  this->string[0].setSize(40);
	}
    }
  else if (input_.isKeyDown(gdl::Keys::Return))
    {
      usleep(300000);
      this->string[0].setSize(60);
      this->string[1].setSize(40);
      this->string[2].setSize(40);
      this->which = choice + 1;
      this->choice = 0;
      if (this->which == 3)
	exit(0);
    }
  return (0);
}
开发者ID:tolsac,项目名称:bomberman,代码行数:55,代码来源:Menu.cpp


示例8:

void	Draw::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler *cH)
{
  (void)gClock;
  (void)cH;
  if (input.isKeyDown(gdl::Keys::Return) && !returnHit_)
    {
      sMg->popState();
      sMg->popState();
    }
  returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
开发者ID:teamBICYCLE,项目名称:Bomberman,代码行数:11,代码来源:Draw.cpp


示例9: update

 virtual void update(gdl::Clock const &clock, gdl::Input &input)
 {
   if (input.getKey(SDLK_UP))
     translate(glm::vec3(0, 0, 1) * static_cast<float>(clock.getElapsed()) * _speed);
   if (input.getKey(SDLK_DOWN))
     translate(glm::vec3(0, 0, -1) * static_cast<float>(clock.getElapsed()) * _speed);
   if (input.getKey(SDLK_LEFT))
     translate(glm::vec3(-1, 0, 0) * static_cast<float>(clock.getElapsed()) * _speed);
   if (input.getKey(SDLK_RIGHT))
     translate(glm::vec3(1, 0, 0) * static_cast<float>(clock.getElapsed()) * _speed);
 }
开发者ID:Raphy,项目名称:bomberman,代码行数:11,代码来源:Cube.hpp


示例10:

void	SoundConfig::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler *cH)
{
  (void)gClock;
  (void)sMg;
  (void)cH;
  for (std::map<gdl::Keys::Key, t_paramFunc>::iterator it = paramMap_.begin(); it != paramMap_.end(); ++it)
    if (input.isKeyDown(it->first))
      (this->*(it->second))();
  upHit_ = input.isKeyDown(gdl::Keys::Up);
  downHit_ = input.isKeyDown(gdl::Keys::Down);
  returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
开发者ID:teamBICYCLE,项目名称:Bomberman,代码行数:12,代码来源:SoundConfig.cpp


示例11: if

void		Menu::PlayMenu(gdl::Input &input)
{
  if (input.getKey(SDLK_UP))
    {
      _cursor == 5 ? _cursor = 8 : _cursor--;
      usleep(100000);
    }
  else if (input.getKey(SDLK_DOWN))
    {
      _cursor <= 7 ? _cursor++ : _cursor = 5;
      usleep(100000);
    }
  if (_cursor == 5)
    {
      if (input.getKey(SDLK_RIGHT))
	_nbr_players = 2;
      else if (input.getKey(SDLK_LEFT))
	_nbr_players = 1;
    }
  if (_cursor == 6)
    {
      int	nbmax = _size_x / 3;
      if (input.getKey(SDLK_RIGHT))
	{
	  _nbr_enemies >= nbmax ? _nbr_enemies = 1 : _nbr_enemies += 1;
	  usleep(100000);
	}
      else if (input.getKey(SDLK_LEFT))
	{
	  _nbr_enemies >= 2 ? _nbr_enemies -= 1 : _nbr_enemies = nbmax;
	  usleep(100000);
	}
    }
  if (_cursor == 7)
    {
      if (input.getKey(SDLK_RIGHT))
	{
	  _size_x >= 100 ? _size_x = 10 : _size_x += 1;
	  _size_y >= 100 ? _size_y = 10 : _size_y += 1;
	  usleep(100000);
	}
      else if (input.getKey(SDLK_LEFT))
	{
	  _size_x > 10 ? _size_x -= 1 : _size_x = 100;
	  _size_y > 10 ? _size_y -= 1 : _size_y = 100;
	  usleep(100000);
	}
      if (_nbr_enemies > static_cast<int>(_size_x / 3))
	_nbr_enemies = _size_x/3;
    }
  if (_cursor == 8 &&
      getMapY() != 0 &&
      getMapX() != 0 &&
      getNbrEnemies() != 0 &&
      getNbrPlayers() != 0 &&
      input.getKey(SDLK_RETURN))
    _cursor = 11;
}
开发者ID:VictorCholet,项目名称:cpp_bomberman,代码行数:58,代码来源:Menu.cpp


示例12: update

void PremadeMap::update(gdl::Input &input, gdl::GameClock &gClock, StatesManager *sMg,
                         CarrouselHandler * cH)
{
    (void)gClock;
    (void)cH;

    for (std::map<gdl::Keys::Key, void(PremadeMap::*)(StatesManager *)>::iterator it = paramMap_.begin(); it != paramMap_.end(); ++it)
    if (input.isKeyDown(it->first))
        (this->*(it->second))(sMg);

    up_ = input.isKeyDown(gdl::Keys::Up);
    down_ = input.isKeyDown(gdl::Keys::Down);
    enter_ = input.isKeyDown(gdl::Keys::Return);
}
开发者ID:teamBICYCLE,项目名称:Bomberman,代码行数:14,代码来源:PremadeMap.cpp


示例13: return

bool		Window::update(gdl::Input &input) {
  _context.updateClock(_clock);
  _context.updateInputs(input);
  if (input.getInput(SDL_QUIT))
    return (false);
  return (true);
}
开发者ID:kefranabg,项目名称:Bomberman,代码行数:7,代码来源:Window.cpp


示例14: update

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;
}
开发者ID:Hiruxou,项目名称:Epitech-2,代码行数:7,代码来源:RandomMenu.cpp


示例15: PlayState

void	QuickGame::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler *cH)
{
  (void)cH;
  pressEnter_.update(gClock);
  if (input.isKeyDown(gdl::Keys::Return) && !returnHit_)
    {
      try {
        Character::CharacterId = 0;
        Map	map(13, 13, 2, 0, 0);

        sMg->pushState(new PlayState(&map.getTerrain()), false);
      } catch (Map::Failure& e) {
        std::cerr << e.what() << std::endl;
      }
    }
  returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
开发者ID:teamBICYCLE,项目名称:Bomberman,代码行数:17,代码来源:QuickGame.cpp


示例16: if

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);
}
开发者ID:AntoineDewaele,项目名称:Bomberman,代码行数:44,代码来源:Event.cpp


示例17: checkBonus

void    Character::Action(gdl::Input &input)
{
  if ((this->alive && input.isKeyDown(this->Down) == true) &&
      ((this->map->getPos(this->getPosX(), this->getPosY() + 1) >= 5) && ((this->map->getPos(this->getPosX(), this->getPosY() + 1) <= 9))))
    {
      this->rotation_->x = 0;
      this->map->setPos(9, this->getPosX(), this->getPosY());
      this->setPosY(this->getPosY() + 1);
      checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));
    }

  if ((this->alive && input.isKeyDown(this->Up) == true) &&
      ((this->map->getPos(this->getPosX(), this->getPosY() - 1) >= 5) && ((this->map->getPos(this->getPosX(), this->getPosY() - 1) <= 9))))
    {
      this->rotation_->x = 180;
      this->map->setPos(9, this->getPosX(), this->getPosY());
      this->setPosY(this->getPosY() - 1);
      checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));

    }
  if ((this->alive && input.isKeyDown(this->Right) == true) &&
      ((this->map->getPos(this->getPosX() + 1, this->getPosY()) >= 5) && ((this->map->getPos(this->getPosX() + 1, this->getPosY()) <= 9))))
    {
      this->rotation_->x = 90;
      this->map->setPos(9, this->getPosX(), this->getPosY());
      this->setPosX(this->getPosX() + 1);
      checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));
    }
  if ((this->alive && input.isKeyDown(this->Left) == true) &&
      ((this->map->getPos(this->getPosX() - 1, this->getPosY()) >= 5) && ((this->map->getPos(this->getPosX() - 1, this->getPosY()) <= 9))))
    {
      this->rotation_->x = 270;
      this->map->setPos(9, this->getPosX(), this->getPosY());
      this->setPosX(this->getPosX() - 1);
      checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));
    }
  if (this->alive && input.isKeyDown(this->Space) == true)
    {
      this->map->setPos(4, this->getPosX(), this->getPosY());
      this->dropBomb();
      //    this->map->affMap();
      //this->bomb->add_positions(new Vector3f(this->position_->x, 0.0f, this->position_->z), this->_power);
    }
}
开发者ID:phoenisis,项目名称:EpiHistory,代码行数:44,代码来源:Character.cpp


示例18: return

int	Intro::GameIntro::update(gdl::Clock const& clock, gdl::Input &input)
{
  _introtime -= clock.getElapsed();
  if (_cam->getLookAt().y - clock.getElapsed() * 10 > 0)
    _cam->getLookAt().y -= clock.getElapsed() * 10;
  _cam->getCameraDiff().z += clock.getElapsed() * 5;
  if (_introtime <= 0 || input.getKey(SDLK_SPACE))
    return (0);
  return (4);
}
开发者ID:Zaclos,项目名称:Bomberman,代码行数:10,代码来源:GameIntro.cpp


示例19: usleep

void		Menu::OptionMenu(gdl::Input &input)
{
  if (_cursor == 9 && input.getKey(SDLK_SPACE))
    {
      _cursor = 1;
      _sound = true;
      _menu_type = COMMON_MENU;
    }
  if (input.getKey(SDLK_RIGHT) || input.getKey(SDLK_LEFT))
    {
      _cursor == 9 ? _cursor = 10: _cursor = 9;
      usleep(100000);
    }
  if (_cursor == 10 && input.getKey(SDLK_SPACE))
    {
      _cursor = 1;
      _sound = false;
      _menu_type = COMMON_MENU;
    }
}
开发者ID:VictorCholet,项目名称:cpp_bomberman,代码行数:20,代码来源:Menu.cpp


示例20: moveCam

void FreeCam::moveCam(gdl::Input & input, float delta)
{
    if (input.getKey(SDLK_UP) || input.getKey(SDLK_z))
        translate(_target * (_speed * delta));
    if (input.getKey(SDLK_DOWN) || input.getKey(SDLK_s))
        translate(-_target * (_speed * delta));
    if (input.getKey(SDLK_LEFT) || input.getKey(SDLK_q))
        translate(_left * (_speed * delta));
    if (input.getKey(SDLK_RIGHT) || input.getKey(SDLK_d))
        translate(-_left * (_speed * delta));

    _forward = _pos + _target;
}
开发者ID:kokaz,项目名称:bomberman,代码行数:13,代码来源:FreeCam.cpp



注:本文中的gdl::Input类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gecode::IntVarArray类代码示例发布时间:2022-05-31
下一篇:
C++ gdl::Clock类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap