Пример #1
0
void			Game::updateSList(std::list<ISnake *> &list) const
{
  ISnake	*back;

  back = new Snake();
  back->setX(list.back()->getX() - SIDE);
  back->setY(list.back()->getY());
  list.push_back(back);
}
Пример #2
0
std::list<ISnake *>	Game::updateSList(std::list<ISnake *> list)
{
  ISnake	*back;

  back = new Snake();
  back->setX(list.back()->getX() - SIDE);
  back->setY(list.back()->getY());
  list.push_back(back);
  return (list);
}
Пример #3
0
void			Display::onOriginalList(std::list<ISnake *> &list, char func)
{
  ISnake	*tmp;
  int		x;
  int		y;
  
  tmp = list.back();
  list.pop_back();
  x = list.front()->getX();
  y = list.front()->getY();
  if (func == 1)
    y -= 20;
  else if (func == 2)
    y += 20;
  else if (func == 3)
    x -= 20;
  else if (func == 4)
    x += 20;
  tmp->setX(x);
  tmp->setY(y);
  list.push_front(tmp);
}