コード例 #1
0
ファイル: RandomMenu.cpp プロジェクト: Hiruxou/Epitech-2
void RandomMenu::getNameOfButton(gdl::Input &input)
{
  glm::ivec2 mouse = input.getMousePosition();
  std::cout << "X : " << mouse.x << " Y : " << mouse.y << std::endl;

  // IA
  if (mouse.x >= 670 && mouse.x <= 752 && mouse.y >= 345 && mouse.y <= 469)
    {
      std::cout << "IA -" << std::endl;
      if (_ia > 0)
	_ia--;
      else
	_ia = 0;
      this->displayIA(_ia);
    }
  else if (mouse.x >= 1178 && mouse.x <= 1254 && mouse.y >= 345
	   && mouse.y <= 469)
    {
      std::cout << "IA +" << std::endl;
      _ia++;
      this->displayIA(_ia);
    }
  // X MAP
  if (mouse.x >= 242 && mouse.x <= 316 && mouse.y >= 649 && mouse.y <= 777)
    {
      std::cout << "X -" << std::endl;
      if (_x > 0)
	_x--;
      else
	_x = 0;
      this->displayX(_x);
    }
  else if (mouse.x >= 750 && mouse.x <= 824 && mouse.y >= 649
	   && mouse.y <= 777)
    {
      std::cout << "X +" << std::endl;
      _x++;
      this->displayX(_x);
    }
  // Y MAP
  if (mouse.x >= 1100 && mouse.x <= 1180 && mouse.y >= 649 && mouse.y <= 777)
    {
      std::cout << "Y -" << std::endl;
      if (_y > 0)
	_y--;
      else
	_y = 0;
      this->displayY(_y);
    }
  else if (mouse.x >= 1612 && mouse.x <= 1684 && mouse.y >= 649
	   && mouse.y <= 777)
    {
      std::cout << "Y +" << std::endl;
      _y++;
       this->displayY(_y);
    }
  //PLAY
  if (mouse.x >= 1568 && mouse.x <= 1910 && mouse.y >= 949 && mouse.y <= 1037)
    {
      std::cout << "PLAY RANDOM" << std::endl;
      // Check if value are Ok
      // Call Generateur with IA Value, X and Y Value .
      if (_y > 0 && _x > 0)
	{
	  Map *map = new Map("./maps/+.map");
	  _game->pushState(new World(_game, *map, 2, 1));
	}
    }
}
コード例 #2
0
ファイル: SelectChar.cpp プロジェクト: Hiruxou/Epitech-2
void SelectChar::getNameOfButton(gdl::Input &input)
{
  glm::ivec2 mouse = input.getMousePosition();

  std::cout << "X : " << mouse.x << " Y: " << mouse.y << std::endl;
  if (mouse.x >= 328 && mouse.x <= 730 && mouse.y >= 77 && mouse.y <= 473)
    {
      // MAP 1
      _map = new Map("./maps/basic.map");
      _map1 = _map2 = _map3 = _map4 = _map5 = _mapR = false;
      _map1 = true;
    }
  if (mouse.x >= 760 && mouse.x <= 1160 && mouse.y >= 77 && mouse.y <= 473)
    {
      // MAP 2
      _map = new Map("./maps/hard.map");
      _map1 = _map2 = _map3 = _map4 = _map5 = _mapR = false;
      _map2 = true;
    }
  if (mouse.x >= 1192 && mouse.x <= 1594 && mouse.y >= 77 && mouse.y <= 473)
    {
      // MAP 3
      _map = new Map("./maps/big.map");
      _map1 = _map2 = _map3 = _map4 = _map5 = _mapR = false;
      _map3 = true;
    }
  if (mouse.x >= 330 && mouse.x <= 730 && mouse.y >= 501 && mouse.y <= 899)
    {
      // MAP 4
      _map = new Map("./maps/+.map");
      _map1 = _map2 = _map3 = _map4 = _map5 = _mapR = false;
      _map4 = true;
    }
  if (mouse.x >= 760 && mouse.x <= 1158 && mouse.y >= 501 && mouse.y <= 899)
    {
      // MAP 5
      _map = new Map("./maps/x.map");
      _map1 = _map2 = _map3 = _map4 = _map5 = _mapR = false;
      _map5 = true;
    }
  if (mouse.x >= 1192 && mouse.x <= 1592 && mouse.y >= 501 && mouse.y <= 899)
    {
      // RANDOM
      //      _map = new Map("./maps/lp.map");
      //_mapR = true;
      _game->pushState(new RandomMenu(_game));
    }
  //PLAY
  if (mouse.x >= 1566 && mouse.x <= 1906 && mouse.y >= 949 && mouse.y <= 1039)
    {
      // BOUTON PLAY
      if (_p2)
	_game->pushState(new World(_game, *_map, 2, _nbrIA));
      else
	_game->pushState(new World(_game, *_map, 1, _nbrIA));
    }
  //PLAYER
  if (mouse.x >= 86 && mouse.x <= 212 && mouse.y >= 307 && mouse.y <= 431)
    {
      //BOUTON 1 PLAYER
      _p1 = true;
      _p2 = false;
    }
  if (mouse.x >= 86 && mouse.x <= 212 && mouse.y >= 615 && mouse.y <= 741)
    {
      //BOUTON 2 PLAYER
      _p1 = false;
      _p2 = true;
    }
  //IA
  if (mouse.x >= 1700 && mouse.x <= 1830 && mouse.y >= 140 && mouse.y <= 275)
    {
      // IA 1
      _ia1 = _ia5 = _ia10 = _ia15 = _ia20 = false;
      _ia1 = true;
      _nbrIA = 1;
    }
  else if (mouse.x >= 1700 && mouse.x <= 1830 && mouse.y >= 309
	   && mouse.y <= 433)
    {
      // IA 5
      _ia1 = _ia5 = _ia10 = _ia15 = _ia20 = false;
      _ia5 = true;
      _nbrIA = 5;
    }
  else if (mouse.x >= 1700 && mouse.x <= 1828 && mouse.y >= 471
	   && mouse.y <= 593)
    {
      // IA 10
      _ia1 = _ia5 = _ia10 = _ia15 = _ia20 = false;
      _ia10 = true;
      _nbrIA = 10;
    }
  else if (mouse.x >= 1700 && mouse.x <= 1828 && mouse.y >= 633
	   && mouse.y <= 753)
    {
      // IA 15
      _ia1 = _ia5 = _ia10 = _ia15 = _ia20 = false;
      _ia15 = true;
      _nbrIA = 15;
    }
  else if (mouse.x >= 1700 && mouse.x <= 1828 && mouse.y >= 799
	   && mouse.y <= 919)
    {
      // IA 20
      _ia1 = _ia5 = _ia10 = _ia15 = _ia20 = false;
      _ia20 = true;
      _nbrIA = 20;
    }
}