Exemplo n.º 1
0
void			ft_move_to_word_R(int *position, char *line)
{
	if (*position == (int)ft_strlen(line))
	{
		ft_putchar(07);
		return ;
	}
	if (*position < (int)ft_strlen(line))
		ft_move_right(position, line);
	while (*(line + *position) != ' ' && *position < (int)ft_strlen(line))
		ft_move_right(position, line);
	while (*(line + *position) == ' ' && *(line + *position))
		ft_move_right(position, line);
}
Exemplo n.º 2
0
Arquivo: hook.c Projeto: zhasni/Wolf3D
int		key_hook(int keycode, t_env *env)
{
	if (keycode == T_ESC)
		exit (0);
	if (keycode == T_UP)
		ft_move_forward(env);
	if (keycode == T_DOWN)
		ft_move_backward(env);
	if (keycode == T_RIGHT)
		ft_rotate_right(env);
	if (keycode == T_LEFT)
		ft_rotate_left(env);
	if (keycode == T_SEVEN)
		env->view = 1.2;
	if (keycode == T_FOUR)
		env->view = 2;
	if (keycode == T_ONE)
		env->view = 10;
	if (keycode == T_C)
		ft_move_left(env);
	if (keycode == T_Z)
		ft_move_right(env);
	else
		key_hook_bis(keycode, env);
	expose_hook(env);
	return (0);
}
Exemplo n.º 3
0
void	stat_game(t_game *g)
{
	int		press;

	print_game(g);
	press = getch();
	if (press == 'm')
	{
		if (g->end == 1)
		{
			ft_restart(g);
			g->start = 0;
		}
		g->stat = 0;
	}
	else if (press == KEY_UP && g->end != 1)
		ft_move_up(g);
	else if (press == KEY_DOWN && g->end != 1)
		ft_move_down(g);
	else if (press == KEY_RIGHT && g->end != 1)
		ft_move_right(g);
	else if (press == KEY_LEFT && g->end != 1)
		ft_move_left(g);
	else if (press == 'r')
		ft_restart(g);
	else if (press == 27)
		ft_del_game(&g);
}
Exemplo n.º 4
0
int		ft_move_down(t_datas *datas, t_line *line, char *str)
{
	int		i;

	if (ft_strcmp(str, FTSH_KEY_SHDOWN) != 0)
		return (-1);
	if (line->i + datas->cols > line->len - 1)
	{
		ft_tputs("bl");
		return (1);
	}
	i = 0;
	while (i++ != datas->cols)
		ft_move_right(datas, line, FTSH_KEY_RIGHT);
	return (0);
}
Exemplo n.º 5
0
Arquivo: read.c Projeto: cdelouya/42sh
void			ft_get_input(char **line)
{
	int				position;
	static int		autocomp;

	autocomp = 0;
	signal(SIGTSTP, ft_suspend);
	position = 0;
	if (*line)
	{
		free(*line);
		*line = NULL;
	}
	*line = ft_strdup("\0");
	ft_read(line, &position, &autocomp);
	while (position < (int)ft_strlen(*line))
		ft_move_right(&position, *line);
	ft_putchar('\n');
}