Exemplo n.º 1
0
int		main(int argc, char **argv, char **env)
{
  t_tetris	game;
  t_list	list;
  bool		files;

  files = true;
  initialize_struct(&game);
  initialize_value(&game, argv[0], env);
  if (argc > 1)
    options(&game, argc, argv);
  init_list(&list);
  files = (!(initialize_files(&list, &game))) ? false : true;
  if (game.debug == true)
    mode_debug(&game, list);
  game.list = list;
  if (files == true)
    {
      if ((game.scene->rows + 2 > (tgetnum("lines")))
  	  || (game.scene->colums + 43 > (tgetnum("cols"))))
  	my_puterr("Terminal too small\n");
      else if ((check_one_valid(&list)) == 1)
  	initialize_game(&game);
    }
  my_free(&game, &list);
  endwin();
  return (0);
}
Exemplo n.º 2
0
char			*my_read(struct winsize *mysizewin,
				 t_history **history, t_termcap *term)
{
  int			count;

  if ((initialize_struct(term)) == 1)
    return (NULL);
  ioctl(STDOUT_FILENO, TIOCGWINSZ, mysizewin);
  while ((read(0, &term->buff, sizeof(int))) != 0)
    {
      count = 0;
      parcours_ptr_func(term, mysizewin, &count);
      if (term->buff == 4)
	return (NULL);
      else if (term->str == NULL)
	return (NULL);
      else if (term->buff == BACKSLASH_N)
	{
	  term->str = backslash_n(term, history);
	  return (term->str);
	}
      else
	edition(term, history, mysizewin, count);
      term->buff = 0;
    }
  return (NULL);
}