Example #1
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);
}
Example #2
0
int			key_hook(int keycode, t_env *mlx)
{
	if (keycode == 65362)
		ft_move_up(mlx);
	if (keycode == 65364)
		ft_move_down(mlx);
	if (keycode == 65361)
	{
		mlx->angle += 11;
		if (mlx->angle > 360)
			mlx->angle -= 360;
	}
	if (keycode == 65363)
	{
		mlx->angle -= 11;
		if (mlx->angle < 0)
			mlx->angle += 360;
	}
	ft_find_wall(mlx);
	if (keycode == 65307)
	{
		free(mlx->map);
		exit(0);
	}
	return (0);
}
Example #3
0
void		ft_select_item(t_main *all)
{
	t_list	*list;

	list = all->lst;
	while (list)
	{
		if (list->line == 1 && list->select == 0)
		{
			list->select = 1;
			ft_move_down(all);
			return ;
		}
		else if (list->line == 1 && list->select == 1)
		{
			list->select = 0;
			return ;
		}
		list = list->next;
	}
}
Example #4
0
t_list	*ft_select_item(t_list *l)
{
	l->data->is_select = (l->data->is_select ? 0 : 1);
	return (ft_move_down(l));
}