diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-03-07 19:03:53 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-03-07 19:03:53 +0100 |
commit | 4218ab8ee1a50c83a60c86a454f21d43146b46a0 (patch) | |
tree | f1f1926219786626f936b6f9ceeddd4e89062d91 /src/ft_draw_scene.c | |
parent | Removed one remaining POWER (diff) | |
download | 42-cub3d-4218ab8ee1a50c83a60c86a454f21d43146b46a0.tar.gz 42-cub3d-4218ab8ee1a50c83a60c86a454f21d43146b46a0.tar.bz2 42-cub3d-4218ab8ee1a50c83a60c86a454f21d43146b46a0.tar.xz 42-cub3d-4218ab8ee1a50c83a60c86a454f21d43146b46a0.tar.zst 42-cub3d-4218ab8ee1a50c83a60c86a454f21d43146b46a0.zip |
The sky is nice
Diffstat (limited to 'src/ft_draw_scene.c')
-rw-r--r-- | src/ft_draw_scene.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 9461eef..f96eae6 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -15,6 +15,30 @@ #include <mlx.h> #include <stdint.h> +static int8_t + ft_put_stage(t_cub *clist) +{ + const uint32_t x = 15; + const uint32_t y = clist->wlist.y_size + - (clist->mlist.map_h * clist->mlist.scale) - 20; + const uint8_t len = 6 + ft_uintlen(clist->currlvl); + char *str; + + if (!(str = (char*)malloc((len + 1) * sizeof(char)))) + return (-1); + ft_sprintf(str, "Stage %hd", clist->currlvl); + if (clist->mlist.isnlvl) + { + mlx_string_put(clist->wlist.wlx, + clist->wlist.winptr, + x, y, + 0x00ff0000, + str); + } + ft_memdel((void**)&str); + return (0); +} + void ft_draw_scene(t_cub *clist) { @@ -24,9 +48,19 @@ void &clist->img.sizeline, &clist->img.endian); ft_castray(clist); if (clist->ishud) + { ft_draw_hud(clist); + ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, clist); + } mlx_put_image_to_window(clist->wlist.wlx, clist->wlist.winptr, clist->img.img, 0, 0); + if (clist->ishud) + { + 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); } |