-
Notifications
You must be signed in to change notification settings - Fork 0
/
cub3d_initialize_display.c
executable file
·49 lines (43 loc) · 1.71 KB
/
cub3d_initialize_display.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cub3d_initialize_display.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mg <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/03 17:42:38 by mg #+# #+# */
/* Updated: 2020/10/07 23:42:24 by mg ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void c3d_initialize_display(t_param *cub3d)
{
c3d_initialize_display_mlx(cub3d);
c3d_parse_map_file(cub3d);
if (!cub3d->bitmap)
c3d_initialize_display_window(cub3d);
c3d_initialize_render_image(cub3d);
}
/*
** https://github.com/sguillia/42-fractol/blob/master/fractol/init_t_mlx.c
**
** Useage example of autorepeat
*/
void c3d_initialize_display_mlx(t_param *cub3d)
{
cub3d->mlx = mlx_init();
if (!cub3d->mlx)
c3d_print_error_sys(cub3d, "DISPLAY MLX");
mlx_do_key_autorepeaton(cub3d->mlx);
}
void c3d_initialize_display_window(t_param *cub3d)
{
cub3d->win = mlx_new_window(cub3d->mlx,
cub3d->window.width, cub3d->window.height, "Michael Giraldo - Cub3d");
if (!cub3d->win)
c3d_print_error_sys(cub3d, "DISPLAY WINDOW");
}
void c3d_initialize_render_image(t_param *cub3d)
{
c3d_create_image(cub3d, &cub3d->render);
}