diff options
Diffstat (limited to 'src/ft_draw_scene.c')
-rw-r--r-- | src/ft_draw_scene.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 2cfa3f4..80cd1bc 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -41,28 +41,19 @@ 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); - ft_castray(clist); + if (clist->doicast) + ft_castray(clist); + else + clist->doicast = 1; if (clist->ishud) - { 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); + clist->wlist.winptr, clist->img.img, 0, 0); if (clist->ishud && clist->mlist.isnlvl) - { if (ft_put_stage(clist) < 0) - { ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, clist); - } - } - mlx_destroy_image(clist->wlist.wlx, clist->img.img); } void @@ -73,7 +64,6 @@ void clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, &clist->img.sizeline, &clist->img.endian); ft_castray(clist); - ft_calc_sprite(clist); if (ft_save_to_bmp(clist) < 0) ft_error(FT_RET_BMP_ERR, FT_ERR_WR_BMP, clist); mlx_destroy_image(clist->wlist.wlx, clist->img.img); |