2023-04-27 09:13:32 -04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* init.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2023/04/27 14:50:22 by erey-bet #+# #+# */
|
2023-05-03 06:45:40 -04:00
|
|
|
/* Updated: 2023/05/03 12:44:19 by erey-bet ### ########.fr */
|
2023-04-27 09:13:32 -04:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "game.h"
|
|
|
|
|
2023-05-02 09:39:16 -04:00
|
|
|
void init_ply(t_map *map, t_ply *ply)
|
2023-04-27 09:13:32 -04:00
|
|
|
{
|
2023-05-02 09:39:16 -04:00
|
|
|
ply->pos_x = map->ply_x;
|
|
|
|
ply->pos_y = map->ply_y;
|
2023-04-27 09:13:32 -04:00
|
|
|
}
|
|
|
|
|
2023-05-02 09:39:16 -04:00
|
|
|
void init_ray(t_ray *ray)
|
2023-04-27 09:13:32 -04:00
|
|
|
{
|
2023-05-03 06:45:40 -04:00
|
|
|
ray->dir_x = 0;
|
|
|
|
ray->dir_y = 0;
|
2023-04-27 09:13:32 -04:00
|
|
|
}
|
|
|
|
|
2023-05-03 06:45:40 -04:00
|
|
|
void init(t_map *map, t_game *game)
|
2023-04-27 09:13:32 -04:00
|
|
|
{
|
2023-05-02 09:39:16 -04:00
|
|
|
t_ply ply;
|
|
|
|
t_ray ray;
|
2023-04-27 09:13:32 -04:00
|
|
|
|
2023-05-03 06:45:40 -04:00
|
|
|
game->mlx = mlx_init(WIDTH, HEIGHT, "jan lili", true);
|
|
|
|
if (!game->mlx)
|
|
|
|
return ;
|
|
|
|
game->map = map;
|
2023-05-02 09:39:16 -04:00
|
|
|
init_ply(map, &ply);
|
2023-05-03 06:45:40 -04:00
|
|
|
game->ply = &ply;
|
|
|
|
init_ray(&ray);
|
|
|
|
game->ray = &ray;
|
2023-04-27 09:13:32 -04:00
|
|
|
}
|