diff options
author | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-03-11 15:30:51 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-03-11 15:30:51 +0100 |
commit | 114df1314a69161e5802ce6192aa8f1599867f3e (patch) | |
tree | cbb1c2f3c9e942a17b544d613f011aa7569e13cb /src | |
parent | is not working (diff) | |
download | 42-cub3d-114df1314a69161e5802ce6192aa8f1599867f3e.tar.gz 42-cub3d-114df1314a69161e5802ce6192aa8f1599867f3e.tar.bz2 42-cub3d-114df1314a69161e5802ce6192aa8f1599867f3e.tar.xz 42-cub3d-114df1314a69161e5802ce6192aa8f1599867f3e.tar.zst 42-cub3d-114df1314a69161e5802ce6192aa8f1599867f3e.zip |
qweqwe
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_draw_scene.c | 12 | ||||
-rw-r--r-- | src/ft_exit.c | 1 | ||||
-rw-r--r-- | src/ft_suffer_animation.c | 33 | ||||
-rw-r--r-- | src/ft_treat_args.c | 9 |
4 files changed, 28 insertions, 27 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 4d15df2..9664363 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -41,10 +41,10 @@ static int8_t void ft_draw_scene(t_cub *clist) { - clist->img.img = mlx_new_image(clist->wlist.wlx, - clist->wlist.x_size, clist->wlist.y_size); - clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, - &clist->img.sizeline, &clist->img.endian); + /* clist->img.img = mlx_new_image(clist->wlist.wlx, */ + /* clist->wlist.x_size, clist->wlist.y_size); */ + /* clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, */ + /* &clist->img.sizeline, &clist->img.endian); */ ft_castray(clist); if (clist->ishud) { @@ -53,7 +53,7 @@ void if (clist->mlist.isskybox) ft_draw_skybox(clist); mlx_put_image_to_window(clist->wlist.wlx, - clist->wlist.winptr, clist->img.img, 0, 0); + clist->wlist.winptr, clist->img.img, 0, 0); if (clist->ishud && clist->mlist.isnlvl) { if (ft_put_stage(clist) < 0) @@ -61,7 +61,7 @@ void ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, clist); } } - mlx_destroy_image(clist->wlist.wlx, clist->img.img); + /* mlx_destroy_image(clist->wlist.wlx, clist->img.img); */ } void diff --git a/src/ft_exit.c b/src/ft_exit.c index 4a131c8..e0093da 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -73,6 +73,7 @@ int ft_del_tex(clist); if (clist->wlist.inited) { + mlx_destroy_image(clist->wlist.wlx, clist->img.img); mlx_destroy_window(clist->wlist.wlx, clist->wlist.winptr); clist->wlist.winptr = NULL; } diff --git a/src/ft_suffer_animation.c b/src/ft_suffer_animation.c index 3d3595a..2a1beb4 100644 --- a/src/ft_suffer_animation.c +++ b/src/ft_suffer_animation.c @@ -14,6 +14,7 @@ #include <cub3d.h> #include <mlx.h> #include <stdint.h> +#include <unistd.h> void ft_suffer_animation(t_cub *cl) @@ -22,24 +23,22 @@ void int32_t y; int8_t i; - i = -1; - while (++i < 15) + /* cl->red_scr.img = mlx_new_image(cl->wlist.wlx, */ + /* cl->wlist.x_size, cl->wlist.y_size); */ + /* cl->red_scr.ptr = mlx_get_data_addr(cl->red_scr.img, &cl->red_scr.bpp, */ + /* &cl->red_scr.sizeline, &cl->red_scr.endian); */ + y = -1; + while (++y < (int32_t)cl->wlist.y_size) { - cl->red_scr.img = mlx_new_image(cl->wlist.wlx, - cl->wlist.x_size, cl->wlist.y_size); - cl->red_scr.ptr = mlx_get_data_addr(cl->red_scr.img, &cl->red_scr.bpp, - &cl->red_scr.sizeline, &cl->red_scr.endian); x = -1; - y = -1; - while (++y < (int32_t)cl->wlist.y_size) - { - while (++x < (int32_t)cl->wlist.x_size) - *(int*)(cl->red_scr.ptr + - (x * 4 + (y * cl->red_scr.sizeline))) = 0x00ce2524; - x = -1; - } - mlx_put_image_to_window(cl->wlist.wlx, - cl->wlist.winptr, cl->red_scr.img, 0, 0); - mlx_destroy_image(cl->wlist.wlx, cl->red_scr.img); + while (++x < (int32_t)cl->wlist.x_size) + *(int*)(cl->img.ptr + + (x * 4 + (y * cl->img.sizeline))) = 0x00ffffff; } + i = -1; + mlx_put_image_to_window(cl->wlist.wlx, + cl->wlist.winptr, cl->img.img, 0, 0); + sleep(5); + /* while (++i < 120) */ + /* mlx_destroy_image(cl->wlist.wlx, cl->red_scr.img); */ } diff --git a/src/ft_treat_args.c b/src/ft_treat_args.c index a47f9f7..fe794d8 100644 --- a/src/ft_treat_args.c +++ b/src/ft_treat_args.c @@ -12,6 +12,7 @@ #include <libft.h> #include <cub3d.h> +#include <mlx.h> #include <stddef.h> #include <stdint.h> #include <unistd.h> @@ -35,14 +36,14 @@ uint8_t if (argc < 3) { if (ft_init_winptr(clist) < 0) - { return (ft_exit(FT_RET_FAILED_MLX, clist)); - } + clist->img.img = mlx_new_image(clist->wlist.wlx, + clist->wlist.x_size, clist->wlist.y_size); + clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, + &clist->img.sizeline, &clist->img.endian); ft_draw_scene(clist); if (clist->mlist.ismusic) - { ft_enable_music(clist); - } ft_hooks_and_loops(&clist->wlist, clist); } else if (argc == 3 && !ft_strncmp("--save", argv[2], 7)) |