diff options
author | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-03-09 21:01:07 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-03-09 21:01:07 +0100 |
commit | e821fb7ab1232349f0be023b08dafee75da02ea9 (patch) | |
tree | 917f79f6f75a3bc8e07827893fc9af7ea17b8492 /src | |
parent | Not done (diff) | |
download | 42-cub3d-e821fb7ab1232349f0be023b08dafee75da02ea9.tar.gz 42-cub3d-e821fb7ab1232349f0be023b08dafee75da02ea9.tar.bz2 42-cub3d-e821fb7ab1232349f0be023b08dafee75da02ea9.tar.xz 42-cub3d-e821fb7ab1232349f0be023b08dafee75da02ea9.tar.zst 42-cub3d-e821fb7ab1232349f0be023b08dafee75da02ea9.zip |
Almost there
Diffstat (limited to '')
-rw-r--r-- | src/ft_draw_scene.c | 2 | ||||
-rw-r--r-- | src/ft_draw_skybox.c | 38 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 68a72e9..2cfa3f4 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -50,6 +50,8 @@ void { ft_draw_hud(clist); } + if (clist->mlist.isskybox) + ft_draw_skybox(clist); ft_calc_sprite(clist); mlx_put_image_to_window(clist->wlist.wlx, clist->wlist.winptr, clist->img.img, 0, 0); diff --git a/src/ft_draw_skybox.c b/src/ft_draw_skybox.c new file mode 100644 index 0000000..a446485 --- /dev/null +++ b/src/ft_draw_skybox.c @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_draw_skybox.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:57 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <cub3d.h> +#include <mlx.h> + +void + ft_draw_skybox(t_cub *cl) +{ + int offset; + + offset = 640; + if (cl->plist.dir_x > 0) + offset = -offset; + mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, + cl->tlist[7].img, offset * cl->plist.dir_y, -125); + mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, + cl->tlist[7].img, offset * cl->plist.dir_y, -125); + mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, + cl->tlist[7].img, offset * cl->plist.dir_y, -125); + mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, + cl->tlist[7].img, offset * cl->plist.dir_y, -125); + mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, + cl->tlist[7].img, offset * cl->plist.dir_y, -125); + mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, + cl->tlist[7].img, offset * cl->plist.dir_y, -125); + mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, + cl->tlist[7].img, offset * cl->plist.dir_y, -125); +} |