Beispiel #1
0
void		move(t_env *w)
{
	if (w->inkeys[SDL_SCANCODE_UP])
		mv_up(w);
	if (w->inkeys[SDL_SCANCODE_DOWN])
		mv_down(w);
	if (w->inkeys[SDL_SCANCODE_LEFT])
		mv_left(w);
	if (w->inkeys[SDL_SCANCODE_RIGHT])
		mv_right(w);
}
Beispiel #2
0
int		loop_hook(t_env *e)
{
	e->mlx.last_frame = clock();
	if (e->mlx.next_frame > e->mlx.last_frame)
		return (0);
	e->mlx.next_frame = e->mlx.last_frame + (CLOCKS_PER_SEC / 100);
	if (e->player.mv_up)
		mv_up(e);
	if (e->player.mv_down)
		mv_down(e);
	if (e->player.mv_left)
		mv_left(e);
	if (e->player.mv_right)
		mv_right(e);
	if (e->player.mv_jump == 1)
		mv_jump(e);
	raycasting(e);
	mlx_put_image_to_window(e->mlx.mlx, e->mlx.win, e->mlx.img, 0, 0);
	return (0);
}