예제 #1
0
  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;
	}
    }
  }
예제 #2
0
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);
}
예제 #3
0
파일: Menu.cpp 프로젝트: tolsac/bomberman
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);
}
예제 #4
0
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);
}
예제 #5
0
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);
}
예제 #6
0
파일: Menu.cpp 프로젝트: tolsac/bomberman
int		Menu::updateNew(gdl::Input & input_)
{
  if (input_.isKeyDown(gdl::Keys::Up))
    {
      ((choice > 3 ? choice-- && usleep(200000) : 0));
      this->string[choice].setSize(60);
      if (choice == 3)
	{
	  this->string[5].setSize(40);
	  this->string[4].setSize(40);
	}
      else if (choice == 4)
	{
	  this->string[3].setSize(40);
	  this->string[5].setSize(40);
	}
      else
	{
	  this->string[3].setSize(40);
	  this->string[4].setSize(40);
	}
    }
  else if (input_.isKeyDown(gdl::Keys::Down))
    {
      ((choice < 5 ? choice++ && usleep(200000) : 0));
      this->string[choice].setSize(60);
      if (choice == 3)
	{
	  this->string[5].setSize(40);
	  this->string[4].setSize(40);
	}
      else if (choice == 4)
	{
	  this->string[3].setSize(40);
	  this->string[5].setSize(40);
	}
      else
	{
	  this->string[3].setSize(40);
	  this->string[4].setSize(40);
	}
    }
  else if (input_.isKeyDown(gdl::Keys::Return))
    {
      this->string[3].setSize(60);
      this->string[4].setSize(40);
      this->string[5].setSize(40);
      usleep(200000);
      this->choice = 0;
      this->which = 3;
    }
  return (0);
}
예제 #7
0
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);
}
예제 #8
0
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);
}
예제 #9
0
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);
    }
}
예제 #10
0
파일: Menu.cpp 프로젝트: tolsac/bomberman
int		Menu::updatePlayer(gdl::Input & input_)
{
   if (input_.isKeyDown(gdl::Keys::Up))
    {
      ((choice > 0 ? choice-- && usleep(200000) : 0));
      this->string[7].setSize(60);
      this->string[8].setSize(40);
      this->nbPlay = 3;
    }
  else if (input_.isKeyDown(gdl::Keys::Down))
    {
      ((choice < 2 ? choice++ && usleep(200000) : 0));
      this->string[7].setSize(40);
      this->string[8].setSize(60);
      this->nbPlay = 4;
    }
  else if (input_.isKeyDown(gdl::Keys::Return))
    {
      usleep(200000);
      return (this->nbPlay);
    }
   return (0);
}
예제 #11
0
파일: Menu.cpp 프로젝트: tolsac/bomberman
int		Menu::updateLoad(gdl::Input & input_)
{
  this->checkwd();
  if (input_.isKeyDown(gdl::Keys::Up))
    {
      ((choice > 3 ? choice-- && usleep(200000) : 0));
      this->string[6].setSize(60);
      this->fic.setSize(40);
    }
  else if (input_.isKeyDown(gdl::Keys::Down))
    {
      ((choice < 5 ? choice++ && usleep(200000) : 0));
      this->string[6].setSize(40);
      this->fic.setSize(60);
    }
  else if (input_.isKeyDown(gdl::Keys::Return))
    {
      this->string[6].setSize(60);
      this->fic.setSize(40);
      usleep(200000);
    }
  return (0);
}
예제 #12
0
파일: Menu.cpp 프로젝트: tolsac/bomberman
int		Menu::update(gdl::Input & input_)
{
  int		ret;
  
  if (input_.isKeyDown(gdl::Keys::Back) && this->which != 0)
    this->which = 0;
  if (this->which == 0)
    ret = updateMain(input_);
  else if (this->which == 1)
    ret = updateNew(input_);
  else if (this->which == 2)
    ret = updateLoad(input_);
  else if (this->which == 3)
    ret = updatePlayer(input_);
  return (ret);
}
예제 #13
0
파일: Light.cpp 프로젝트: newincpp/kaboom
void newin::Light::update(gdl::GameClock const & c, gdl::Input & i) {
    (void) c;
    if (_sindex == "1") {
	if (i.isKeyDown(gdl::Keys::I)) {
	    _pos.setZ(_pos.getZ() - 0.1);
	    _changed = true;
	}
	if (i.isKeyDown(gdl::Keys::K)) {
	    _pos.setZ(_pos.getZ() + 0.1);
	    _changed = true;
	}
	if (i.isKeyDown(gdl::Keys::J)) {
	    _pos.setX(_pos.getX() - 0.1);
	    _changed = true;
	}
	if (i.isKeyDown(gdl::Keys::L)) {
	    _pos.setX(_pos.getX() + 0.1);
	    _changed = true;
	}
	if (i.isKeyDown(gdl::Keys::U)) {
	    _pos.setY(_pos.getY() - 0.1);
	    _changed = true;
	}
	if (i.isKeyDown(gdl::Keys::O)) {
	    _pos.setY(_pos.getY() + 0.1);
	    _changed = true;
	}
    }
    if (!_prgm) {
	throw newin::ShaderException("cannot use light without shader");
    }
    if (_changed){
	_changed = false;
	_prgm->setVariable("L[" + _sindex + "].Pos", _pos.getX(), _pos.getY(), _pos.getZ());
    }
}
예제 #14
0
파일: Model.cpp 프로젝트: newincpp/kaboom
void GDLModel::update(/*gdl::GameClock const & gameClock, */gdl::Input & input) {
    //_model.update(gameClock);
    if (input.isKeyDown(gdl::Keys::P) == true)
	_model.play("Take 001");
}
예제 #15
0
void		Bomberman::update(gdl::GameClock const & gameClock, gdl::Input & input)
{
  float		dist;

  if (_map->isOnFirePos(_position.x, _position.y))
    {
      _inLife = false;
      _rotation.x = 0;
      _rotation.y = 0;
      _rotation.z = 90;
    }
  if (_inLife)
    {
      _model.update(gameClock);
      if (_nextpos != _position)
	{
	  if (_moveend < gameClock.getTotalGameTime())
	    {
	      _position.x = _nextpos.x;
	      _position.y = _nextpos.y;
	      _moving = NO;
	      _model.stop_animation("Run");
	      _model.play("Take 001");
	      _model.stop_animation("Take 001");
	    }
	  else
	    {
	      dist = gameClock.getTotalGameTime() - _movetmp;
	      _movetmp += dist;
	      dist *= 250.0f;
	      if ((int)_nextpos.x > (int)_position.x)
		_position.x += dist;
	      else if ((int)_nextpos.x < (int)_position.x)
		_position.x -= dist;
	      else if ((int)_nextpos.y > (int)_position.y)
		_position.y += dist;
	      else if ((int)_nextpos.y < (int)_position.y)
		_position.y -= dist;
	    }
	}
      else
	{
	  if (input.isKeyDown(_putbomb))
	    _mygame->addBombe(_position.x, _position.y);
	  if (input.isKeyDown(_right) && _map->isEmptyPos(_position.x + 300, _position.y))
	    {
	      _nextpos.x = _position.x + 300;
	      _rotation.y = 90.0f;
	    }
	  else if (input.isKeyDown(_left) && _map->isEmptyPos(_position.x - 300, _position.y))
	    {
	      _nextpos.x = _position.x - 300;
	      _rotation.y = 270.0f;
	    }
	  else if (input.isKeyDown(_up) && _map->isEmptyPos(_position.x, _position.y + 300))
	    {
	      _nextpos.y = _position.y + 300;
	      _rotation.y = 180.0f;
	    }
	  else if (input.isKeyDown(_down) && _map->isEmptyPos(_position.x, _position.y - 300))
	    {
	      _nextpos.y = _position.y - 300;
	      _rotation.y = 0.0f;
	    }
	  if (_nextpos != _position)
	    {
	      _model.play("Run");
	      _movetmp = gameClock.getTotalGameTime();
	      _moveend = _movetmp + 1.2f;
	    }
	}
    }
}